From 72ea915fb468dfb1be80221402f182961904cfaf Mon Sep 17 00:00:00 2001
From: Mike Hibler <mike@flux.utah.edu>
Date: Wed, 10 Jan 2007 22:40:26 +0000
Subject: [PATCH] More MFS changes

---
 GNUmakefile.in                | 10 ++++++++++
 os/imagezip/GNUmakefile.in    | 11 +++++++++--
 os/zapdisk/GNUmakefile.in     | 11 +++++++++--
 sensors/slothd/GNUmakefile.in | 13 ++++++++++---
 tmcd/freebsd/GNUmakefile.in   |  4 +++-
 tmcd/freebsd6/GNUmakefile.in  |  6 ++++++
 6 files changed, 47 insertions(+), 8 deletions(-)

diff --git a/GNUmakefile.in b/GNUmakefile.in
index 33d4e44b02..9231bacfa6 100644
--- a/GNUmakefile.in
+++ b/GNUmakefile.in
@@ -205,11 +205,21 @@ mfs: mfsoscheck
 	@$(MAKE) -C sensors mfs
 	@$(MAKE) -C tmcd mfs
 
+mfs-nostatic: mfsoscheck
+	@NOSTATIC=1 $(MAKE) -C os mfs
+	@NOSTATIC=1 $(MAKE) -C sensors mfs
+	@NOSTATIC=1 $(MAKE) -C tmcd mfs
+
 mfs-install: destdircheck mfs client-mkdirs
 	@$(MAKE) -C os mfs-install
 	@$(MAKE) -C sensors mfs-install
 	@$(MAKE) -C tmcd mfs-install
 
+mfs-nostatic-install: destdircheck mfs-nostatic client-mkdirs
+	@$(MAKE) -C os mfs-install
+	@$(MAKE) -C sensors mfs-install
+	@$(MAKE) -C tmcd mfs-install
+
 frisbee-mfs: mfsoscheck
 	@$(MAKE) -C cdrom/groklilo client
 	@$(MAKE) -C os frisbee-mfs
diff --git a/os/imagezip/GNUmakefile.in b/os/imagezip/GNUmakefile.in
index eeb485c367..943c3f53c0 100644
--- a/os/imagezip/GNUmakefile.in
+++ b/os/imagezip/GNUmakefile.in
@@ -1,6 +1,6 @@
 #
 # EMULAB-COPYRIGHT
-# Copyright (c) 2000-2006 University of Utah and the Flux Group.
+# Copyright (c) 2000-2007 University of Utah and the Flux Group.
 # All rights reserved.
 #
 
@@ -60,6 +60,13 @@ WITH_HASH	= 1
 
 include $(OBJDIR)/Makeconf
 
+ifeq ($(NOSTATIC),)
+# for now we link everything static
+LDSTATIC	= -static
+else
+LDSTATIC	= 
+endif
+
 SUBDIRCFLAGS	= -Wall -O2 -g # -ansi -pedantic
 ifeq ($(SYSTEM),Linux)
 SUBDIRCFLAGS	+= -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -D_THREAD_SAFE -pthread
@@ -79,7 +86,7 @@ endif
 # Necessary sometimes.
 #PTHREADCFLAGS	+= -DCONDVARS_WORK
 
-CFLAGS		= $(SUBDIRCFLAGS) -I$(SRCDIR) -static
+CFLAGS		= $(SUBDIRCFLAGS) -I$(SRCDIR) $(LDSTATIC)
 LIBS 		= -lz
 ZIPCFLAGS	= $(CFLAGS) -Wall
 ZIPLIBS		= 
diff --git a/os/zapdisk/GNUmakefile.in b/os/zapdisk/GNUmakefile.in
index 503e3fe149..b83aba6535 100644
--- a/os/zapdisk/GNUmakefile.in
+++ b/os/zapdisk/GNUmakefile.in
@@ -1,6 +1,6 @@
 #
 # EMULAB-COPYRIGHT
-# Copyright (c) 2000-2005 University of Utah and the Flux Group.
+# Copyright (c) 2000-2005, 2007 University of Utah and the Flux Group.
 # All rights reserved.
 #
 
@@ -14,11 +14,18 @@ LBINDIR		= $(DESTDIR)/usr/local/bin
 
 include $(OBJDIR)/Makeconf
 
+ifeq ($(NOSTATIC),)
+# for now we link everything static
+LDSTATIC	= -static
+else
+LDSTATIC	= 
+endif
+
 all:
 
 include $(TESTBED_SRCDIR)/GNUmakerules
 
