X-Git-Url: http://git.madism.org/?p=apps%2Fpfixtools.git;a=blobdiff_plain;f=Makefile;h=88e599de711eee90f184a9ff7a110c9b04691cb3;hp=0cd61498c1ac5b5d9d08890665ea57e354f92425;hb=e327d3786ba0371eaaff8e6ba0fe3fc39f095ae2;hpb=e826fd379421938f920e7e51d2a34bf4eb3483a0 diff --git a/Makefile b/Makefile index 0cd6149..88e599d 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,58 +29,56 @@ # 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) -GENERATED = tokens.h tokens.c - -postlicyd_SOURCES = \ - str.h buffer.h job.h postfix.h gai.h \ - str.c buffer.c job.c postfix.c gai.c \ - postlicyd.c $(GENERATED) - -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) -clean: - $(RM) $(PROGRAMS) - $(RM) .*.o +distclean: $(DISTCLEAN_TARGETS) -distclean: clean - $(RM) $(GENERATED) +install: all $(INSTALL_TARGETS) -tags: .tags -.tags: $(shell git ls-files | egrep '\.[hc]$$') - ctags -o $@ $^ +$(PROGRAMS): $(LIBS) -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) +$(SUBDIRS): %: + make -C $@ all -%.c: %.sh - ./$< $@ || ($(RM) $@; exit 1) +$(CLEAN_TARGETS): clean-%: + make -C $* clean -%.h: %.sh - ./$< $@ || ($(RM) $@; exit 1) +$(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 example/postlicyd.conf $(DESTDIR)/etc/pfixtools/postlicyd.example.conf + install 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 ###########################################################################}}}