From 297019fb411ea6e77b42b867dcf4fa5fc637384e Mon Sep 17 00:00:00 2001
From: Mike Hibler <mike@flux.utah.edu>
Date: Mon, 26 Apr 2004 18:20:42 +0000
Subject: [PATCH] Cleanup Makefiles:

1. "make clean" will just remove stuff built in the process of a regular build
2. "make distclean" will also clean out configure generated files.

This is how it was always supposed to be, there was just some bitrot.
---
 GNUmakefile.in                                |  2 +-
 configure                                     | 20 +++---
 configure.in                                  | 20 +++---
 defs-aerolab                                  | 39 +++++++++++
 event/GNUmakefile.in                          | 65 ++++---------------
 event/linktest/GNUmakefile.in                 | 18 +++--
 .../{tb_compat.tcl.in => tb_compat.tcl}       |  0
 event/nsetrafgen/GNUmakefile.in               |  4 +-
 event/tbgen/GNUmakefile.in                    |  2 +-
 os/GNUmakefile.in                             |  4 +-
 os/growdisk/GNUmakefile.in                    |  4 +-
 os/imagezip/GNUmakefile.in                    | 11 +++-
 os/imagezip/ntfs/GNUmakefile.in               |  9 ++-
 os/imagezip/ntfs/libntfs/GNUmakefile.in       |  5 +-
 os/syncd/GNUmakefile.in                       |  2 +-
 pxe/GNUmakefile.in                            |  2 +-
 rc.d/GNUmakefile.in                           |  3 +-
 security/GNUmakefile.in                       |  4 +-
 sensors/slothd/GNUmakefile.in                 |  2 +-
 tbsetup/GNUmakefile.in                        |  5 +-
 tmcd/GNUmakefile.in                           | 22 +++----
 tmcd/freebsd/GNUmakefile.in                   |  2 +-
 tmcd/freebsd5/GNUmakefile.in                  |  5 +-
 tmcd/linux/GNUmakefile.in                     |  4 +-
 tools/GNUmakefile.in                          | 10 +--
 utils/GNUmakefile.in                          |  9 ++-
 26 files changed, 144 insertions(+), 129 deletions(-)
 create mode 100644 defs-aerolab
 rename event/linktest/{tb_compat.tcl.in => tb_compat.tcl} (100%)

diff --git a/GNUmakefile.in b/GNUmakefile.in
index 08d829c97f..212c0eef98 100644
--- a/GNUmakefile.in
+++ b/GNUmakefile.in
@@ -131,7 +131,7 @@ install-dbfillcheck:
 
 clean:		clean-subdirs
 distclean:	distclean-subdirs
-	rm -f Makeconf GNUmakefile config.status config.cache config.log
+	rm -f Makeconf GNUmakefile config.h config.status config.cache config.log
 	rm -f $(DISTCLEAN_FILES)
 
 # How to recursively descend into subdirectories to make general
diff --git a/configure b/configure
index e16d706773..563abdfb9f 100755
--- a/configure
+++ b/configure
@@ -1247,9 +1247,9 @@ else
 		    event/program-agent/GNUmakefile \
 		    event/stated/waitForState \
 		    event/stated/GNUmakefile event/stated/stated \
-			event/linktest/GNUmakefile \
-			event/linktest/linktest.h \
-			event/linktest/linktest.pl";
+		    event/linktest/GNUmakefile \
+		    event/linktest/linktest.h event/linktest/linktest.pl \
+		    event/linktest/run_linktest.pl";
 
 	optional_subdirs="$optional_subdirs event";
         EVENTSYS=1;
@@ -1388,6 +1388,7 @@ outfiles="$outfiles Makeconf GNUmakefile \
 	db/sitevarscheck db/dbfillcheck \
 	db/grabron db/webnfree db/stategraph db/readycount \
 	db/idletimes db/idlemail db/webidlemail db/xmlconvert \
+	db/node_list db/webnewwanode \
 	ipod/GNUmakefile \
 	lib/GNUmakefile lib/libtb/GNUmakefile \
 	os/GNUmakefile os/split-image.sh os/imagezip/GNUmakefile \
@@ -1418,15 +1419,15 @@ outfiles="$outfiles Makeconf GNUmakefile \
 	tbsetup/snmpit tbsetup/ns2ir/GNUmakefile \
 	tbsetup/ns2ir/parse.tcl tbsetup/ns2ir/tb_compat.tcl \
 	tbsetup/ns2ir/parse-ns tbsetup/ns2ir/parse.proxy \
-	tbsetup/ns2ir/sim.tcl tbsetup/nseparse/GNUmakefile \
+	tbsetup/ns2ir/sim.tcl tbsetup/nseswap tbsetup/nseparse/GNUmakefile \
 	tbsetup/nseparse/nse.parse.proxy tbsetup/nseparse/parse-nse \
 	tbsetup/nseparse/nse.parse.tcl tbsetup/db2ns \