-CFLAGS = -O -g -static
+CFLAGS = -O -g $(LDSTATIC)
 
 zapdisk: zapdisk.o
 	$(CC) $(CFLAGS) zapdisk.o -o zapdisk
diff --git a/sensors/slothd/GNUmakefile.in b/sensors/slothd/GNUmakefile.in
index 1297deb9cb..85fa87bab8 100644
--- a/sensors/slothd/GNUmakefile.in
+++ b/sensors/slothd/GNUmakefile.in
@@ -1,6 +1,6 @@
 #
 # EMULAB-COPYRIGHT
-# Copyright (c) 2000-2005 University of Utah and the Flux Group.
+# Copyright (c) 2000-2005, 2007 University of Utah and the Flux Group.
 # All rights reserved.
 #
 
@@ -18,6 +18,13 @@ SYSTEM          := $(shell uname -s)
 
 include $(OBJDIR)/Makeconf
 
+ifeq ($(NOSTATIC),)
+# for now we link everything static
+LDSTATIC	= -static
+else
+LDSTATIC	= 
+endif
+
 CC?=gcc
 ## For debug compilation
 ##CFLAGS+= -g
@@ -47,7 +54,7 @@ all: $(SDPROGS) client
 include ${TESTBED_SRCDIR}/GNUmakerules
 
 slothd-debug: slothd.o slothd.h version.o
-	$(CC) $(CFLAGS) $(LDFLAGS) -static -o $@ slothd.o version.o $(LIBS)
+	$(CC) $(CFLAGS) $(LDFLAGS) $(LDSTATIC) -o $@ slothd.o version.o $(LIBS)
 
 # This is started up at user login on Windows to monitor desktop events for slothd.
 idlemon-debug: idlemon.o version.o
@@ -87,4 +94,4 @@ endif
 control-install:
 
 clean:
-	rm -f *.o $(SDPROGS) $(WINPROGS) *~ core *.core version.c
+	rm -f *.o $(SDPROGS) $(WINPROGS) slothd-debug *~ core *.core version.c
diff --git a/tmcd/freebsd/GNUmakefile.in b/tmcd/freebsd/GNUmakefile.in
index c57c2ae321..5d4a3bdf06 100644
--- a/tmcd/freebsd/GNUmakefile.in
+++ b/tmcd/freebsd/GNUmakefile.in
@@ -1,6 +1,6 @@
 #
 # EMULAB-COPYRIGHT
-# Copyright (c) 2000-2006 University of Utah and the Flux Group.
+# Copyright (c) 2000-2007 University of Utah and the Flux Group.
 # All rights reserved.
 #
 
@@ -58,6 +58,7 @@ mfs-install:	destdircheck common-install etc-install \
 			script-install bin-install
 	$(INSTALL) -m 755 $(SRCDIR)/camwce $(BINDIR)/camwce
 	cp $(SRCDIR)/mfs-rc.conf $(SYSETCDIR)/rc.conf
+	rm -f $(BINDIR)/rc/rc.mkelab
 	@if [ ! -f $(ISMFS) ]; then \
 	    echo >$(ISMFS) "This file indicates its the MFS. DO NOT DELETE!"; \
 	fi
@@ -94,6 +95,7 @@ frisbee-mfs-install:	destdircheck
 	$(INSTALL) -m 755 $(SRCDIR)/camwce $(SYSETCDIR)/testbed
 	$(INSTALL) -m 755 -s ../tmcc-nossl $(SYSETCDIR)/testbed/tmcc
 	$(INSTALL) -m 755 -s ../findif $(SYSETCDIR)/testbed
+	rm -f $(BINDIR)/rc/rc.mkelab
 
 cdboot-install:	destdircheck common-install etc-install \
 			script-install bin-install
diff --git a/tmcd/freebsd6/GNUmakefile.in b/tmcd/freebsd6/GNUmakefile.in
index f71d6476e1..e6ee0582f5 100644
--- a/tmcd/freebsd6/GNUmakefile.in
+++ b/tmcd/freebsd6/GNUmakefile.in
@@ -100,3 +100,9 @@ frisbee-mfs-install:
 	rm -f $(SYSETCDIR)/testbed/dhclient
 	rm -f $(DESTDIR)/usr/local/etc/dhclient*
 	ln -s /etc/dhclient* $(DESTDIR)/usr/local/etc/
+
+mfs-install:
+	(cd ../freebsd5; $(MAKE) all mfs-install)
+	rm -f $(SYSETCDIR)/testbed/dhclient
+	rm -f $(DESTDIR)/usr/local/etc/dhclient*
+	ln -s /etc/dhclient* $(DESTDIR)/usr/local/etc/
-- 
GitLab