UPDATING revision 1.2
11.2Smrg$NetBSD: UPDATING,v 1.2 2000/08/20 15:43:43 mrg Exp $
21.1Sabs
31.1SabsThis file is intended to be a brief introduction to the build
41.1Sabsprocess and a reference on what to do if something doesn't work.
51.1Sabs
61.1SabsFor a more detailed description see Makefile.
71.1Sabs
81.1SabsRecent changes:
91.1Sabs^^^^^^^^^^^^^^^
101.1Sabs
111.1Sabs20000623:
121.1Sabs	MKCRYPTO and friends added to share/mk/bsd.own.mk.
131.1Sabs	'cd share/mk ; make install' needed before make build.
141.1Sabs
151.1Sabs
161.1SabsHints for a more successful build:
171.1Sabs^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
181.2Smrg    Build a new kernel first:
191.2Smrg	This makes sure that any new system calls or features
201.2Smrg	   expected by the new userland will be present.  This
211.2Smrg	   helps to avoid critical errors when upgrading.
221.1Sabs    Use object directories:
231.1Sabs	This helps to keep stale object
241.1Sabs	   files from polluting the build if a Makefile "forgets"
251.1Sabs	   about one.  It also makes it easier to clean up after
261.1Sabs	   a build.  It's also necessary if you want to use the
271.1Sabs	   same source tree for multiple machines.
281.1Sabs	   To use object directories:
291.1Sabs	    a) cd /usr/src ; make cleandir
301.2Smrg	    b) Add "OBJMACHINE=yes" to /etc/mk.conf
311.2Smrg	    c) Add "MKOBJDIRS=yes" to /etc/mk.conf
321.1Sabs	    d) cd /usr/src ; make build
331.2Smrg	   Note that running "make obj" in a directory will create
341.2Smrg	   in obj.$MACHINE directory.
351.1Sabs    Build to a DESTDIR:
361.1Sabs	This helps to keep old
371.1Sabs	   installed files (especially libraries) from interfering
381.1Sabs	   with the new build.
391.1Sabs	   To build to a DESTDIR, set the DESTDIR environment
401.2Smrg	   variable before running make build.  It should be set to
411.2Smrg	   the pathname of an initially empty directory.
421.1Sabs	   Problems: you might need to update critical utilities
431.1Sabs		without using DESTDIR since nothing is executed
441.1Sabs		from what is installed in DESTDIR.
451.1Sabs		(See critical utils, below)
461.1Sabs    Build often:
471.1Sabs	This keeps critical utilities current enough to not choke
481.1Sabs	on any other part of the source tree that depends on up to
491.1Sabs	date functionality.
501.1Sabs 
511.1SabsWhat to do if things don't work:
521.1Sabs^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
531.1SabsWhen things don't work there is usually a few things that commonly
541.1Sabsshould be done.
551.1Sabs    1)	make includes
561.1Sabs	This should be done automatically by make build.
571.1Sabs    2)  cd share/mk && make install
581.1Sabs	Again, automatically done by make build.
591.1Sabs
601.1SabsFailsafe rebuild of a small part of the tree:
611.1Sabs^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
621.1SabsTo make sure you rebuild something correctly you want to do
631.1Sabssomething like the following:
641.1Sabs    1)  Make sure the includes and .mk files are up to date.
651.1Sabs    2)  Make sure any program used to build the particular
661.1Sabs	utility is up to date.  (yacc, lex, etc...)
671.1Sabs    3)  cd ...path/to/util...
681.1Sabs	make cleandir
691.1Sabs	rm ...all obj directories...
701.1Sabs	make cleandir			# yes, again
711.1Sabs	make obj
721.1Sabs	make depend && make
731.1Sabs
741.1SabsFailsafe rebuild of the entire tree:
751.1Sabs^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
761.1SabsIf you really want to make sure the source tree is clean and
771.2Smrgready for a build try the following.  Note that sourcing /etc/mk.conf
781.2Smrg(a make(1) Makefile) in this manner is not right, and will not work
791.2Smrgfor anyone who uses any make(1) features in /etc/mk.conf.
801.1Sabs
811.1Sabs---cut here---
821.1Sabs#!/bin/sh
831.1Sabs. /etc/mk.conf
841.1Sabs
851.1Sabsif [ -z $BSDSRCDIR ] ; then
861.1Sabs    BSDSRCDIR=/usr/src
871.1Sabsfi
881.1Sabsif [ \! -d $BSDSRCDIR ] ; then
891.1Sabs    echo Unable to find sources
901.1Sabs    exit 1
911.1Sabsfi
921.1Sabsfind $BSDSRCDIR -name \*.o -o -name obj.\* -o -name obj -exec rm \{\} \;
931.1Sabs
941.1Sabsif [ -z $BSDOBJDIR ] ; then
951.1Sabs    BSDOBJDIR=/usr/obj
961.1Sabsfi
971.1Sabsif [ -d $BSDOBJDIR ] ; then
981.1Sabs    rm -rf $BSDOBJDIR
991.1Sabsfi
1001.1Sabs
1011.1Sabscd $BSDSRCDIR && make cleandir
1021.1Sabs
1031.1Sabs---cut here---
1041.1Sabs
1051.1SabsCritical utilities:
1061.1Sabs^^^^^^^^^^^^^^^^^^^
1071.1Sabs	gnu/usr.bin/egcs
1081.1Sabs	usr.bin/make
1091.1Sabs	usr.bin/yacc
1101.1Sabs	usr.bin/lex
1111.2Smrg	usr.sbin/config
1121.1Sabs	crypto-*/usr.bin/compile_et
1131.1Sabs	crypto-*/usr.bin/make_cmds
1141.1Sabs
1151.1SabsOther problems and possibly solutions:
1161.1Sabs^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1171.1SabsSymptom:Unreasonable compiler errors.
1181.1SabsFix:	Rebuild gnu/usr.bin/egcs
1191.1Sabs
1201.1SabsSymptom:Complaints involving a Makefile.
1211.1SabsFix:	Make sure .mk files are up to date.
1221.1Sabs	cd share/mk && make install
1231.1SabsFix:	Rebuild usr.bin/make
1241.2Smrg
1251.2SmrgSymptom:Kernel `config' fails to configure any kernel, including GENERIC.
1261.2SmrgFix:	Rebuild usr.sbin/config
1271.1Sabs
1281.1SabsSymptom:
1291.1SabsFix:	Rebuild usr.bin/yacc
1301.1Sabs
1311.1SabsSymptom:
1321.1SabsFix:	Rebuild usr.bin/lex
1331.1Sabs
1341.1SabsSymptom:
1351.1SabsFix:	rm /usr/lib/libbfd.a
136