Made 'reconfig' target use PHONY subdirectories, too
authorAlan T. DeKok <aland@freeradius.org>
Wed, 31 Mar 2010 09:25:08 +0000 (11:25 +0200)
committerAlan T. DeKok <aland@freeradius.org>
Wed, 31 Mar 2010 09:26:50 +0000 (11:26 +0200)
And added reconfig targets all over the place.  This means that
we can do "make reconfig" from (almost) anywhere, and have it work.

Makefile
src/Makefile
src/include/Makefile
src/lib/Makefile
src/main/Makefile.in
src/modules/Makefile
src/modules/rlm_eap/Makefile.in
src/modules/rlm_eap/types/Makefile
src/modules/rlm_sql/Makefile.in
src/modules/rlm_sql/drivers/Makefile.in

index 8eae3ec..e8e37bc 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -93,8 +93,8 @@ endif
 common: $(SUBDIRS)
 
 $(SUBDIRS):
-       echo "Making $(WHAT_TO_MAKE) in $@..."
-       $(MAKE) $(MFLAGS) -C $@ $(WHAT_TO_MAKE)
+       @echo "Making $(WHAT_TO_MAKE) in $@..."
+       @$(MAKE) $(MFLAGS) -C $@ $(WHAT_TO_MAKE)
 
 distclean: clean
        rm -f config.cache config.log config.status libtool \
@@ -115,6 +115,7 @@ distclean: clean
 #
 ######################################################################
 reconfig: configure src/include/autoconf.h.in
+       @$(MAKE) $(MFLAGS) -C src reconfig
 
 configure: configure.in aclocal.m4
        $(AUTOCONF)
index 0281c12..419457d 100644 (file)
@@ -9,6 +9,7 @@ include ../Make.inc
 SUBDIRS                = include lib modules main
 WHAT_TO_MAKE   = all
 
+.PHONY: all clean install reconfig
 all: freeradius-devel
        @$(MAKE) $(MFLAGS) WHAT_TO_MAKE=$@ common
 
@@ -19,12 +20,15 @@ clean:
 install:
        @$(MAKE) $(MFLAGS) WHAT_TO_MAKE=$@ common
 
+reconfig:
+       @$(MAKE) $(MFLAGS) WHAT_TO_MAKE=$@ common
+
 .PHONY: common $(SUBDIRS)
 
 common: $(SUBDIRS)
 
 $(SUBDIRS): 
-       echo "Making $(WHAT_TO_MAKE) in $@..."
+       @echo "Making $(WHAT_TO_MAKE) in $@..."
        $(MAKE) $(MFLAGS) -C $@ $(WHAT_TO_MAKE)
 
 freeradius-devel:
index daf0f98..f30450f 100644 (file)
@@ -13,6 +13,7 @@ HEADERS       = autoconf.h conf.h conffile.h detail.h dhcp.h event.h hash.h heap.h \
 include ../../Make.inc
 .PHONY: all clean distclean install
 
+.PHONY: all clean distclean install reconfig
 all: radpaths.h
 
 radpaths.h: build-radpaths-h
@@ -21,7 +22,7 @@ radpaths.h: build-radpaths-h
 distclean:
        rm -f radpaths.h
 
-clean:
+reconfig clean:
 
 install:
        $(INSTALL) -d -m 755 $(R)$(includedir)/freeradius
index 827edfb..2557201 100644 (file)
@@ -37,6 +37,7 @@ TARGET                = $(LIBPREFIX)freeradius-radius
 %.lo : %.c
        $(LIBTOOL) --mode=compile $(CC) $(CFLAGS) -c $<
 
+.PHONY: all clean install reconfig
 all: $(TARGET).la
 
 $(TARGET).la: $(LT_OBJS)
@@ -55,3 +56,5 @@ install: all
                $(R)$(libdir)/$(TARGET).la
        rm -f $(R)$(libdir)/$(TARGET)-$(RADIUSD_VERSION).la;
        ln -s $(TARGET).la $(R)$(libdir)/$(TARGET)-$(RADIUSD_VERSION).la
