X-Git-Url: http://git.madism.org/?p=apps%2Fpfixtools.git;a=blobdiff_plain;f=Makefile;h=7b58a6c6b4754aa5ed01d9aeb11ff9332c60f251;hp=19b59201640d9151ee959e820a3441058eeb19fd;hb=56eeb7d73ed0c82f2a8165b6aba525af73c58f73;hpb=7698ffbf4645b4bccbaf8db0f395f2a7c8a445b0 diff --git a/Makefile b/Makefile index 19b5920..7b58a6c 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,48 +29,57 @@ # THE POSSIBILITY OF SUCH DAMAGE. # ############################################################################## -include mk/cflags.mk +prefix ?= /usr/local -PROGRAMS = postlicyd +PROGRAMS = postlicyd pfix-srsd +LIBS = common +SUBDIRS = $(LIBS) $(PROGRAMS) -postlicyd_SOURCES = \ - str.h buffer.h job.h postfix.h query.h \ - str.c buffer.c job.c postfix.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: $(CLEAN_TARGETS) + +distclean: $(DISTCLEAN_TARGETS) + +install: all $(INSTALL_TARGETS) -clean: - $(RM) $(PROGRAMS) - $(RM) .*.o +$(PROGRAMS): $(LIBS) -distclean: clean +$(SUBDIRS): %: + make -C $@ all -tags: .tags -.tags: $(shell git ls-files | egrep '\.[hc]$$') - ctags -o $@ $^ +$(CLEAN_TARGETS): clean-%: + make -C $* clean -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) +$(DISTCLEAN_TARGETS): distclean-%: + make -C $* distclean -.%.o: %.c Makefile - $(CC) $(CFLAGS) -MMD -MT ".$*.d $@" -MF .$*.d -g -c -o $@ $< +$(INSTALL_TARGETS): install-%: % install-dir + make -C $* install -%.d: %.c Makefile - $(CC) $(CFLAGS) -MM -MT ".$*.d $@" -MF .$*.d $< +install-postlicyd: install-postlicyd-tools install-postlicyd-conf +install-dir: + install -d $(DESTDIR)$(prefix)/sbin + install -d $(DESTDIR)$(prefix)/bin + install -d $(DESTDIR)/etc/pfixtools -.SECONDEXPANSION: +install-postlicyd-tools: + install tools/postlicyd-rsyncrbl $(DESTDIR)$(prefix)/bin/postlicyd-rsyncrbl + install tools/postgrey2postlicyd $(DESTDIR)$(prefix)/bin/postgrey2postlicyd + install tools/rbldns2postlicyd $(DESTDIR)$(prefix)/bin/rbldns2postlicyd -$(PROGRAMS): $$(patsubst %.c,.%.o,$$($$@_SOURCES)) Makefile - $(CC) -o $@ $(CFLAGS) $(filter %.o,$^) $(LDFLAGS) $($@_LIBADD) $(filter %.a,$^) +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 --include $(foreach p,$(PROGRAMS),$(patsubst %.c,.%.d,$(filter %.c,$($p_SOURCES)))) +.PHONY: clean distclean install install-dir $(SUBDIRS) $(CLEAN_TARGETS) \ + $(DISTCLEAN_TARGETS) $(INSTALL_TARGETS) install-postlicyd-tools \ + install-postlicyd-conf ###########################################################################}}}