X-Git-Url: http://git.madism.org/?p=apps%2Fpfixtools.git;a=blobdiff_plain;f=Makefile;h=b2290cb9312cbe75466b533a68e366d7e097d8a6;hp=bf0c2e5b774b3ec32dc6d78d55b164ecd3079096;hb=7fa8c1bc673add68529fa2bda8134be5089e8745;hpb=4b706468477ccccc11d9aeb3bccdbe67b777c298 diff --git a/Makefile b/Makefile index bf0c2e5..b2290cb 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,56 @@ # 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 = -ludns +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)/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 ###########################################################################}}}