From 3b63104a32af005a99404d808cc0a1b11181151f Mon Sep 17 00:00:00 2001 From: Pierre Habouzit Date: Sun, 11 Jan 2009 19:33:36 +0100 Subject: [PATCH] simplify top-level makefile using more generic constructs. Signed-off-by: Pierre Habouzit --- Makefile | 35 +++++++---------------------------- 1 file changed, 7 insertions(+), 28 deletions(-) diff --git a/Makefile b/Makefile index 7fb3235..f6c11dd 100644 --- a/Makefile +++ b/Makefile @@ -38,38 +38,19 @@ PROGRAMS = postlicyd pfix-srsd LIBS = common SUBDIRS = $(LIBS) $(PROGRAMS) -CLEAN_TARGETS = $(addprefix clean-,$(SUBDIRS)) -DISTCLEAN_TARGETS = $(addprefix distclean-,$(SUBDIRS)) -INSTALL_TARGETS = $(addprefix install-,$(SUBDIRS)) - # RULES ###################################################################{{{ -all: $(SUBDIRS) - -clean: $(CLEAN_TARGETS) - -distclean: $(DISTCLEAN_TARGETS) - -install: all $(INSTALL_TARGETS) - -$(PROGRAMS): $(LIBS) - -$(SUBDIRS): %: - make -C $@ all - -$(CLEAN_TARGETS): clean-%: - make -C $* clean - -$(DISTCLEAN_TARGETS): distclean-%: - make -C $* distclean +all clean distclean doc install: %: %-recurse -$(INSTALL_TARGETS): install-%: % install-dir - make -C $* install +%-recurse: + @set -e $(foreach dir,$(SUBDIRS),; $(MAKE) -C $(dir) $*) -install-postlicyd: install-postlicyd-tools install-postlicyd-conf +install-recurse: install-dir +install: install-postlicyd-tools install-postlicyd-conf install-dir: install -d $(DESTDIR)$(prefix)/sbin install -d $(DESTDIR)$(prefix)/bin + install -d $(DESTDIR)$(prefix)/share/doc/pfixtools install -d $(DESTDIR)/etc/pfixtools install-postlicyd-tools: @@ -81,8 +62,6 @@ install-postlicyd-conf: install -m 640 example/postlicyd.conf $(DESTDIR)/etc/pfixtools/postlicyd.example.conf install -m 640 example/postlicyd-rsyncrbl.conf $(DESTDIR)/etc/pfixtools/postlicyd-rsyncrbl.example.conf -.PHONY: clean distclean install install-dir $(SUBDIRS) $(CLEAN_TARGETS) \ - $(DISTCLEAN_TARGETS) $(INSTALL_TARGETS) install-postlicyd-tools \ - install-postlicyd-conf +.PHONY: clean distclean install install-% %-recurse ###########################################################################}}} -- 2.20.1