mirror of
https://github.com/troglobit/libuev.git
synced 2026-10-01 05:22:25 +07:00
Initial conversion to the GNU configure and build system
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
@@ -1,151 +0,0 @@
|
||||
# libuEv -- Simple event loop for Linux
|
||||
#
|
||||
# Copyright (c) 2012 Flemming Madsen <flemming!madsen()madsensoft!dk>
|
||||
# Copyright (c) 2013-2015 Joachim Nilsson <troglobit()gmail!com>
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
#
|
||||
.PHONY: all test clean joystick test examples bench
|
||||
|
||||
# Figure out root of library, unless used as submodule
|
||||
ROOTDIR ?= $(shell pwd)
|
||||
|
||||
#VERSION = $(shell git tag -l | tail -1)
|
||||
VERSION = 1.2.4
|
||||
NAME = libuev
|
||||
PKG = $(NAME)-$(VERSION)
|
||||
ARCHIVE = $(PKG).tar.xz
|
||||
|
||||
CC ?= $(CROSS)gcc
|
||||
AR ?= $(CROSS)ar
|
||||
STRIP ?= $(CROSS)strip
|
||||
MAKE := @$(MAKE)
|
||||
INSTALL := install --backup=off
|
||||
STRIPINST := $(INSTALL) -s --strip-program=$(CROSS)strip -m 0755
|
||||
|
||||
CFLAGS += -fPIC
|
||||
CPPFLAGS += -W -Wall -Werror -Wextra
|
||||
LDFLAGS = $(EXTRA_LDFLAGS)
|
||||
ARFLAGS = crus
|
||||
MAKEFLAGS = --no-print-directory --silent
|
||||
|
||||
DISTFILES = README ChangeLog LICENSE
|
||||
HEADERS = uev.h private.h queue.h
|
||||
OBJS := uev.o io.o timer.o signal.o
|
||||
SRCS := $(OBJS:.o=.c)
|
||||
DEPS := $(SRCS:.c=.d)
|
||||
JUNK = *~ *.bak *.map .*.d *.so* *.a DEADJOE *.gdb *.elf core core.* *.html
|
||||
|
||||
VER = 1
|
||||
LIBNAME = $(NAME)
|
||||
SOLIB = $(LIBNAME).so.$(VER)
|
||||
SYMLIB = $(LIBNAME).so
|
||||
STATICLIB = $(LIBNAME).a
|
||||
TARGET = $(STATICLIB) $(SOLIB)
|
||||
|
||||
# Default install paths
|
||||
prefix ?= /usr/local
|
||||
libdir ?= $(prefix)/lib
|
||||
datadir ?= $(prefix)/share/doc/$(LIBNAME)
|
||||
incdir ?= $(prefix)/include
|
||||
|
||||
export STATICLIB JUNK ROOTDIR CFLAGS CPPFLAGS
|
||||
|
||||
# This magic trick looks like a comment, but works on BSD PMake
|
||||
#include <rules.mk>
|
||||
include rules.mk
|
||||
|
||||
# Build rules
|
||||
all: $(TARGET)
|
||||
|
||||
$(OBJS): Makefile
|
||||
|
||||
$(SOLIB): Makefile $(OBJS)
|
||||
@printf " LINK $@\n"
|
||||
@$(CC) $(LDFLAGS) -shared -Wl,-soname=$@ -o $@ $(OBJS)
|
||||
|
||||
$(STATICLIB): Makefile $(OBJS)
|
||||
@printf " ARCHIVE $@\n"
|
||||
@$(AR) $(ARFLAGS) $@ $(OBJS) 2>/dev/null
|
||||
|
||||
install-exec: all
|
||||
@printf " INSTALL $(DESTDIR)$(libdir)/$(SOLIB)\n"
|
||||
@install -d $(DESTDIR)$(libdir)
|
||||
@install $(SOLIB) $(DESTDIR)$(libdir)/$(SOLIB)
|
||||
@ln -sf $(SOLIB) $(DESTDIR)$(libdir)/$(SYMLIB)
|
||||
|
||||
install-dev:
|
||||
@install -d $(DESTDIR)$(incdir)/$(LIBNAME)
|
||||
@for file in $(HEADERS); do \
|
||||
printf " INSTALL $(DESTDIR)$(incdir)/$(LIBNAME)/$$file\n"; \
|
||||
install -m 0644 $$file $(DESTDIR)$(incdir)/$(LIBNAME)/$$file; \
|
||||
done
|
||||
@printf " INSTALL $(DESTDIR)$(libdir)/$(STATICLIB)\n"
|
||||
@install -d $(DESTDIR)$(libdir)
|
||||
@install $(STATICLIB) $(DESTDIR)$(libdir)/$(STATICLIB)
|
||||
@install -d $(DESTDIR)$(datadir)
|
||||
@for file in $(DISTFILES); do \
|
||||
printf " INSTALL $(DESTDIR)$(datadir)/$$file\n"; \
|
||||
install -m 0644 $$file $(DESTDIR)$(datadir)/$$file; \
|
||||
done
|
||||
|
||||
install: install-exec install-dev
|
||||
|
||||
uninstall:
|
||||
-@$(RM) -r $(DESTDIR)$(datadir)
|
||||
-@$(RM) -r $(DESTDIR)$(incdir)/$(LIBNAME)
|
||||
-@$(RM) $(DESTDIR)$(libdir)/$(SOLIB)
|
||||
-@$(RM) $(DESTDIR)$(libdir)/$(SYMLIB)
|
||||
-@$(RM) $(DESTDIR)$(libdir)/$(STATICLIB)
|
||||
|
||||
strip: $(TARGET)
|
||||
@printf " STRIP %s\n" $(TARGET)
|
||||
@$(STRIP) --strip-unneeded $(TARGET)
|
||||
@size $(TARGET)
|
||||
|
||||
bench: Makefile $(STATICLIB)
|
||||
@printf " RUN %s\n" $@
|
||||
@$(CC) $(CPPFLAGS) -D_GNU_SOURCE -g -o bench bench.c $(STATICLIB) && ./bench
|
||||
|
||||
examples: all
|
||||
@$(MAKE) -C examples
|
||||
|
||||
test joystick: all
|
||||
@$(MAKE) -C examples $@
|
||||
@./examples/$@
|
||||
|
||||
# Runs Clang scan-build on the whole tree
|
||||
check: clean
|
||||
@scan-build $(MAKE) all
|
||||
|
||||
clean:
|
||||
-@$(MAKE) -C examples $@
|
||||
-@$(RM) $(TARGET) *.o test joystick bench
|
||||
|
||||
distclean: clean
|
||||
-@$(MAKE) -C examples $@
|
||||
-@$(RM) $(DEPS) $(JUNK)
|
||||
|
||||
dist:
|
||||
@echo "Building .xz tarball of $(PKG) in parent dir..."
|
||||
git archive --format=tar --prefix=$(PKG)/ v$(VERSION) | xz >../$(ARCHIVE)
|
||||
@(cd ..; md5sum $(ARCHIVE) | tee $(ARCHIVE).md5)
|
||||
|
||||
# Include automatically generated rules
|
||||
-include $(DEPS)
|
||||
+66
@@ -0,0 +1,66 @@
|
||||
ACLOCAL_AMFLAGS = -I m4
|
||||
|
||||
lib_LTLIBRARIES = libuev.la
|
||||
include_HEADERS = uev.h private.h queue.h
|
||||
libuev_la_SOURCES = uev.c io.c timer.c signal.c
|
||||
|
||||
check_PROGRAMS = bench
|
||||
bench_CPPFLAGS = -D_GNU_SOURCE
|
||||
bench_LDADD = $(top_srcdir)/libuev.la
|
||||
|
||||
libuev_la_CPPFLAGS = -D_GNU_SOURCE
|
||||
libuev_la_CFLAGS = -W -Wall -Werror -Wextra
|
||||
libuev_la_LIBADD = $(LTLIBINTL)
|
||||
libuev_la_LDFLAGS = $(AM_LDFLAGS) -version-info 1:0:0
|
||||
|
||||
doc_DATA = README LICENSE
|
||||
#EXTRA_DIST = README.md AUTHORS LICENSE ChangeLog.md
|
||||
|
||||
SUBDIRS = .
|
||||
if ENABLE_EXAMPLES
|
||||
SUBDIRS += examples
|
||||
endif
|
||||
|
||||
test joystick: all-recursive
|
||||
./examples/$@
|
||||
|
||||
check-local:
|
||||
@echo " BENCH $(PACKAGE)"
|
||||
@./bench
|
||||
if ENABLE_EXAMPLES
|
||||
@echo " TEST $(PACKAGE)"
|
||||
@./examples/test
|
||||
endif
|
||||
|
||||
## Generate MD5 checksum file
|
||||
MD5 = md5sum
|
||||
md5-dist:
|
||||
@for file in $(DIST_ARCHIVES); do \
|
||||
$(MD5) $$file > $$file.md5; \
|
||||
done
|
||||
|
||||
## Check if tagged in git
|
||||
release-hook:
|
||||
if [ ! `git tag | grep $(PACKAGE_VERSION)` ]; then \
|
||||
echo; \
|
||||
printf "\e[1m\e[41mCannot find release tag $(PACKAGE_VERSION)\e[0m\n"; \
|
||||
printf "\e[1m\e[5mDo release anyway?\e[0m "; read yorn; \
|
||||
if [ "$$yorn" != "y" -a "$$yorn" != "Y" ]; then \
|
||||
printf "OK, aborting release.\n"; \
|
||||
exit 1; \
|
||||
fi; \
|
||||
echo; \
|
||||
else \
|
||||
echo; \
|
||||
printf "\e[1m\e[42mFound GIT release tag $(PACKAGE_VERSION)\e[0m\n"; \
|
||||
printf "\e[1m\e[44m>>Remember to push tags!\e[0m\n"; \
|
||||
echo; \
|
||||
fi
|
||||
|
||||
## Target to run when building a release
|
||||
release: dist release-hook md5-dist
|
||||
@for file in $(DIST_ARCHIVES); do \
|
||||
printf "$$file \tDistribution tarball\n"; \
|
||||
printf "$$file.md5\t"; cat $$file.md5 | cut -f1 -d' '; \
|
||||
mv $$file* ../; \
|
||||
done
|
||||
Executable
+3
@@ -0,0 +1,3 @@
|
||||
#!/bin/sh
|
||||
|
||||
autoreconf -W portability -visfm >/dev/null
|
||||
@@ -0,0 +1,25 @@
|
||||
# Use v2.61 for backwards compat with Ubuntu 12.04 LTS
|
||||
AC_PREREQ([2.61])
|
||||
AC_INIT(libuEv, 1.3.0-dev, https://github.com/troglobit/libuev/issues, libuev)
|
||||
AM_MAINTAINER_MODE
|
||||
AM_INIT_AUTOMAKE([1.11 foreign no-dist-gzip dist-xz])
|
||||
AM_SILENT_RULES([yes])
|
||||
|
||||
AC_CONFIG_SRCDIR(uev.c)
|
||||
AM_CONFIG_HEADER(config.h)
|
||||
AC_CONFIG_FILES([Makefile examples/Makefile])
|
||||
AC_CONFIG_MACRO_DIR([m4])
|
||||
|
||||
AC_PROG_CC
|
||||
AM_PROG_AR
|
||||
LT_INIT
|
||||
|
||||
AC_ARG_ENABLE([examples],
|
||||
[AS_HELP_STRING([--enable-examples], [build examples])],
|
||||
[enable_examples=yes], [])
|
||||
AM_CONDITIONAL([ENABLE_EXAMPLES], [test "$enable_examples" = yes])
|
||||
|
||||
AC_HEADER_STDC
|
||||
AC_C_CONST
|
||||
|
||||
AC_OUTPUT
|
||||
@@ -1,54 +0,0 @@
|
||||
# libuEv examples
|
||||
#
|
||||
# Copyright (c) 2012 Flemming Madsen <flemming!madsen()madsensoft!dk>
|
||||
# Copyright (c) 2013-2015 Joachim Nilsson <troglobit()gmail!com>
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining
|
||||
# a copy of this software and associated documentation files (the
|
||||
# "Software"), to deal in the Software without restriction, including
|
||||
# without limitation the rights to use, copy, modify, merge, publish,
|
||||
# distribute, sublicense, and/or sell copies of the Software, and to
|
||||
# permit persons to whom the Software is furnished to do so, subject to
|
||||
# the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be
|
||||
# included in all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
#
|
||||
.PHONY: all clean
|
||||
|
||||
TARGET = signal test joystick
|
||||
OBJS := $(addsuffix .o, $(TARGET))
|
||||
SRCS := $(OBJS:.o=.c)
|
||||
DEPS := $(SRCS:.c=.d)
|
||||
CPPFLAGS += -I../
|
||||
LDFLAGS := -L../
|
||||
LDLIBS := ../$(STATICLIB)
|
||||
|
||||
# This magic trick looks like a comment, but works on BSD PMake
|
||||
#include <../rules.mk>
|
||||
include ../rules.mk
|
||||
|
||||
all: $(TARGET)
|
||||
|
||||
signal: signal.o
|
||||
|
||||
test: test.o
|
||||
|
||||
joystick: joystick.o
|
||||
|
||||
clean:
|
||||
-@$(RM) $(TARGET) *.o
|
||||
|
||||
distclean: clean
|
||||
-@$(RM) $(DEPS) $(JUNK)
|
||||
|
||||
# Include automatically generated rules
|
||||
-include $(DEPS)
|
||||
@@ -0,0 +1,5 @@
|
||||
noinst_PROGRAMS = signal test joystick
|
||||
AM_CPPFLAGS = -I$(top_srcdir)
|
||||
AM_LDFLAGS = -L$(top_srcdir)
|
||||
LIBS = $(LTLIBINTL)
|
||||
LDADD = $(top_srcdir)/libuev.la
|
||||
@@ -1,9 +0,0 @@
|
||||
# Pretty printing and GCC -M for auto dep files
|
||||
%.o: %.c
|
||||
@printf " CC $(subst $(ROOTDIR)/,,$(shell pwd)/)$@\n"
|
||||
@$(CC) $(CFLAGS) $(CPPFLAGS) -c -MMD -MP -o $@ $<
|
||||
|
||||
%: %.o
|
||||
@printf " LINK $(subst $(ROOTDIR)/,,$(shell pwd)/)$@\n"
|
||||
@$(CC) $(CFLAGS) $(LDFLAGS) -Wl,-Map,$@.map -o $@ $^ $(LDLIBS$(LDLIBS-$(@)))
|
||||
|
||||
Reference in New Issue
Block a user