From 0347cacfe0f470353fcec0b6db06d1865b9af7cf Mon Sep 17 00:00:00 2001 From: "Alan T. DeKok" Date: Tue, 30 Mar 2010 16:04:23 +0200 Subject: [PATCH] Move to using phony targets for subdirectories. This removes the explicit shell loop over subdirs, which means that the main "make" program now tracks all dependencies. I've also updated some dependencies to be correct. Now "make -j 4" will work. --- Makefile | 12 +++++++----- src/Makefile | 12 +++++++----- src/modules/Makefile | 17 ++++++++++------- src/modules/rlm_eap/Makefile.in | 19 +++++++++++-------- src/modules/rlm_eap/types/Makefile | 23 ++++++++++++++++------- 5 files changed, 51 insertions(+), 32 deletions(-) diff --git a/Makefile b/Makefile index 8cf5e6d55f9..0627dad2311 100644 --- a/Makefile +++ b/Makefile @@ -88,11 +88,13 @@ install-chown: endif endif -common: - @for dir in $(SUBDIRS); do \ - echo "Making $(WHAT_TO_MAKE) in $$dir..."; \ - $(MAKE) $(MFLAGS) -C $$dir $(WHAT_TO_MAKE) || exit $$?; \ - done +.PHONY: common $(SUBDIRS) + +common: $(SUBDIRS) + +$(SUBDIRS): + echo "Making $(WHAT_TO_MAKE) in $@..." + $(MAKE) $(MFLAGS) -C $@ $(WHAT_TO_MAKE) distclean: clean rm -f config.cache config.log config.status libtool \ diff --git a/src/Makefile b/src/Makefile index bfd52722a00..0281c124ea1 100644 --- a/src/Makefile +++ b/src/Makefile @@ -19,11 +19,13 @@ clean: install: @$(MAKE) $(MFLAGS) WHAT_TO_MAKE=$@ common -common: - @for dir in $(SUBDIRS); do \ - echo "Making $(WHAT_TO_MAKE) in $$dir..."; \ - $(MAKE) $(MFLAGS) -C $$dir $(WHAT_TO_MAKE) || exit $$?; \ - done +.PHONY: common $(SUBDIRS) + +common: $(SUBDIRS) + +$(SUBDIRS): + echo "Making $(WHAT_TO_MAKE) in $@..." + $(MAKE) $(MFLAGS) -C $@ $(WHAT_TO_MAKE) freeradius-devel: ln -s include freeradius-devel diff --git a/src/modules/Makefile b/src/modules/Makefile index 771cd1425a1..10353d2b3b1 100644 --- a/src/modules/Makefile +++ b/src/modules/Makefile @@ -41,12 +41,15 @@ reconfig: ) || exit $$?; \ done -common: +# Requires GNU Make, but even older ones will do. +SUBDIRS := $(patsubst %/,%,$(dir $(wildcard $(addsuffix /Makefile,$(MODULES))))) + +.PHONY: common $(SUBDIRS) + +common: $(SUBDIRS) @[ -d lib/ ] || mkdir lib @[ -d lib/.libs ] || mkdir lib/.libs - @for mod in $(MODULES); do \ - if [ -d $$mod ] && [ -f $$mod/Makefile ]; then \ - echo "Making $(WHAT_TO_MAKE) in $$mod..."; \ - $(MAKE) $(MFLAGS) -C $$mod $(WHAT_TO_MAKE) || exit $$?; \ - fi; \ - done + +$(SUBDIRS): + echo "Making $(WHAT_TO_MAKE) in $@..." + $(MAKE) $(MFLAGS) -C $@ $(WHAT_TO_MAKE) diff --git a/src/modules/rlm_eap/Makefile.in b/src/modules/rlm_eap/Makefile.in index 227c3e4ff8a..93c2f2ddd5b 100644 --- a/src/modules/rlm_eap/Makefile.in +++ b/src/modules/rlm_eap/Makefile.in @@ -39,14 +39,17 @@ install-subdirs: @$(MAKE) $(MFLAGS) WHAT_TO_MAKE=install common $(LIBTOOL) --mode=install $(INSTALL) -m 755 $(INSTALLSTRIP) radeapclient$(EXEEXT) $(R)$(bindir) -common: - @for dir in $(RLM_SUBDIRS); do \ - echo "Making $(WHAT_TO_MAKE) in $$dir..."; \ - $(MAKE) $(MFLAGS) -C $$dir $(WHAT_TO_MAKE) || exit $$?; \ - done - -libeap/$(LIBPREFIX)freeradius-eap.la: - $(MAKE) $(MFLAGS) -C libeap +.PHONY: common $(RLM_SUBDIRS) + +common: $(RLM_SUBDIRS) + +types: libeap + +$(RLM_SUBDIRS): + echo "Making $(WHAT_TO_MAKE) in $@..." + $(MAKE) $(MFLAGS) -C $@ $(WHAT_TO_MAKE) + +libeap/$(LIBPREFIX)freeradius-eap.la: libeap ## this uses the RLM_CFLAGS and RLM_LIBS and SRCS defs to make TARGET. include ../rules.mak diff --git a/src/modules/rlm_eap/types/Makefile b/src/modules/rlm_eap/types/Makefile index 30a65901bc9..d55200198b9 100644 --- a/src/modules/rlm_eap/types/Makefile +++ b/src/modules/rlm_eap/types/Makefile @@ -16,10 +16,19 @@ install: reconfig: $(MAKE) $(MFLAGS) WHAT_TO_MAKE=$@ common -common: - @for mod in rlm_eap*; do \ - if [ -d $$mod ] && [ -f $$mod/Makefile ]; then \ - echo "Making $(WHAT_TO_MAKE) in $$mod..."; \ - $(MAKE) $(MFLAGS) -C $$mod $(WHAT_TO_MAKE) || exit $$?; \ - fi; \ - done +SUBDIRS := $(patsubst %/,%,$(dir $(wildcard rlm_eap*/Makefile))) + +.PHONY: common $(SUBDIRS) + +common: $(SUBDIRS) + +# The PEAP and TTLS sub-modules require eap_tls. +# +# If they're not being built, this rule is ignored because they're +# phony targets. +# +rlm_eap_peap rlm_eap_ttls: rlm_eap_tls + +$(PLUGINS): + echo "Making $(WHAT_TO_MAKE) in $@..." + $(MAKE) $(MFLAGS) -C $@ $(WHAT_TO_MAKE) -- 2.47.3