Bugzilla bug #29427: implemented the 'distclean' target and made
'realclean' and 'clobber_all' synonymous with 'distclean'. This
patch is contributed by Chris Seawood <cls@seawood.org>. r=wtc@netscape.com
Modified files: Makefile, Makefile.in, configure, configure.in,
config/Makefile.in, config/config.mk, config/rules.mk
--- a/Makefile
+++ b/Makefile
@@ -39,16 +39,20 @@ ifdef PR_CLIENT_BUILD
export::
rm -r -f $(DIST)/../public/nspr
ifdef PR_CLIENT_BUILD_UNIX
rm -f $(DIST)/lib/libnspr.a
rm -f $(DIST)/bin/libnspr.$(DLL_SUFFIX)
endif
endif
+distclean realclean clobber_all::
+ @echo "cd pr/tests; $(MAKE) $@"
+ @$(MAKE) -C pr/tests $@
+
release::
echo $(BUILD_NUMBER) > $(RELEASE_DIR)/$(BUILD_NUMBER)/version.df
@if test -f imports.df; then \
echo "cp -f imports.df $(RELEASE_DIR)/$(BUILD_NUMBER)/imports.df"; \
cp -f imports.df $(RELEASE_DIR)/$(BUILD_NUMBER)/imports.df; \
else \
echo "echo > $(RELEASE_DIR)/$(BUILD_NUMBER)/imports.df"; \
echo > $(RELEASE_DIR)/$(BUILD_NUMBER)/imports.df; \
--- a/Makefile.in
+++ b/Makefile.in
@@ -26,16 +26,18 @@ include $(MOD_DEPTH)/config/autoconf.mk
DIRS = config pr lib
ifdef MOZILLA_CLIENT
PR_CLIENT_BUILD = 1
PR_CLIENT_BUILD_UNIX = 1
endif
+DIST_GARBAGE = config.cache config.log config.status dist
+
include $(topsrcdir)/config/rules.mk
#
# The -ll option of zip converts CR LF to LF.
#
ifeq ($(OS_ARCH),WINNT)
ZIP_ASCII_OPT = -ll
endif
@@ -44,16 +46,22 @@ ifdef PR_CLIENT_BUILD
export::
rm -r -f $(DIST)/../public/nspr
ifdef PR_CLIENT_BUILD_UNIX
rm -f $(DIST)/lib/libnspr.a
rm -f $(DIST)/bin/libnspr.$(DLL_SUFFIX)
endif
endif
+# Delete config/autoconf.mk last because it is included by every makefile.
+distclean realclean clobber_all::
+ @echo "cd pr/tests; $(MAKE) $@"
+ @$(MAKE) -C pr/tests $@
+ rm -f config/autoconf.mk
+
release::
echo $(BUILD_NUMBER) > $(RELEASE_DIR)/$(BUILD_NUMBER)/version.df
@if test -f imports.df; then \
echo "cp -f imports.df $(RELEASE_DIR)/$(BUILD_NUMBER)/imports.df"; \
cp -f imports.df $(RELEASE_DIR)/$(BUILD_NUMBER)/imports.df; \
else \
echo "echo > $(RELEASE_DIR)/$(BUILD_NUMBER)/imports.df"; \
echo > $(RELEASE_DIR)/$(BUILD_NUMBER)/imports.df; \
--- a/config/Makefile.in
+++ b/config/Makefile.in
@@ -22,16 +22,20 @@ topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(MOD_DEPTH)/config/autoconf.mk
# Indicate that this directory builds build tools.
INTERNAL_TOOLS = 1
+# autoconf.mk must be deleted last (from the top-level directory)
+# because it is included by every makefile.
+DIST_GARBAGE = nsprincl.mk nsprincl.sh
+
include $(topsrcdir)/config/config.mk
CSRCS = nsinstall.c now.c
PLSRCS = nfspwd.pl
ifeq ($(OS_ARCH), WINNT)
PROG_SUFFIX = .exe
--- a/config/config.mk
+++ b/config/config.mk
@@ -70,16 +70,20 @@ endif
endif
ifdef BUILD_DEBUG_GC
DEFINES += -DDEBUG_GC
endif
GARBAGE += $(DEPENDENCIES) core $(wildcard core.[0-9]*)
+ifdef USE_AUTOCONF
+DIST_GARBAGE += Makefile
+endif
+
DEFINES += -DFORCE_PR_LOG
ifeq ($(_PR_NO_CLOCK_TIMER),1)
DEFINES += -D_PR_NO_CLOCK_TIMER
endif
ifeq ($(USE_PTHREADS), 1)
DEFINES += -D_PR_PTHREADS -UHAVE_CVAR_BUILT_ON_SEM
--- a/config/rules.mk
+++ b/config/rules.mk
@@ -146,17 +146,17 @@ endif
ifeq ($(OS_ARCH), WINNT)
ifneq ($(OS_TARGET), WIN16)
OBJS += $(RES)
endif
endif
ALL_TRASH = $(TARGETS) $(OBJS) $(filter-out . .., $(OBJDIR)) LOGS TAGS $(GARBAGE) \
- $(NOSUCHFILE) \
+ $(DIST_GARBAGE) $(NOSUCHFILE) \
so_locations
ifdef DIRS
LOOP_OVER_DIRS = \
@for d in $(DIRS); do \
if test -d $$d; then \
set -e; \
echo "cd $$d; $(MAKE) $@"; \
@@ -184,18 +184,18 @@ install::
clean::
rm -rf $(OBJS) so_locations $(NOSUCHFILE) $(GARBAGE)
+$(LOOP_OVER_DIRS)
clobber::
rm -rf $(OBJS) $(TARGETS) $(filter-out . ..,$(OBJDIR)) $(GARBAGE) so_locations $(NOSUCHFILE)
+$(LOOP_OVER_DIRS)
-realclean clobber_all::
- rm -rf $(wildcard *.OBJ *.OBJD) dist $(ALL_TRASH)
+distclean realclean clobber_all::
+ rm -rf $(wildcard *.OBJ *.OBJD) $(ALL_TRASH)
+$(LOOP_OVER_DIRS)
release:: export
ifdef RELEASE_BINS
@echo "Copying executable programs and scripts to release directory"
@if test -z "$(BUILD_NUMBER)"; then \
echo "BUILD_NUMBER must be defined"; \
false; \
--- a/configure
+++ b/configure
@@ -3911,16 +3911,57 @@ fi
+MAKEFILES="
+Makefile
+config/Makefile
+config/autoconf.mk
+config/nsprincl.mk
+config/nsprincl.sh
+lib/Makefile
+lib/ds/Makefile
+lib/libc/Makefile
+lib/libc/include/Makefile
+lib/libc/src/Makefile
+pr/Makefile
+pr/include/Makefile
+pr/include/md/Makefile
+pr/include/obsolete/Makefile
+pr/include/private/Makefile
+pr/src/Makefile
+pr/src/io/Makefile
+pr/src/linking/Makefile
+pr/src/malloc/Makefile
+pr/src/md/Makefile
+pr/src/md/${PR_MD_ARCH_DIR}/Makefile
+pr/src/memory/Makefile
+pr/src/misc/Makefile
+pr/src/threads/Makefile
+pr/tests/Makefile
+pr/tests/dll/Makefile
+"
+
+if test -z "$USE_PTHREADS" && test -z "$USE_BTHREADS"; then
+ MAKEFILES="$MAKEFILES pr/src/threads/combined/Makefile"
+elif test -n "$USE_PTHREADS"; then
+ MAKEFILES="$MAKEFILES pr/src/pthreads/Makefile"
+elif test -n "$USE_BTHREADS"; then
+ MAKEFILES="$MAKEFILES pr/src/bthreads/Makefile"
+fi
+
+if test -n "$USE_CPLUS"; then
+ MAKEFILES="$MAKEFILES pr/src/cplus/Makefile pr/src/cplus/tests/Makefile"
+fi
+
trap '' 1 2 15
cat > confcache <<\EOF
# This file is a shell script that caches the results of configure
# tests run on this system so they can be shared between configure
# scripts and configure runs. It is not useful on other systems.
# If it contains results you don't want to keep, you may remove or edit it.
#
# By default, configure uses ./config.cache as the cache file,
@@ -4024,60 +4065,17 @@ do
echo "\$ac_cs_usage"; exit 0 ;;
*) echo "\$ac_cs_usage"; exit 1 ;;
esac
done
ac_given_srcdir=$srcdir
ac_given_INSTALL="$INSTALL"
-trap 'rm -fr `echo "
-Makefile
-config/Makefile
-config/autoconf.mk
-config/nsprincl.mk
-config/nsprincl.sh
-lib/Makefile
-lib/ds/Makefile
-lib/libc/Makefile
-lib/libc/include/Makefile
-lib/libc/src/Makefile
-lib/msgc/Makefile
-lib/msgc/include/Makefile
-lib/msgc/src/Makefile
-lib/msgc/tests/Makefile
-lib/prstreams/Makefile
-lib/tests/Makefile
-pr/Makefile
-pr/include/Makefile
-pr/include/md/Makefile
-pr/include/obsolete/Makefile
-pr/include/private/Makefile
-pr/src/Makefile
-pr/src/bthreads/Makefile
-pr/src/cplus/Makefile
-pr/src/cplus/tests/Makefile
-pr/src/io/Makefile
-pr/src/linking/Makefile
-pr/src/malloc/Makefile
-pr/src/md/Makefile
-pr/src/md/beos/Makefile
-pr/src/md/os2/Makefile
-pr/src/md/unix/Makefile
-pr/src/md/windows/Makefile
-pr/src/memory/Makefile
-pr/src/misc/Makefile
-pr/src/pthreads/Makefile
-pr/src/threads/Makefile
-pr/src/threads/combined/Makefile
-pr/tests/Makefile
-pr/tests/dll/Makefile
-pr/tests/w16gui/Makefile
-tools/Makefile
-" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
+trap 'rm -fr `echo "$MAKEFILES" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
EOF
cat >> $CONFIG_STATUS <<EOF
# Protect against being on the right side of a sed subst in config.status.
sed 's/%@/@@/; s/@%/@@/; s/%g\$/@g/; /@g\$/s/[\\\\&%]/\\\\&/g;
s/@@/%@/; s/@@/@%/; s/@g\$/%g/' > conftest.subs <<\\CEOF
$ac_vpsub
$extrasub
@@ -4210,59 +4208,17 @@ while $ac_more_lines; do
done
if test -z "$ac_sed_cmds"; then
ac_sed_cmds=cat
fi
EOF
cat >> $CONFIG_STATUS <<EOF
-CONFIG_FILES=\${CONFIG_FILES-"Makefile
-config/Makefile
-config/autoconf.mk
-config/nsprincl.mk
-config/nsprincl.sh
-lib/Makefile
-lib/ds/Makefile
-lib/libc/Makefile
-lib/libc/include/Makefile
-lib/libc/src/Makefile
-lib/msgc/Makefile
-lib/msgc/include/Makefile
-lib/msgc/src/Makefile
-lib/msgc/tests/Makefile
-lib/prstreams/Makefile
-lib/tests/Makefile
-pr/Makefile
-pr/include/Makefile
-pr/include/md/Makefile
-pr/include/obsolete/Makefile
-pr/include/private/Makefile
-pr/src/Makefile
-pr/src/bthreads/Makefile
-pr/src/cplus/Makefile
-pr/src/cplus/tests/Makefile
-pr/src/io/Makefile
-pr/src/linking/Makefile
-pr/src/malloc/Makefile
-pr/src/md/Makefile
-pr/src/md/beos/Makefile
-pr/src/md/os2/Makefile
-pr/src/md/unix/Makefile
-pr/src/md/windows/Makefile
-pr/src/memory/Makefile
-pr/src/misc/Makefile
-pr/src/pthreads/Makefile
-pr/src/threads/Makefile
-pr/src/threads/combined/Makefile
-pr/tests/Makefile
-pr/tests/dll/Makefile
-pr/tests/w16gui/Makefile
-tools/Makefile
-"}
+CONFIG_FILES=\${CONFIG_FILES-"$MAKEFILES"}
EOF
cat >> $CONFIG_STATUS <<\EOF
for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then
# Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
case "$ac_file" in
*:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'`
ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
*) ac_file_in="${ac_file}.in" ;;
@@ -4323,9 +4279,8 @@ EOF
cat >> $CONFIG_STATUS <<\EOF
exit 0
EOF
chmod +x $CONFIG_STATUS
rm -fr confdefs* $ac_clean_files
test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1
-
--- a/configure.in
+++ b/configure.in
@@ -1072,55 +1072,53 @@ AC_SUBST(AIX_LINK_OPTS)
AC_SUBST(NOSUCHFILE)
AC_SUBST(MOZ_OBJFORMAT)
AC_SUBST(ULTRASPARC_LIBRARY)
AC_SUBST(ULTRASPARC_FILTER_LIBRARY)
dnl ========================================================
dnl Generate output files.
dnl ========================================================
-AC_OUTPUT([
+MAKEFILES="
Makefile
config/Makefile
config/autoconf.mk
config/nsprincl.mk
config/nsprincl.sh
lib/Makefile
lib/ds/Makefile
lib/libc/Makefile
lib/libc/include/Makefile
lib/libc/src/Makefile
-lib/msgc/Makefile
-lib/msgc/include/Makefile
-lib/msgc/src/Makefile
-lib/msgc/tests/Makefile
-lib/prstreams/Makefile
-lib/tests/Makefile
pr/Makefile
pr/include/Makefile
pr/include/md/Makefile
pr/include/obsolete/Makefile
pr/include/private/Makefile
pr/src/Makefile
-pr/src/bthreads/Makefile
-pr/src/cplus/Makefile
-pr/src/cplus/tests/Makefile
pr/src/io/Makefile
pr/src/linking/Makefile
pr/src/malloc/Makefile
pr/src/md/Makefile
-pr/src/md/beos/Makefile
-pr/src/md/os2/Makefile
-pr/src/md/unix/Makefile
-pr/src/md/windows/Makefile
+pr/src/md/${PR_MD_ARCH_DIR}/Makefile
pr/src/memory/Makefile
pr/src/misc/Makefile
-pr/src/pthreads/Makefile
pr/src/threads/Makefile
-pr/src/threads/combined/Makefile
pr/tests/Makefile
pr/tests/dll/Makefile
-pr/tests/w16gui/Makefile
-tools/Makefile
-])
+"
+dnl lib/tests/Makefile
+dnl pr/tests/w16gui/Makefile
+dnl tools/Makefile
-dnl lib/prstreams/tests/testprstrm/Makefile
-dnl lib/tests/windows/makefile
+if test -z "$USE_PTHREADS" && test -z "$USE_BTHREADS"; then
+ MAKEFILES="$MAKEFILES pr/src/threads/combined/Makefile"
+elif test -n "$USE_PTHREADS"; then
+ MAKEFILES="$MAKEFILES pr/src/pthreads/Makefile"
+elif test -n "$USE_BTHREADS"; then
+ MAKEFILES="$MAKEFILES pr/src/bthreads/Makefile"
+fi
+
+if test -n "$USE_CPLUS"; then
+ MAKEFILES="$MAKEFILES pr/src/cplus/Makefile pr/src/cplus/tests/Makefile"
+fi
+
+AC_OUTPUT([$MAKEFILES])