##############################################################################
-# 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
+prefix ?= /usr/local
-PROGRAMS = postlicyd
+PROGRAMS = postlicyd pfix-srsd
+LIBS = common
+SUBDIRS = $(LIBS) $(PROGRAMS)
-postlicyd_SOURCES = \
- str.h buffer.h job.h postfix.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:
- $(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)
###########################################################################}}}