-	tbsetup/tbprerun tbsetup/tbswap tbsetup/tbend \
+	tbsetup/tbprerun tbsetup/tbswap tbsetup/tbend tbsetup/tbrestart \
 	tbsetup/tbreport tbsetup/named_setup tbsetup/exports_setup \
 	tbsetup/checkpass/GNUmakefile tbsetup/assign_wrapper tbsetup/ptopgen \
 	tbsetup/frisbeelauncher tbsetup/node_update tbsetup/webnodeupdate \
 	tbsetup/savelogs tbsetup/setgroups tbsetup/websetgroups \
-	tbsetup/rmgroup tbsetup/webrmgroup tbsetup/mkexpdir \
+	tbsetup/rmgroup tbsetup/webrmuser tbsetup/webrmgroup tbsetup/mkexpdir \
 	tbsetup/webnodecontrol tbsetup/node_control \
         tbsetup/webmkgroup tbsetup/mkgroup tbsetup/eventsys_start \
 	tbsetup/eventsys_control \
@@ -1434,6 +1435,7 @@ outfiles="$outfiles Makeconf GNUmakefile \
 	tbsetup/portstats tbsetup/vnode_setup tbsetup/staticroutes \
 	tbsetup/console_setup.proxy tbsetup/exports_setup.proxy \
 	tbsetup/checkports tbsetup/webnodereboot tbsetup/libaudit.pm \
+	tbsetup/libreboot.pm tbsetup/libosload.pm \
 	tbsetup/sfskey_update tbsetup/sfskey_update.proxy \
 	tbsetup/idleswap tbsetup/webidleswap tbsetup/switchmac \
 	tbsetup/newnode_reboot \
@@ -1466,9 +1468,9 @@ outfiles="$outfiles Makeconf GNUmakefile \
 	utils/nsgen/GNUmakefile utils/nsgen/webnsgen \
 	www/GNUmakefile www/defs.php3 www/dbdefs.php3 \
 	www/swish.conf www/websearch \
-	vis/GNUmakefile vis/webvistopology \
-	vis/dbvistopology \
+	vis/GNUmakefile vis/webvistopology vis/dbvistopology \
 	vis/prerender vis/prerender_all vis/render \
+	vis/floormap vis/webfloormap \
 	rc.d/GNUmakefile rc.d/2.mysql-server.sh rc.d/3.testbed.sh \
 	rc.d/2.elvind.sh rc.d/3.plab.sh \
 	tools/GNUmakefile \
@@ -1479,6 +1481,8 @@ outfiles="$outfiles Makeconf GNUmakefile \
         xmlrpc/GNUmakefile xmlrpc/emulabclient.py xmlrpc/emulabserver.py \
 	xmlrpc/sshxmlrpc_client.py xmlrpc/sshxmlrpc_server.py \
 	xmlrpc/webxmlrpc \
+	xmlrpc/emulab xmlrpc/node xmlrpc/experiment xmlrpc/fs xmlrpc/user \
+	xmlrpc/imageid xmlrpc/osid \
 	install/ops-install install/boss-install \
 	install/newnode_sshkeys/GNUmakefile "
 
diff --git a/configure.in b/configure.in
index 3db54db90f..5125ef9f0a 100755
--- a/configure.in
+++ b/configure.in
@@ -362,9 +362,9 @@ else
 		    event/program-agent/GNUmakefile \
 		    event/stated/waitForState \
 		    event/stated/GNUmakefile event/stated/stated \
-			event/linktest/GNUmakefile \
-			event/linktest/linktest.h \
-			event/linktest/linktest.pl";
+		    event/linktest/GNUmakefile \
+		    event/linktest/linktest.h event/linktest/linktest.pl \
+		    event/linktest/run_linktest.pl";
 
 	optional_subdirs="$optional_subdirs event";
         EVENTSYS=1;
@@ -433,6 +433,7 @@ outfiles="$outfiles Makeconf GNUmakefile \
 	db/sitevarscheck db/dbfillcheck \
 	db/grabron db/webnfree db/stategraph db/readycount \
 	db/idletimes db/idlemail db/webidlemail db/xmlconvert \
+	db/node_list db/webnewwanode \
 	ipod/GNUmakefile \
 	lib/GNUmakefile lib/libtb/GNUmakefile \
 	os/GNUmakefile os/split-image.sh os/imagezip/GNUmakefile \
@@ -463,15 +464,15 @@ outfiles="$outfiles Makeconf GNUmakefile \
 	tbsetup/snmpit tbsetup/ns2ir/GNUmakefile \
 	tbsetup/ns2ir/parse.tcl tbsetup/ns2ir/tb_compat.tcl \
 	tbsetup/ns2ir/parse-ns tbsetup/ns2ir/parse.proxy \
-	tbsetup/ns2ir/sim.tcl tbsetup/nseparse/GNUmakefile \
+	tbsetup/ns2ir/sim.tcl tbsetup/nseswap tbsetup/nseparse/GNUmakefile \
 	tbsetup/nseparse/nse.parse.proxy tbsetup/nseparse/parse-nse \
 	tbsetup/nseparse/nse.parse.tcl tbsetup/db2ns \
