X-Git-Url: http://git.madism.org/?a=blobdiff_plain;f=Makefile;h=e9e391709a8f9bbe35892a5a7e3742f1eb29a8d5;hb=92dc834e982d4b71ce6a3fcc2c973e555afd3fcf;hp=49ac809f6fea213298efd381963f42f7a8516e0c;hpb=6276d460a9deb4bb530cefdaa0a43b62a8ed5854;p=apps%2Fpfixtools.git diff --git a/Makefile b/Makefile index 49ac809..e9e3917 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,45 @@ # 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 policy.h \ - str.c buffer.c policy.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) ###########################################################################}}}