From 9e97a100e23a5e534f2598ce49b4029362c767c9 Mon Sep 17 00:00:00 2001 From: Jonas Fonseca Date: Sat, 22 Oct 2005 13:25:28 +0200 Subject: [PATCH] Introduce 'make cleanall' and run it in the build dir when configuring ... but only if Makefile.config exists. cleanall will cause make to enter even SUBDIR-no dirs and clean OBJS-no files. This should fix the linking problem report by zas when running: ./configure --enable-fastmem ; make ; \ ./configure --enable-debug ; make --- Makefile.lib | 20 ++++++++++++++++++-- configure.in | 19 +++++++++++++++++-- 2 files changed, 35 insertions(+), 4 deletions(-) diff --git a/Makefile.lib b/Makefile.lib index 43900e02..09177455 100644 --- a/Makefile.lib +++ b/Makefile.lib @@ -72,6 +72,18 @@ ifdef OBJS-yes OBJS += $(OBJS-yes) endif +ifneq ($(findstring cleanall,$(MAKECMDGOALS)),) + +ifdef SUBDIRS-no +SUBDIRS += $(SUBDIRS-no) +endif +ifdef OBJS-no +OBJS += $(OBJS-no) +endif + +endif + + ifdef OBJS lib.o: $(sort $(OBJS)) $(foreach subdir,$(sort $(filter-out src,$(SUBDIRS))), $(wildcard $(subdir)/lib.o)) $(call cmd,ld_objs) @@ -90,6 +102,8 @@ list-default: clean-default: -test -z "$(CLEAN)" || $(RM) $(CLEAN) +cleanall-default: clean-default + install-default: all-default ifdef PROGS $(MKINSTALLDIRS) $(DESTDIR)$(bindir) @@ -109,9 +123,9 @@ endif # Recursion: -.PHONY: all-recursive install-recursive clean-recursive list-recursive +.PHONY: all-recursive install-recursive clean-recursive cleanall-recursive list-recursive -all-recursive install-recursive clean-recursive list-recursive: +all-recursive install-recursive clean-recursive cleanall-recursive list-recursive: ifdef SUBDIRS @$(foreach subdir,$(sort $(SUBDIRS)), \ $(call ncmd,recmake,$(subdir),$(subst -recursive,,$@)) || exit 1;) @@ -120,6 +134,8 @@ endif all: all-recursive all-default all-local install: install-recursive install-default install-local clean: clean-recursive clean-default clean-local + +cleanall: cleanall-recursive cleanall-default list: list-recursive list-default all-local: diff --git a/configure.in b/configure.in index 194f457d..66bd63a1 100644 --- a/configure.in +++ b/configure.in @@ -18,6 +18,19 @@ AC_CHECK_PROG(AUTOHEADER,[autoheader],[autoheader],[config/missing autoheader]) AC_PROG_MAKE_SET +MAKE= + +for make in gnumake gmake make false; do + if test "x$MAKE" = x; then + AC_PATH_PROGS(MAKE, "$make") + fi +done + +# Cleanup if we are configuring with a previous build in the tree +if test -e Makefile.config; then + "$MAKE" -C "$builddir" cleanall >/dev/null 2>/dev/null +fi + builddir="`pwd`" dnl =================================================================== @@ -1254,7 +1267,9 @@ AC_OUTPUT([ \ srcdir2="$(cd "$srcdir" && pwd)" if test "$srcdir2" != "$builddir"; then - for i in $(make -C "$srcdir" list | grep Makefile); do + MAKEFILES=$("$MAKE" -C "$srcdir" list | grep Makefile) + + for i in $MAKEFILES; do $MKINSTALLDIRS "$builddir/$(dirname $i)" grep top_builddir= "$srcdir/$i" > "$builddir/$i" case "$srcdir" in @@ -1264,7 +1279,7 @@ if test "$srcdir2" != "$builddir"; then echo "creating $builddir/$i" done fi - + dnl =================================================================== dnl Configuration summary