-	tbsetup/tbprerun tbsetup/tbswap tbsetup/tbend \
+	tbsetup/tbprerun tbsetup/tbswap tbsetup/tbend tbsetup/tbrestart \
 	tbsetup/tbreport tbsetup/named_setup tbsetup/exports_setup \
 	tbsetup/checkpass/GNUmakefile tbsetup/assign_wrapper tbsetup/ptopgen \
 	tbsetup/frisbeelauncher tbsetup/node_update tbsetup/webnodeupdate \
 	tbsetup/savelogs tbsetup/setgroups tbsetup/websetgroups \
-	tbsetup/rmgroup tbsetup/webrmgroup tbsetup/mkexpdir \
+	tbsetup/rmgroup tbsetup/webrmuser tbsetup/webrmgroup tbsetup/mkexpdir \
 	tbsetup/webnodecontrol tbsetup/node_control \
         tbsetup/webmkgroup tbsetup/mkgroup tbsetup/eventsys_start \
 	tbsetup/eventsys_control \
@@ -479,6 +480,7 @@ outfiles="$outfiles Makeconf GNUmakefile \
 	tbsetup/portstats tbsetup/vnode_setup tbsetup/staticroutes \
 	tbsetup/console_setup.proxy tbsetup/exports_setup.proxy \
 	tbsetup/checkports tbsetup/webnodereboot tbsetup/libaudit.pm \
+	tbsetup/libreboot.pm tbsetup/libosload.pm \
 	tbsetup/sfskey_update tbsetup/sfskey_update.proxy \
 	tbsetup/idleswap tbsetup/webidleswap tbsetup/switchmac \
 	tbsetup/newnode_reboot \
@@ -511,9 +513,9 @@ outfiles="$outfiles Makeconf GNUmakefile \
 	utils/nsgen/GNUmakefile utils/nsgen/webnsgen \
 	www/GNUmakefile www/defs.php3 www/dbdefs.php3 \
 	www/swish.conf www/websearch \
-	vis/GNUmakefile vis/webvistopology \
-	vis/dbvistopology \
+	vis/GNUmakefile vis/webvistopology vis/dbvistopology \
 	vis/prerender vis/prerender_all vis/render \
+	vis/floormap vis/webfloormap \
 	rc.d/GNUmakefile rc.d/2.mysql-server.sh rc.d/3.testbed.sh \
 	rc.d/2.elvind.sh rc.d/3.plab.sh \
 	tools/GNUmakefile \
@@ -524,6 +526,8 @@ outfiles="$outfiles Makeconf GNUmakefile \
         xmlrpc/GNUmakefile xmlrpc/emulabclient.py xmlrpc/emulabserver.py \
 	xmlrpc/sshxmlrpc_client.py xmlrpc/sshxmlrpc_server.py \
 	xmlrpc/webxmlrpc \
+	xmlrpc/emulab xmlrpc/node xmlrpc/experiment xmlrpc/fs xmlrpc/user \
+	xmlrpc/imageid xmlrpc/osid \
 	install/ops-install install/boss-install \
 	install/newnode_sshkeys/GNUmakefile "
 
diff --git a/defs-aerolab b/defs-aerolab
new file mode 100644
index 0000000000..7b5ff297f6
--- /dev/null
+++ b/defs-aerolab
@@ -0,0 +1,39 @@
+#
+# This is the defaults definitions file for configure.
+# See doc/setup.txt for an explanation of these variables.
+#
+# Use the --with-TBDEFS=filename to specify your own file.
+# If you add a variable, be sure to go and update configure.in.
+#
+TBDBNAME=tbdb
+TBADMINGROUP=tbadmin
+TBOPSEMAIL=aerolab-ops@ops.outernet.aero.org
+TBLOGSEMAIL=aerolab-logs@ops.outernet.aero.org
+TBWWWEMAIL=aerolab-www@ops.outernet.aero.org
+TBAPPROVALEMAIL=aerolab-approval@ops.outernet.aero.org
+TBAUDITEMAIL=aerolab-audit@ops.outernet.aero.org
+TBSTATEDEMAIL=aerolab-stated@ops.outernet.aero.org
+TBTESTSUITEEMAIL=aerolab-testsuite@ops.outernet.aero.org
+TBAUTOMAILEMAIL=aerolab-automail@ops.outernet.aero.org
+TBACTIVEARCHIVE=aerolab-active-users-archive@ops.outernet.aero.org
+TBUSERSARCHIVE=testbed-users-archive\@ops.outernet.aero.org
+JAILIPBASE=172.16.0.0
+JAILIPMASK=255.240.0.0
+DELAYCAPACITY=2
+BOSSNODE=boss.outernet.aero.org
+USERNODE=users.outernet.aero.org
+FSNODE=fs.outernet.aero.org
+OURDOMAIN=outernet.aero.org
+FSDIR_GROUPS=/Volumes/BAD/emulab/groups
+FSDIR_PROJ=/Volumes/BAD/emulab/proj
+FSDIR_USERS=/Volumes/BAD/emulab/users
+FSDIR_SHARE=/Volumes/BAD/emulab/share
+FS_WITH_QUOTAS=""
+WWWHOST=www.outernet.aero.org
+TBMAINSITE=1
+THISHOMEBASE=Outernet.aero.org
+PLABSUPPORT=0
+SFSSUPPORT=0
+DISABLE_NSE=1
+DISABLE_NAMED_SETUP=1
+DISABLE_EXPORTS_SETUP=1
diff --git a/event/GNUmakefile.in b/event/GNUmakefile.in
index ff7eb0ba0c..60c7d17011 100644
--- a/event/GNUmakefile.in
+++ b/event/GNUmakefile.in
@@ -18,43 +18,14 @@ ifeq ($(SYSTEM),FreeBSD)
 SUBDIRS	       += sched delay-agent nsetrafgen stated
 endif
 
