diff options
-rw-r--r-- | GNUmakefile | 2 | ||||
-rw-r--r-- | include/GNUmakefile | 50 | ||||
-rw-r--r-- | include/wolf/daemon/daemon.h (renamed from include/daemon/daemon.h) | 0 | ||||
-rw-r--r-- | include/wolf/daemon/signals.h (renamed from include/daemon/signals.h) | 0 | ||||
-rw-r--r-- | include/wolf/errors.h (renamed from include/errors.h) | 0 | ||||
-rw-r--r-- | include/wolf/log.h (renamed from include/log.h) | 0 | ||||
-rw-r--r-- | include/wolf/port/stdbool.h (renamed from include/port/stdbool.h) | 0 | ||||
-rw-r--r-- | include/wolf/port/sys.h (renamed from include/port/sys.h) | 0 | ||||
-rw-r--r-- | include/wolf/port/unused.h (renamed from include/port/unused.h) | 0 | ||||
-rw-r--r-- | makefiles/install.mk | 25 | ||||
-rw-r--r-- | makefiles/platform.mk | 2 | ||||
-rw-r--r-- | makefiles/sub.mk | 1 | ||||
-rw-r--r-- | makefiles/top.mk | 5 | ||||
-rw-r--r-- | src/GNUmakefile | 5 |
14 files changed, 88 insertions, 2 deletions
diff --git a/GNUmakefile b/GNUmakefile index 01d0368..9e5cd85 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -1,5 +1,5 @@ TOPDIR = . -SUBDIRS = src tests docs +SUBDIRS = src include tests docs -include $(TOPDIR)/makefiles/top.mk diff --git a/include/GNUmakefile b/include/GNUmakefile new file mode 100644 index 0000000..d48732e --- /dev/null +++ b/include/GNUmakefile @@ -0,0 +1,50 @@ +TOPDIR = .. + +SUBDIRS = + +INCLUDE_DIRS = -I$(TOPDIR)/include -I. + +BINS = + +LIBS = libwolf.a + +PORT_OBJS = \ + port/lockf.o \ + port/snprintf.o + +COMMON_OBJS = \ + log.o + +DAEMON_OBJS = \ + daemon/signals.o \ + daemon/pidfile.o \ + daemon/daemon.o + +OBJS = \ + $(PORT_OBJS) \ + $(COMMON_OBJS) \ + $(DAEMON_OBJS) + +local_all: $(LIBS) + +-include $(TOPDIR)/makefiles/sub.mk + +libwolf.a: $(OBJS) + $(AR) cr $@ $? + +local_clean: + -@rm port/*.bak 2>/dev/null + -@rm port/*~ 2>/dev/null + -@rm port/*.d 2>/dev/null + -@rm libwolf.a 2>/dev/null + +local_distclean: + -@rm libwolf.a + +local_install: + $(INSTALL) -d -m 755 $(includedir)/wolf + $(INSTALL) -m 644 wolf/*.h $(includedir)/wolf + $(INSTALL) -d -m 755 $(includedir)/wolf/daemon + $(INSTALL) -m 644 wolf/daemon/*.h $(includedir)/wolf/daemon + $(INSTALL) -d -m 755 $(includedir)/wolf/port + $(INSTALL) -m 644 wolf/port/*.h $(includedir)/wolf/port diff --git a/include/daemon/daemon.h b/include/wolf/daemon/daemon.h index 1359e6e..1359e6e 100644 --- a/include/daemon/daemon.h +++ b/include/wolf/daemon/daemon.h diff --git a/include/daemon/signals.h b/include/wolf/daemon/signals.h index 46124a8..46124a8 100644 --- a/include/daemon/signals.h +++ b/include/wolf/daemon/signals.h diff --git a/include/errors.h b/include/wolf/errors.h index ed5ef82..ed5ef82 100644 --- a/include/errors.h +++ b/include/wolf/errors.h diff --git a/include/log.h b/include/wolf/log.h index 7e18c5f..7e18c5f 100644 --- a/include/log.h +++ b/include/wolf/log.h diff --git a/include/port/stdbool.h b/include/wolf/port/stdbool.h index 015465c..015465c 100644 --- a/include/port/stdbool.h +++ b/include/wolf/port/stdbool.h diff --git a/include/port/sys.h b/include/wolf/port/sys.h index f13ca19..f13ca19 100644 --- a/include/port/sys.h +++ b/include/wolf/port/sys.h diff --git a/include/port/unused.h b/include/wolf/port/unused.h index 7bf61a1..7bf61a1 100644 --- a/include/port/unused.h +++ b/include/wolf/port/unused.h diff --git a/makefiles/install.mk b/makefiles/install.mk new file mode 100644 index 0000000..c59f33e --- /dev/null +++ b/makefiles/install.mk @@ -0,0 +1,25 @@ +# install +# +# requires: +# - DESTDIR: temporary or final destination dir for installation +# - prefix: prefix for the directory root (e.g. /usr) +# +# provides: +# - target: install + +# default values +DESTDIR= +prefix=/usr + +# standard directories following FHS +execdir=$(DESTDIR)/$(prefix) +bindir=$(execdir)/bin +sbindir=$(execdir)/sbin +libdir=$(execdir)/lib +sysconfdir=$(execdir)/etc +includedir=$(execdir)/include + +.PHONY: install local_install +install: local_install + @test -z "$(SUBDIRS)" || ( set -e; for d in $(SUBDIRS)""; do \ + (set -e; $(MAKE) -C $$d install || exit 1); done) diff --git a/makefiles/platform.mk b/makefiles/platform.mk index 175e25f..a837fa2 100644 --- a/makefiles/platform.mk +++ b/makefiles/platform.mk @@ -24,11 +24,13 @@ PLATFORM_COMPILE_FLAGS = \ -DOS_MAJOR_VERSION=$(OS_MAJOR_VERSION) \ -DOS_MINOR_VERSION=$(OS_MINOR_VERSION) +# TODO: should not be probed! LIBS_DL = $(shell $(TOPDIR)/makefiles/guess_env --libs-dl) LIBS_SSP = $(shell $(TOPDIR)/makefiles/guess_env --libs-ssl) EXE = SO = .so +INSTALL = install GCC_MAJOR_VERSION = $(shell $(TOPDIR)/makefiles/guess_env --gcc-major-version $(CC)) GCC_MINOR_VERSION = $(shell $(TOPDIR)/makefiles/guess_env --gcc-minor-version $(CC)) diff --git a/makefiles/sub.mk b/makefiles/sub.mk index cab1635..cc4967f 100644 --- a/makefiles/sub.mk +++ b/makefiles/sub.mk @@ -23,3 +23,4 @@ test: local_test -include $(TOPDIR)/makefiles/depend.mk -include $(TOPDIR)/makefiles/clean.mk +-include $(TOPDIR)/makefiles/install.mk diff --git a/makefiles/top.mk b/makefiles/top.mk index f41fe9b..6574138 100644 --- a/makefiles/top.mk +++ b/makefiles/top.mk @@ -27,6 +27,11 @@ distclean: clean test -z "$(SUBDIRS)" || ( set -e; for d in $(SUBDIRS)""; do \ (set -e; $(MAKE) -C $$d distclean || exit 1); done) +.PHONY: install +install: + test -z "$(SUBDIRS)" || ( set -e; for d in $(SUBDIRS)""; do \ + (set -e; $(MAKE) -C $$d install || exit 1); done) + .PHONY: test test: all @$(MAKE) -C tests test diff --git a/src/GNUmakefile b/src/GNUmakefile index f3556e8..8b00cb9 100644 --- a/src/GNUmakefile +++ b/src/GNUmakefile @@ -40,4 +40,7 @@ local_clean: local_distclean: -@rm libwolf.a -
\ No newline at end of file + +local_install: + $(INSTALL) -d -m 755 $(libdir)/wolf + $(INSTALL) -m 644 libwolf.a $(libdir)/wolf |