+
+reconfig:
index 17d6393..118e8ed 100644 (file)
@@ -58,6 +58,7 @@ MODULE_OBJS     += $(shell for x in $(SUB_MODULES);do test -f ../modules/*/types
 MODULE_OBJS     += $(shell for x in $(SUB_MODULES);do test -f ../modules/*/drivers/$$x/$$x.la && echo ../modules/*/drivers/$$x/$$x.la;done)
 endif
 
+.PHONY: all clean install reconfig
 all: $(BINARIES)
 
 $(SERVER_OBJS): $(INCLUDES)
@@ -148,3 +149,5 @@ endif
        $(INSTALL) -m 755    radlast                    $(R)$(bindir)
        $(INSTALL) -m 755    radtest                    $(R)$(bindir)
        $(INSTALL) -m 755    radzap                     $(R)$(bindir)
+
+reconfig:
index 10353d2..a3cd970 100644 (file)
@@ -22,25 +22,6 @@ clean:
 distclean:
        @$(MAKE) $(MFLAGS) WHAT_TO_MAKE=$@ common
 
-#
-#  Do NOT use "common", because some modules may not be built,
-#  and therefore their makefiles may be empty or non-existent.
-#
-reconfig:
-       @[ "x$(AUTOCONF)" != "x" ] || exit 0
-       @[ "x$(AUTOHEADER)" != "x" ] || exit 0
-       @for x in `find . -name "configure.in" -print`; do \
-               ( \
-                cd `dirname $$x` || exit $$?; \
-                if [ -f configure.in ]; then \
-                       $(AUTOCONF) -I $(top_builddir); \
-                fi; \
-                if grep AC_CONFIG_HEADERS configure.in >/dev/null; then\
-                       $(AUTOHEADER); \
-                fi; \
-               )  || exit $$?; \
-       done
-
 # Requires GNU Make, but even older ones will do.
 SUBDIRS := $(patsubst %/,%,$(dir $(wildcard $(addsuffix /Makefile,$(MODULES)))))
 
@@ -51,5 +32,35 @@ common: $(SUBDIRS)
        @[ -d lib/.libs ] || mkdir lib/.libs
 
 $(SUBDIRS): 
-       echo "Making $(WHAT_TO_MAKE) in $@..."
+       @echo "Making $(WHAT_TO_MAKE) in $@..."
        $(MAKE) $(MFLAGS) -C $@ $(WHAT_TO_MAKE)
+
+# The rlm_*/*/* stuff is to catch the configure
+CONFIG_FILES := $(wildcard rlm_*/configure.in rlm_*/*/*/configure.in)
+
+.PHONY: reconfig $(CONFIG_FILES)
+
+#
+#  Do NOT use "common", because some modules may not be built,
+#  and therefore their makefiles may be empty or non-existent.
+#
+ifeq "$(AUTOCONF)" ""
+reconfig:
+       @echo autoconf is needed for this target
+else
+ifeq "$(AUTOHEADER)" ""
+reconfig:
+       @echo autoheader is needed for this target
+else
+reconfig: $(CONFIG_FILES)
+endif
+endif
+
+# Don't use: $(MAKE) -C $(dir $@) reconfig
+# The modules may not have a Makefile
+$(CONFIG_FILES):
+       @echo "Making reconfig in $(dir $@)..."
+       @cd $(dir $@) && $(AUTOCONF) -I $(top_builddir)
+       @if grep AC_CONFIG_HEADERS $@ >/dev/null; then\
+               cd $(dir $@) && $(AUTOHEADER); \
+        fi
index 93c2f2d..5779714 100644 (file)
@@ -46,8 +46,8 @@ common: $(RLM_SUBDIRS)
 types: libeap
 
 $(RLM_SUBDIRS):
-       echo "Making $(WHAT_TO_MAKE) in $@..."
-       $(MAKE) $(MFLAGS) -C $@ $(WHAT_TO_MAKE)
+       @echo "Making $(WHAT_TO_MAKE) in $@..."
+       @$(MAKE) $(MFLAGS) -C $@ $(WHAT_TO_MAKE)
 
 libeap/$(LIBPREFIX)freeradius-eap.la: libeap
 
index d552001..874baec 100644 (file)
@@ -30,5 +30,5 @@ common: $(SUBDIRS)
 rlm_eap_peap rlm_eap_ttls: rlm_eap_tls
 
 $(PLUGINS): 
-       echo "Making $(WHAT_TO_MAKE) in $@..."
-       $(MAKE) $(MFLAGS) -C $@ $(WHAT_TO_MAKE)
+       @echo "Making $(WHAT_TO_MAKE) in $@..."
+       @$(MAKE) $(MFLAGS) -C $@ $(WHAT_TO_MAKE)
index b0838f8..e1fc428 100644 (file)
@@ -31,5 +31,5 @@ install-drivers:
 common: $(RLM_SUBDIRS)
 
 $(RLM_SUBDIRS):
-       echo "Making $(WHAT_TO_MAKE) in $@..."
-       $(MAKE) $(MFLAGS) -C $@ $(WHAT_TO_MAKE)
+       @echo "Making $(WHAT_TO_MAKE) in $@..."
+       @$(MAKE) $(MFLAGS) -C $@ $(WHAT_TO_MAKE)
index d68a363..84b0ee3 100644 (file)
@@ -20,5 +20,5 @@ common: $(SUBDIRS)
        @[ -d lib/ ] || mkdir lib
 
 $(SUBDIRS):
-       echo "Making $(WHAT_TO_MAKE) in $@."
-       $(MAKE) $(MFLAGS) -C $@ $(WHAT_TO_MAKE)
+       @echo "Making $(WHAT_TO_MAKE) in $@."
+       @$(MAKE) $(MFLAGS) -C $@ $(WHAT_TO_MAKE)