-all:	$(SUBDIRS)
+all:	all-subdirs
 
 include $(TESTBED_SRCDIR)/GNUmakerules
 
-lib:
-	@$(MAKE) -C lib all
-
-sched:
-	@$(MAKE) -C sched all
-
-tbgen:
-	@$(MAKE) -C tbgen all
-
-example:
-	@$(MAKE) -C example all
-
-trafgen:
+trafgen-fetch:
 	$(SRCDIR)/trafgen/tg-install $(SRCDIR)/trafgen
-	@$(MAKE) -C trafgen all
-
-nsetrafgen:
-	@$(MAKE) -C nsetrafgen all
-
-delay-agent:
-	@$(MAKE) -C delay-agent all
 
-program-agent:
-	@$(MAKE) -C program-agent all
-
-stated:
-	@$(MAKE) -C stated all
-
-proxy:
-	@$(MAKE) -C proxy all
-
-linktest:
-	@$(MAKE) -C linktest all
+trafgen:	trafgen-fetch
 
 install: 
 	@$(MAKE) -C lib install
@@ -63,7 +34,7 @@ install:
 	@$(MAKE) -C stated install
 	@$(MAKE) -C linktest install
 
-client-install: lib
+client-install: lib/all.MAKE
 ifeq ($(SYSTEM),FreeBSD)
 	@$(MAKE) -C delay-agent client-install
 endif
@@ -77,27 +48,13 @@ control-install:
 	@$(MAKE) -C lib control-install
 	@$(MAKE) -C tbgen control-install
 
-clean:		subdir-clean
+clean:		clean-subdirs
+distclean:	distclean-subdirs
 
-subdir-clean:
-	@$(MAKE) -C lib clean
-	@$(MAKE) -C sched clean
-	@$(MAKE) -C tbgen clean
-	@$(MAKE) -C example clean
-	@$(MAKE) -C trafgen clean
-	@$(MAKE) -C delay-agent clean
-	@$(MAKE) -C program-agent clean
-
-distclean:	subdir-distclean
-
-subdir-distclean:
-	@$(MAKE) -C lib distclean
-	@$(MAKE) -C sched distclean
-	@$(MAKE) -C tbgen distclean
-	@$(MAKE) -C example distclean
-	@$(MAKE) -C trafgen distclean
-	@$(MAKE) -C delay-agent distclean
-	@$(MAKE) -C program-agent distclean
+# How to recursively descend into subdirectories to make general
+# targets such as `all'.
+%.MAKE:
+	@$(MAKE) -C $(dir $@) $(basename $(notdir $@))
+%-subdirs: $(addsuffix /%.MAKE,$(SUBDIRS)) ;
 
 .PHONY:	$(SUBDIRS)
-
diff --git a/event/linktest/GNUmakefile.in b/event/linktest/GNUmakefile.in
index 8db2363c51..e552aeff33 100644
--- a/event/linktest/GNUmakefile.in
+++ b/event/linktest/GNUmakefile.in
@@ -22,7 +22,7 @@ SYSTEM	       := $(shell uname -s)
 
 include $(OBJDIR)/Makeconf
 
-all:	binaries $(SCRIPT) $(SCRIPT_RUN) $(SCRIPT_TBCOMPAT)
+all:	binaries $(SCRIPT) $(SCRIPT_RUN)
 
 include $(TESTBED_SRCDIR)/GNUmakerules
 
@@ -58,12 +58,13 @@ $(LIBEVENTDIR)/%.a:
 
 binaries: $(LOCAL_BINDIR)/$(DAEMON) $(LOCAL_BINDIR)/$(LTEVENT) 
 
-$(LOCAL_BINDIR)/$(DAEMON):	$(DAEMON_OBJS) $(LIBTB_OBJS)
+$(LOCAL_BINDIR):
 	-mkdir -p $(LOCAL_BINDIR)
+
+$(LOCAL_BINDIR)/$(DAEMON):	$(LOCAL_BINDIR) $(DAEMON_OBJS) $(LIBTB_OBJS)
 	$(CC) $(LDFLAGS) $(DAEMON_OBJS) $(LIBTB_OBJS) $(LIBS) -o $@
 
