Can remove the sender and/or the recipient from the key of the greylister.
[apps/pfixtools.git] / Makefile
index 179fed8..b2290cb 100644 (file)
--- 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                  #
 #          ~~~~~~~~~                                                         #
 #  ________________________________________________________________________  #
 #                                                                            #
 #  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: $(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
 
 ###########################################################################}}}