UPDATING revision 1.8
11.8Ssommerfe$NetBSD: UPDATING,v 1.8 2001/01/01 14:13:51 sommerfeld 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.8Ssommerfe
111.8Ssommerfe20001230:
121.8Ssommerfe	New share/mk files needed to support .WAIT in SUBDIR variables.
131.8Ssommerfe	If you get make errors, 
141.8Ssommerfe		(cd share/mk; make install)
151.8Ssommerfe	Also, PRINTOBJDIR has changed and is now used more heavily.
161.6Sad
171.6Sad20001019:
181.7Sad	The `ca' device driver has been replaced by `ld'; although the
191.6Sad	major and minor numbers haven't changed, you should update your /dev
201.6Sad	directory.
211.1Sabs
221.4Sitojun20000929:
231.4Sitojun	The following make directives are obsoleted.
241.4Sitojun	MKCRYPTO_RSA NOCRYPTO_RSA NOCRYPTO_RC5 NOCRYPTO_IDEA 
251.4Sitojun	By default, RSA is built into libcrypto.  IDEA and RC5 will not be
261.4Sitojun	bulit into libcrypto.  By using MKCRYPTO_{RC5,IDEA}, you can build
271.4Sitojun	additional library libcrypto_{idea,rc5}.
281.4Sitojun
291.1Sabs20000623:
301.1Sabs	MKCRYPTO and friends added to share/mk/bsd.own.mk.
311.1Sabs	'cd share/mk ; make install' needed before make build.
321.1Sabs
331.1Sabs
341.1SabsHints for a more successful build:
351.1Sabs^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
361.2Smrg    Build a new kernel first:
371.2Smrg	This makes sure that any new system calls or features
381.2Smrg	   expected by the new userland will be present.  This
391.2Smrg	   helps to avoid critical errors when upgrading.
401.1Sabs    Use object directories:
411.1Sabs	This helps to keep stale object
421.1Sabs	   files from polluting the build if a Makefile "forgets"
431.1Sabs	   about one.  It also makes it easier to clean up after
441.1Sabs	   a build.  It's also necessary if you want to use the
451.1Sabs	   same source tree for multiple machines.
461.1Sabs	   To use object directories:
471.1Sabs	    a) cd /usr/src ; make cleandir
481.2Smrg	    b) Add "OBJMACHINE=yes" to /etc/mk.conf
491.2Smrg	    c) Add "MKOBJDIRS=yes" to /etc/mk.conf
501.1Sabs	    d) cd /usr/src ; make build
511.2Smrg	   Note that running "make obj" in a directory will create
521.2Smrg	   in obj.$MACHINE directory.
531.1Sabs    Build to a DESTDIR:
541.1Sabs	This helps to keep old
551.1Sabs	   installed files (especially libraries) from interfering
561.1Sabs	   with the new build.
571.1Sabs	   To build to a DESTDIR, set the DESTDIR environment
581.2Smrg	   variable before running make build.  It should be set to
591.2Smrg	   the pathname of an initially empty directory.
601.1Sabs	   Problems: you might need to update critical utilities
611.1Sabs		without using DESTDIR since nothing is executed
621.1Sabs		from what is installed in DESTDIR.
631.1Sabs		(See critical utils, below)
641.1Sabs    Build often:
651.1Sabs	This keeps critical utilities current enough to not choke
661.1Sabs	on any other part of the source tree that depends on up to
671.1Sabs	date functionality.
681.1Sabs 
691.1SabsWhat to do if things don't work:
701.1Sabs^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
711.1SabsWhen things don't work there is usually a few things that commonly
721.1Sabsshould be done.
731.1Sabs    1)	make includes
741.1Sabs	This should be done automatically by make build.
751.1Sabs    2)  cd share/mk && make install
761.1Sabs	Again, automatically done by make build.
771.1Sabs
781.1SabsFailsafe rebuild of a small part of the tree:
791.1Sabs^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
801.1SabsTo make sure you rebuild something correctly you want to do
811.1Sabssomething like the following:
821.1Sabs    1)  Make sure the includes and .mk files are up to date.
831.1Sabs    2)  Make sure any program used to build the particular
841.1Sabs	utility is up to date.  (yacc, lex, etc...)
851.1Sabs    3)  cd ...path/to/util...
861.1Sabs	make cleandir
871.1Sabs	rm ...all obj directories...
881.1Sabs	make cleandir			# yes, again
891.1Sabs	make obj
901.1Sabs	make depend && make
911.1Sabs
921.1SabsFailsafe rebuild of the entire tree:
931.1Sabs^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
941.1SabsIf you really want to make sure the source tree is clean and
951.2Smrgready for a build try the following.  Note that sourcing /etc/mk.conf
961.2Smrg(a make(1) Makefile) in this manner is not right, and will not work
971.2Smrgfor anyone who uses any make(1) features in /etc/mk.conf.
981.1Sabs
991.1Sabs---cut here---
1001.1Sabs#!/bin/sh
1011.1Sabs. /etc/mk.conf
1021.1Sabs
1031.1Sabsif [ -z $BSDSRCDIR ] ; then
1041.1Sabs    BSDSRCDIR=/usr/src
1051.1Sabsfi
1061.1Sabsif [ \! -d $BSDSRCDIR ] ; then
1071.1Sabs    echo Unable to find sources
1081.1Sabs    exit 1
1091.1Sabsfi
1101.1Sabsfind $BSDSRCDIR -name \*.o -o -name obj.\* -o -name obj -exec rm \{\} \;
1111.1Sabs
1121.1Sabsif [ -z $BSDOBJDIR ] ; then
1131.1Sabs    BSDOBJDIR=/usr/obj
1141.1Sabsfi
1151.1Sabsif [ -d $BSDOBJDIR ] ; then
1161.1Sabs    rm -rf $BSDOBJDIR
1171.1Sabsfi
1181.1Sabs
1191.1Sabscd $BSDSRCDIR && make cleandir
1201.1Sabs
1211.1Sabs---cut here---
1221.1Sabs
1231.1SabsCritical utilities:
1241.1Sabs^^^^^^^^^^^^^^^^^^^
1251.1Sabs	gnu/usr.bin/egcs
1261.3Sitojun	usr.bin/compile_et
1271.1Sabs	usr.bin/make
1281.1Sabs	usr.bin/yacc
1291.1Sabs	usr.bin/lex
1301.2Smrg	usr.sbin/config
1311.1Sabs
1321.1SabsOther problems and possibly solutions:
1331.1Sabs^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1341.1SabsSymptom:Unreasonable compiler errors.
1351.1SabsFix:	Rebuild gnu/usr.bin/egcs
1361.1Sabs
1371.1SabsSymptom:Complaints involving a Makefile.
1381.1SabsFix:	Make sure .mk files are up to date.
1391.1Sabs	cd share/mk && make install
1401.1SabsFix:	Rebuild usr.bin/make
1411.2Smrg
1421.2SmrgSymptom:Kernel `config' fails to configure any kernel, including GENERIC.
1431.2SmrgFix:	Rebuild usr.sbin/config
1441.1Sabs
1451.1SabsSymptom:
1461.1SabsFix:	Rebuild usr.bin/yacc
1471.1Sabs
1481.1SabsSymptom:
1491.1SabsFix:	Rebuild usr.bin/lex
1501.1Sabs
1511.1SabsSymptom:
1521.1SabsFix:	rm /usr/lib/libbfd.a
1531.4Sitojun
1541.4SitojunSymptom:Obsolete intermediate files are used during compilation
1551.4SitojunFix:	Try the following sequence of commands in the directory in question.
1561.4Sitojun	make cleandir; rm `make print-objdir`; make cleandir; make obj
1571.4Sitojun	(If you built the tree without "make obj" in the past, obsolete files
1581.4Sitojun	may remain.  The command tries to clean everything up)
1591.5Swiz
1601.5SwizSymptom:.../sysinst/run.c:xx: warning: initialization from incompatible pointer type
1611.5SwizFix:	Rebuild and install usr.bin/menuc
162