-$(LOCAL_BINDIR)/$(LTEVENT):	$(LTEVENT_OBJS) $(LIBTB_OBJS)
-	-mkdir -p $(LOCAL_BINDIR)
+$(LOCAL_BINDIR)/$(LTEVENT):	$(LOCAL_BINDIR) $(LTEVENT_OBJS) $(LIBTB_OBJS)
 	$(CC) $(LDFLAGS) $(LTEVENT_OBJS) $(LIBTB_OBJS) $(LIBS) -o $@
 
 $(DAEMON_OBJS):	linktest.h ../lib/libevent.a ../lib/event.h
@@ -86,7 +87,7 @@ client-install: all
 			$(DESTDIR)$(CLIENT_BINDIR)/$(SCRIPT)
 	$(INSTALL_PROGRAM) $(SCRIPT_RUN) \
 			$(DESTDIR)$(CLIENT_BINDIR)/$(SCRIPT_RUN)
-	$(INSTALL_PROGRAM) $(SCRIPT_TBCOMPAT) \
+	$(INSTALL_PROGRAM) $(SRCDIR)/$(SCRIPT_TBCOMPAT) \
 			$(DESTDIR)$(CLIENT_BINDIR)/$(SCRIPT_TBCOMPAT)
 	$(INSTALL_PROGRAM) $(NSTOIRDIR)/$(SCRIPT_NSTB_COMPAT) \
 			$(DESTDIR)$(CLIENT_BINDIR)/$(SCRIPT_NSTB_COMPAT)
@@ -96,8 +97,5 @@ lt-install:
             $(DESTDIR)$(CLIENT_BINDIR)/$(SCRIPT)
 
 clean:
-	/bin/rm -f *.o $(TESTS)
-	/bin/rm -f $(LOCAL_BINDIR)/$(DAEMON)
-	/bin/rm -f $(LOCAL_BINDIR)/$(LTEVENT)
-	/bin/rm -f $(SCRIPT)
-	/bin/rm -f $(SCRIPT_RUN)
+	rm -f *.o $(TESTS)
+	rm -rf $(LOCAL_BINDIR)
diff --git a/event/linktest/tb_compat.tcl.in b/event/linktest/tb_compat.tcl
similarity index 100%
rename from event/linktest/tb_compat.tcl.in
rename to event/linktest/tb_compat.tcl
diff --git a/event/nsetrafgen/GNUmakefile.in b/event/nsetrafgen/GNUmakefile.in
index 29c92c3d92..43d58bba50 100644
--- a/event/nsetrafgen/GNUmakefile.in
+++ b/event/nsetrafgen/GNUmakefile.in
@@ -1,6 +1,6 @@
 #
 # EMULAB-COPYRIGHT
-# Copyright (c) 2000-2003 University of Utah and the Flux Group.
+# Copyright (c) 2000-2004 University of Utah and the Flux Group.
 # All rights reserved.
 #
 
@@ -58,4 +58,4 @@ client-install:
 	fi
 
 clean:
-	/bin/rm -f $(INSTALL_NSE)
+	rm -f $(INSTALL_NSE)
diff --git a/event/tbgen/GNUmakefile.in b/event/tbgen/GNUmakefile.in
index b8ab46a92f..5bdf5256c7 100644
--- a/event/tbgen/GNUmakefile.in
+++ b/event/tbgen/GNUmakefile.in
@@ -67,4 +67,4 @@ client-install: tevc
 	$(INSTALL_PROGRAM) -s tevc $(DESTDIR)$(CLIENT_BINDIR)/tevc
 
 clean:
-	/bin/rm -f *.o $(PROGRAMS)
+	rm -f *.o $(PROGRAMS)
diff --git a/os/GNUmakefile.in b/os/GNUmakefile.in
index f88eb91bcb..8f59d77c4b 100644
--- a/os/GNUmakefile.in
+++ b/os/GNUmakefile.in
@@ -1,6 +1,6 @@
 #
 # EMULAB-COPYRIGHT
-# Copyright (c) 2000-2003 University of Utah and the Flux Group.
+# Copyright (c) 2000-2004 University of Utah and the Flux Group.
 # All rights reserved.
 #
 
@@ -56,6 +56,8 @@ clean:		subdir-clean
 subdir-clean:
 	@$(MAKE) -C imagezip clean
 	@$(MAKE) -C frisbee.redux clean
+	@$(MAKE) -C growdisk clean
+	@$(MAKE) -C syncd clean
 
 distclean:	subdir-distclean
 
diff --git a/os/growdisk/GNUmakefile.in b/os/growdisk/GNUmakefile.in
index 633f1da643..73734739b3 100644
--- a/os/growdisk/GNUmakefile.in
+++ b/os/growdisk/GNUmakefile.in
@@ -1,6 +1,6 @@
 #
 # EMULAB-COPYRIGHT
