Subject: makefile for building -current
To: None <current-users@NetBSD.ORG>
From: Simon J. Gerraty <sjg@zen.void.oz.au>
List: current-users
Date: 03/30/1995 22:22:19
Alistair's build recipe for building -current works very nicely.
I've used it to upgrade a sparc and now my i486 is having its turn.

Since I didn't want to hang around all night while zen did the work, I
wrote the following makefile to drive the process.

Yes, you could easily turn Alistairs instructions into a script, but
(as happened on the sparc) when things break half way through it would
be nice to easily (ie no brain cycles) pick up where it left of once
editing is done.  That's what make is for :-)

Hopefully others will find it useful... it creats a little .dir.done
file for each step...

--------------------8<--------------------
# makefile for building -current, based on build sequence from
# Alistair G. Crooks (agc@uts.amdahl.com)
# <sjg@zen.void.oz.au>

# use this one to see what would be done.
#MAKE=echo make
MAKE=make

all:	.all.done

# dirs to be done _before_ we can boot a new kernel
INIT_DIRS=usr.sbin/config.new gnu/usr.bin/gas

.init.done:
	@set -x; for t in $(INIT_DIRS); do \
		f=`basename $$t`; test -f .$$f.done || {\
		(cd $$t; $(MAKE) && $(MAKE) install) && \
		touch .$$f.done || exit 1; }; \
	done
	touch $@


.kernel.done:	.init.done
	@echo "You should"; echo "cd sys/arch/${MACHINE}/conf"
	@CONF=`uname -n | cut -d. -f1 | tr 'a-z' 'A-Z'`; \
	 echo cp GENERIC $$CONF; echo vi $$CONF; echo config.new $$CONF;\
	 echo cd ../compile/$$CONF; echo "make depend && make"
	@echo install the new kernel and reboot, then come here and; echo touch $@

# dirs to be done _after_ booting a new kernel
PREP_DIRS=share/mk gnu/usr.bin/gcc2 include gnu/usr.bin/ld lib

.prep.done:	.kernel.done
	@set -x; for t in $(PREP_DIRS); do \
		f=`basename $$t`; test -f .$$f.done || {\
		(cd $$t; $(MAKE) && $(MAKE) install) && \
		touch .$$f.done || exit 1; }; \
	done
	touch $@

# dirs that should be re-built now that we have new libs
CLEAN_DIRS=$(INIT_DIRS) gnu/usr.bin/gcc2 gnu/usr.bin/ld

.cleandirs.done:	.prep.done
	@set -x; for t in $(CLEAN_DIRS); do \
		(cd $$t; $(MAKE) cleandir); \
	done
	touch $@

# the rest...
ALL_DIRS=bin sbin usr.bin usr.sbin libexec gnu share games

.all.done:	.cleandirs.done
	@set -x; for t in $(ALL_DIRS); do \
		f=`basename $$t`; test -f .$$f.done || {\
		(cd $$t; $(MAKE) && $(MAKE) install) && \
		touch .$$f.done || exit 1; }; \
	done
	touch $@