X-Git-Url: http://git.madism.org/?a=blobdiff_plain;f=Makefile;h=e9e391709a8f9bbe35892a5a7e3742f1eb29a8d5;hb=b6ff37e18e7794cb9f92c175118344be6282d1f0;hp=179fed860bce2d54abd3309fda1ac8576ff4e5c3;hpb=59c1f51ef38081d87885a37873545154c7a23e2d;p=apps%2Fpfixtools.git diff --git a/Makefile b/Makefile index 179fed8..e9e3917 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ ############################################################################## -# postlicyd: a postfix policy daemon with a lot of features # +# pfixtools: a collection of postfix related tools # # ~~~~~~~~~ # # ________________________________________________________________________ # # # @@ -29,49 +29,45 @@ # THE POSSIBILITY OF SUCH DAMAGE. # ############################################################################## -include mk/cflags.mk -CFLAGS += --std=gnu99 -D_GNU_SOURCE -D_FORTIFY_SOURCE=1 +prefix ?= /usr/local -PROGRAMS = postlicyd +PROGRAMS = postlicyd pfix-srsd +LIBS = common +SUBDIRS = $(LIBS) $(PROGRAMS) -postlicyd_SOURCES = \ - str.h buffer.h job.h postfix.h gai.h query.h \ - str.c buffer.c job.c postfix.c gai.c \ - postlicyd.c - -postlicyd_LIBADD = -lanl +CLEAN_TARGETS = $(addprefix clean-,$(SUBDIRS)) +DISTCLEAN_TARGETS = $(addprefix distclean-,$(SUBDIRS)) +INSTALL_TARGETS = $(addprefix install-,$(SUBDIRS)) # RULES ###################################################################{{{ -all: $(PROGRAMS) +all: $(SUBDIRS) -clean: - $(RM) $(PROGRAMS) - $(RM) .*.o +clean: $(CLEAN_TARGETS) -distclean: clean +distclean: $(DISTCLEAN_TARGETS) -tags: .tags -.tags: $(shell git ls-files | egrep '\.[hc]$$') - ctags -o $@ $^ +install: all $(INSTALL_TARGETS) -headers: HEADACHEOPTS=-c mk/headache.cfg -h COPYING -headers: - @which headache > /dev/null || \ - ( echo "package headache not installed" ; exit 1 ) - @git ls-files | egrep '(\.h|\.c|Makefile|*\.mk)$$' | xargs -t headache $(HEADACHEOPTS) +$(PROGRAMS): $(LIBS) -.%.o: %.c Makefile - $(CC) $(CFLAGS) -MMD -MT ".$*.d $@" -MF .$*.d -g -c -o $@ $< +$(SUBDIRS): %: + make -C $@ all -%.d: %.c Makefile - $(CC) $(CFLAGS) -MM -MT ".$*.d $@" -MF .$*.d $< +$(CLEAN_TARGETS): clean-%: + make -C $* clean -.SECONDEXPANSION: +$(DISTCLEAN_TARGETS): distclean-%: + make -C $* distclean -$(PROGRAMS): $$(patsubst %.c,.%.o,$$($$@_SOURCES)) Makefile - $(CC) -o $@ $(CFLAGS) $(filter %.o,$^) $(LDFLAGS) $($@_LIBADD) $(filter %.a,$^) +$(INSTALL_TARGETS): install-%: % install-dir + make -C $* install --include $(foreach p,$(PROGRAMS),$(patsubst %.c,.%.d,$(filter %.c,$($p_SOURCES)))) +install-dir: + install -d $(DESTDIR)$(prefix)/sbin + install -d $(DESTDIR)/etc/pfixtools + install example/postlicyd.conf $(DESTDIR)/etc/pfixtools/postlicyd.example.conf +.PHONY: clean distclean install install-dir $(SUBDIRS) $(CLEAN_TARGETS) \ + $(DISTCLEAN_TARGETS) $(INSTALL_TARGETS) ###########################################################################}}}