-# Copyright (c) 2000-2002 University of Utah and the Flux Group.
+# Copyright (c) 2000-2004 University of Utah and the Flux Group.
 # All rights reserved.
 #
 
@@ -26,4 +26,4 @@ growdisk: growdisk.o
 install:
 
 clean:
-	/bin/rm -f *.o growdisk growdisk.debug
+	rm -f *.o growdisk growdisk.debug
diff --git a/os/imagezip/GNUmakefile.in b/os/imagezip/GNUmakefile.in
index ac0d617e42..a418114fe8 100644
--- a/os/imagezip/GNUmakefile.in
+++ b/os/imagezip/GNUmakefile.in
@@ -119,14 +119,21 @@ client-install: all
 	$(INSTALL_PROGRAM) imagedump $(DESTDIR)/usr/local/bin/imagedump
 
 clean: subdir-clean
-	/bin/rm -f *.o imagezip imageunzip imagedump version.c
-	/bin/rm -f imagezip.tar imagezip.tar.gz
+	rm -f *.o imagezip imageunzip imagedump imagehash version.c
+	rm -f imagezip.tar imagezip.tar.gz
 
 subdir-clean:
 	@list='$(SUBDIRS)'; for dir in $$list; do \
 		$(MAKE) -C $$dir clean; \
 	done;
 
+distclean: subdir-distclean
+
+subdir-distclean:
+	@list='$(SUBDIRS)'; for dir in $$list; do \
+		$(MAKE) -C $$dir distclean; \
+	done;
+
 imagezip.tar.gz: imagezip.tar
 	gzip -c imagezip.tar > imagezip.tar.gz
 
diff --git a/os/imagezip/ntfs/GNUmakefile.in b/os/imagezip/ntfs/GNUmakefile.in
index dcebf18ffc..e4bd0be79b 100644
--- a/os/imagezip/ntfs/GNUmakefile.in
+++ b/os/imagezip/ntfs/GNUmakefile.in
@@ -1,6 +1,6 @@
 #
 # EMULAB-COPYRIGHT
-# Copyright (c) 2000-2003 University of Utah and the Flux Group.
+# Copyright (c) 2000-2004 University of Utah and the Flux Group.
 # All rights reserved.
 #
 
@@ -47,6 +47,9 @@ liblocale/liblocale.a:
 	@$(MAKE) -C liblocale
 
 clean:
-	-$(MAKE) -C libntfs clean
-	-$(MAKE) -C liblocale clean
+	@$(MAKE) -C libntfs clean
+	@$(MAKE) -C liblocale clean
 	/bin/rm -f libntfs.a liblocale.a ntfs_glue.o
+
+distclean:
+	@$(MAKE) -C libntfs distclean
diff --git a/os/imagezip/ntfs/libntfs/GNUmakefile.in b/os/imagezip/ntfs/libntfs/GNUmakefile.in
index 64af1f5fd5..8280a5486c 100644
--- a/os/imagezip/ntfs/libntfs/GNUmakefile.in
+++ b/os/imagezip/ntfs/libntfs/GNUmakefile.in
@@ -1,6 +1,6 @@
 #
 # EMULAB-COPYRIGHT
-# Copyright (c) 2000-2003 University of Utah and the Flux Group.
+# Copyright (c) 2000-2004 University of Utah and the Flux Group.
 # All rights reserved.
 #
 
@@ -82,3 +82,6 @@ endif
 clean:
 	-rm -f *.o *~ *.a config.* Makefile
 	-rm -rf $(NTFSDIR) 
+
+distclean:
+	-rm -rf *.gz *.spec *-h doc libtool include libntfs
diff --git a/os/syncd/GNUmakefile.in b/os/syncd/GNUmakefile.in
index 81f6048f29..735f32a0ac 100644
--- a/os/syncd/GNUmakefile.in
+++ b/os/syncd/GNUmakefile.in
@@ -40,5 +40,5 @@ check:
 	sh $(SRCDIR)/syncd_test.sh
 
 clean:
-	/bin/rm -f *.o emulab-syncd version.c
+	rm -f *.o emulab-syncd emulab-sync version.c
 
diff --git a/pxe/GNUmakefile.in b/pxe/GNUmakefile.in
index 14ba2264dd..4f7dda23a7 100644
--- a/pxe/GNUmakefile.in
+++ b/pxe/GNUmakefile.in
@@ -78,4 +78,4 @@ install:	$(INSTALL_SBINDIR)/bootinfo \
 		$(INSTALL_ETCDIR)/bootinfo.conf
 
 clean: 
-	rm -f *.o core bootinfo bootinfosend *.restart testmysql
+	rm -f *.o core bootinfo bootinfosend testmysql bootinfo_version.c
diff --git a/rc.d/GNUmakefile.in b/rc.d/GNUmakefile.in
index f0fc4ea4b7..cd457ff81a 100644
--- a/rc.d/GNUmakefile.in
+++ b/rc.d/GNUmakefile.in
@@ -9,6 +9,7 @@ SUBDIR		= rc.d
 include $(OBJDIR)/Makeconf
 
 RC_SCRIPTS	= 2.mysql-server.sh 3.testbed.sh 2.elvind.sh 1.named.sh
+
 #
 # Force dependencies to make sure configure regenerates if the .in file
 # is changed.
@@ -25,5 +26,3 @@ $(INSTALL_RCDIR)/%: %
 
 
 install: $(addprefix $(INSTALL_RCDIR)/, $(RC_SCRIPTS))
-
-clean:
diff --git a/security/GNUmakefile.in b/security/GNUmakefile.in
index 6b425667ec..f8de236292 100644
--- a/security/GNUmakefile.in
+++ b/security/GNUmakefile.in
@@ -1,6 +1,6 @@
 #
 # EMULAB-COPYRIGHT
-# Copyright (c) 2000-2003 University of Utah and the Flux Group.
+# Copyright (c) 2000-2004 University of Utah and the Flux Group.
 # All rights reserved.
 #
 
@@ -55,4 +55,4 @@ post-install:
 control-install:	$(addprefix $(INSTALL_BINDIR)/, plasticwrap)
 
 clean:
-	rm -f *.o $(BINS) $(SBINS) $(SCRIPTS) core
+	rm -f *.o genlastlog suexec core
diff --git a/sensors/slothd/GNUmakefile.in b/sensors/slothd/GNUmakefile.in
index b7578eb837..be557b48af 100644
--- a/sensors/slothd/GNUmakefile.in
+++ b/sensors/slothd/GNUmakefile.in
@@ -61,5 +61,5 @@ client-install: client
 	$(INSTALL_PROGRAM) -s $(SLOTHD_DIR)/slothd $(DESTDIR)$(CLIENT_BINDIR)
 
 clean:
-	rm -f *.o $(SDPROGS) $(SBIN_SCRIPTS) *~ core *.core version.c
+	rm -f *.o $(SDPROGS) *~ core *.core version.c
 	rm -rf fbsdclient linuxclient
diff --git a/tbsetup/GNUmakefile.in b/tbsetup/GNUmakefile.in
index 934bc6dabb..638a4d6ab3 100644
--- a/tbsetup/GNUmakefile.in
+++ b/tbsetup/GNUmakefile.in
@@ -182,14 +182,15 @@ control-install:	$(addprefix $(INSTALL_SBINDIR)/, console_setup.proxy) \
 #
 tipserv-install:	$(addprefix $(INSTALL_SBINDIR)/, console_setup.proxy)
 
+
 clean:	subdir-clean
-	rm -f *.o core
+	rm -f *.o core routecalc wanlinksolve
 
 subdir-clean:
 	@$(MAKE) -C checkpass clean
 	@$(MAKE) -C ns2ir clean
 	@$(MAKE) -C nseparse clean
-#	@$(MAKE) -C plab clean
+	@$(MAKE) -C plab clean
 	@$(MAKE) -C ipassign clean
 
 distclean:	subdir-distclean
diff --git a/tmcd/GNUmakefile.in b/tmcd/GNUmakefile.in
index 57a25d554f..2175f6523f 100644
--- a/tmcd/GNUmakefile.in
+++ b/tmcd/GNUmakefile.in
@@ -30,6 +30,10 @@ TMLIBS	+= -lssl -lcrypto
 SSLOBJ   = ssl.o
 ifeq ($(SYSTEM),Linux)
 TMLIBS  += -ldl
+MDSUBDIR  = linux
+endif
+ifeq ($(SYSTEM),FreeBSD)
+MDSUBDIR  = freebsd
 endif
 
 ifeq ($(EVENTSYS),1)
@@ -71,16 +75,7 @@ install:	$(INSTALL_SBINDIR)/tmcd \
 
 
 client-install: tmcc-nossl findif
-ifeq ($(SYSTEM),FreeBSD)
-	@$(MAKE) -C freebsd install
-else
-ifeq ($(SYSTEM),Linux)
-	@$(MAKE) -C linux install
-else
-	@echo "unknown OS, nothing to install"
-endif
-endif
-#endif
+	@$(MAKE) -C $(MDSUBDIR) install
 
 $(INSTALL_BINDIR)/tmcd/%: %
 	@echo "Installing $<"
@@ -96,5 +91,8 @@ ${OBJDIR}/event/lib/%:
 ${OBJDIR}/lib/libtb/%:
 	cd ${OBJDIR}/lib/tbdb && gmake $<
 
-clean: 
-	rm -f *.o core tmcd tmcd.restart tmcc tmcc-nossl findif version.c
+clean:	subdir-clean
+	rm -f *.o core tmcd tmcc tmcc-nossl findif version.c
+
+subdir-clean:
+	@$(MAKE) -C $(MDSUBDIR) clean
diff --git a/tmcd/freebsd/GNUmakefile.in b/tmcd/freebsd/GNUmakefile.in
index 523fac0fed..1cddda005a 100644
--- a/tmcd/freebsd/GNUmakefile.in
+++ b/tmcd/freebsd/GNUmakefile.in
@@ -173,4 +173,4 @@ locrem-install:
 			$(BINDIR)/control_interface
 
 clean:
-	/bin/rm -f injail
+	rm -f injail
diff --git a/tmcd/freebsd5/GNUmakefile.in b/tmcd/freebsd5/GNUmakefile.in
index ed18f6fccb..d8370df443 100644
--- a/tmcd/freebsd5/GNUmakefile.in
+++ b/tmcd/freebsd5/GNUmakefile.in
@@ -57,7 +57,7 @@ basefbsd-install: dir-install
 	(cd ../freebsd; $(MAKE) all install)
 	rm -f $(SYSETCDIR)/start_if.*
 
-sup-install:	dir-install
+sup-install:	dir-install supfile
 	$(INSTALL) -m 755 ./supfile $(ETCDIR)/supfile
 
 bin-install:	dir-install
@@ -84,6 +84,3 @@ jail-install:	dir-install
 	$(INSTALL) -m 755 $(SRCDIR)/jail/jailsetup $(BINDIR)/jailsetup
 	$(INSTALL) -m 755 $(SRCDIR)/jail/mkjail.pl $(BINDIR)/mkjail.pl
 	$(INSTALL) -m 755 ./injail $(JAILDIR)/injail
-
-clean:
-	/bin/rm -f supfile
diff --git a/tmcd/linux/GNUmakefile.in b/tmcd/linux/GNUmakefile.in
index 2145bdc22e..f4c7a1c620 100644
--- a/tmcd/linux/GNUmakefile.in
+++ b/tmcd/linux/GNUmakefile.in
@@ -61,7 +61,7 @@ dir-install:
 common-install:	dir-install
 	(cd ../common; $(MAKE) local-install)
 
-sup-install:	dir-install
+sup-install:	dir-install supfile
 	$(INSTALL) -m 755 ./supfile $(ETCDIR)/supfile
 	$(INSTALL) -m 750 -o root -g wheel -d $(DESTDIR)/root/.cvsup
 	$(INSTALL) -m 600 $(SRCDIR)/cvsup.auth $(DESTDIR)/root/.cvsup/auth
@@ -77,7 +77,7 @@ etc-install:	dir-install sysetc-remove sysetc-install
 	$(INSTALL) -m 600 $(SRCDIR)/gshadow $(ETCDIR)/gshadow
 	$(INSTALL) -m 644 $(SRCDIR)/hosts $(ETCDIR)/hosts
 
-sysetc-install:	dir-install
+sysetc-install:	dir-install pump.conf
 	$(INSTALL) -m 644 ./pump.conf $(SYSETCDIR)/pump.conf
 	$(INSTALL) -m 755 $(SRCDIR)/dhclient-exit-hooks \
 				$(SYSETCDIR)/dhclient-exit-hooks
diff --git a/tools/GNUmakefile.in b/tools/GNUmakefile.in
index 36342661f6..28519a567a 100644
--- a/tools/GNUmakefile.in
+++ b/tools/GNUmakefile.in
@@ -1,26 +1,26 @@
 #
 # EMULAB-COPYRIGHT
-# Copyright (c) 2000-2002 University of Utah and the Flux Group.
+# Copyright (c) 2000-2002, 2004 University of Utah and the Flux Group.
 # All rights reserved.
 #
 
 SRCDIR		= @srcdir@
 TESTBED_SRCDIR	= @top_srcdir@
 OBJDIR		= ..
-SUBDIR		= utils
+SUBDIR		= tools
 
 include $(OBJDIR)/Makeconf
 
 SUBDIRS = pcapper teachswitch
 
-all:            all-subdirs
+all:	all-subdirs
 
 include $(TESTBED_SRCDIR)/GNUmakerules
 
+clean:	clean-subdirs
+
 # How to recursively descend into subdirectories to make general
 # targets such as `all'.
 %.MAKE:
 	@$(MAKE) -C $(dir $@) $(basename $(notdir $@))
 %-subdirs: $(addsuffix /%.MAKE,$(SUBDIRS)) ;
-
-clean:
diff --git a/utils/GNUmakefile.in b/utils/GNUmakefile.in
index 38f9efee8c..c696038905 100644
--- a/utils/GNUmakefile.in
+++ b/utils/GNUmakefile.in
@@ -1,6 +1,6 @@
 #
 # EMULAB-COPYRIGHT
-# Copyright (c) 2000-2003 University of Utah and the Flux Group.
+# Copyright (c) 2000-2004 University of Utah and the Flux Group.
 # All rights reserved.
 #
 
@@ -56,6 +56,9 @@ control-install:
 # Automate this part at some point.
 # 
 subdir-install:
-	@$(MAKE) -C nsgen install	
+	@$(MAKE) -C nsgen install
 
-clean:
+clean:	subdir-clean
+
+subdir-clean:
+	@$(MAKE) -C nsgen clean
-- 
GitLab