UPDATING revision 1.14
11.14Shubertf$NetBSD: UPDATING,v 1.14 2001/02/03 08:24:07 hubertf 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.10Schristos
111.10Schristos20010114:
121.10Schristos	introduce .if commands(target) in make(1). You need to
131.10Schristos	bring everything up-to-date first, then without installing
141.10Schristos	anything make and install in /usr/bin/make, then proceed
151.10Schristos	with make build.
161.9Ssommerfe
171.9Ssommerfe20010101:
181.9Ssommerfe	bsd.subdir.mk committed 20001230 had a bug which caused
191.9Ssommerfe	afterinstall targets to run too soon; update again.
201.8Ssommerfe
211.8Ssommerfe20001230:
221.8Ssommerfe	New share/mk files needed to support .WAIT in SUBDIR variables.
231.8Ssommerfe	If you get make errors, 
241.8Ssommerfe		(cd share/mk; make install)
251.8Ssommerfe	Also, PRINTOBJDIR has changed and is now used more heavily.
261.6Sad
271.6Sad20001019:
281.7Sad	The `ca' device driver has been replaced by `ld'; although the
291.6Sad	major and minor numbers haven't changed, you should update your /dev
301.6Sad	directory.
311.1Sabs
321.4Sitojun20000929:
331.4Sitojun	The following make directives are obsoleted.
341.4Sitojun	MKCRYPTO_RSA NOCRYPTO_RSA NOCRYPTO_RC5 NOCRYPTO_IDEA 
351.4Sitojun	By default, RSA is built into libcrypto.  IDEA and RC5 will not be
361.4Sitojun	bulit into libcrypto.  By using MKCRYPTO_{RC5,IDEA}, you can build
371.4Sitojun	additional library libcrypto_{idea,rc5}.
381.4Sitojun
391.1Sabs20000623:
401.1Sabs	MKCRYPTO and friends added to share/mk/bsd.own.mk.
411.1Sabs	'cd share/mk ; make install' needed before make build.
421.1Sabs
431.1Sabs
441.1SabsHints for a more successful build:
451.1Sabs^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
461.2Smrg    Build a new kernel first:
471.2Smrg	This makes sure that any new system calls or features
481.2Smrg	   expected by the new userland will be present.  This
491.2Smrg	   helps to avoid critical errors when upgrading.
501.1Sabs    Use object directories:
511.1Sabs	This helps to keep stale object
521.1Sabs	   files from polluting the build if a Makefile "forgets"
531.1Sabs	   about one.  It also makes it easier to clean up after
541.1Sabs	   a build.  It's also necessary if you want to use the
551.1Sabs	   same source tree for multiple machines.
561.1Sabs	   To use object directories:
571.1Sabs	    a) cd /usr/src ; make cleandir
581.2Smrg	    b) Add "OBJMACHINE=yes" to /etc/mk.conf
591.2Smrg	    c) Add "MKOBJDIRS=yes" to /etc/mk.conf
601.1Sabs	    d) cd /usr/src ; make build
611.2Smrg	   Note that running "make obj" in a directory will create
621.2Smrg	   in obj.$MACHINE directory.
631.1Sabs    Build to a DESTDIR:
641.1Sabs	This helps to keep old
651.1Sabs	   installed files (especially libraries) from interfering
661.1Sabs	   with the new build.
671.1Sabs	   To build to a DESTDIR, set the DESTDIR environment
681.2Smrg	   variable before running make build.  It should be set to
691.2Smrg	   the pathname of an initially empty directory.
701.1Sabs	   Problems: you might need to update critical utilities
711.1Sabs		without using DESTDIR since nothing is executed
721.1Sabs		from what is installed in DESTDIR.
731.1Sabs		(See critical utils, below)
741.1Sabs    Build often:
751.1Sabs	This keeps critical utilities current enough to not choke
761.1Sabs	on any other part of the source tree that depends on up to
771.1Sabs	date functionality.
781.1Sabs 
791.1SabsWhat to do if things don't work:
801.1Sabs^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
811.1SabsWhen things don't work there is usually a few things that commonly
821.1Sabsshould be done.
831.1Sabs    1)	make includes
841.1Sabs	This should be done automatically by make build.
851.1Sabs    2)  cd share/mk && make install
861.1Sabs	Again, automatically done by make build.
871.1Sabs
881.1SabsFailsafe rebuild of a small part of the tree:
891.1Sabs^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
901.1SabsTo make sure you rebuild something correctly you want to do
911.1Sabssomething like the following:
921.1Sabs    1)  Make sure the includes and .mk files are up to date.
931.1Sabs    2)  Make sure any program used to build the particular
941.1Sabs	utility is up to date.  (yacc, lex, etc...)
951.1Sabs    3)  cd ...path/to/util...
961.1Sabs	make cleandir
971.1Sabs	rm ...all obj directories...
981.1Sabs	make cleandir			# yes, again
991.1Sabs	make obj
1001.1Sabs	make depend && make
1011.1Sabs
1021.1SabsFailsafe rebuild of the entire tree:
1031.1Sabs^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1041.1SabsIf you really want to make sure the source tree is clean and
1051.2Smrgready for a build try the following.  Note that sourcing /etc/mk.conf
1061.2Smrg(a make(1) Makefile) in this manner is not right, and will not work
1071.2Smrgfor anyone who uses any make(1) features in /etc/mk.conf.
1081.1Sabs
1091.1Sabs---cut here---
1101.1Sabs#!/bin/sh
1111.1Sabs. /etc/mk.conf
1121.1Sabs
1131.1Sabsif [ -z $BSDSRCDIR ] ; then
1141.1Sabs    BSDSRCDIR=/usr/src
1151.1Sabsfi
1161.1Sabsif [ \! -d $BSDSRCDIR ] ; then
1171.1Sabs    echo Unable to find sources
1181.1Sabs    exit 1
1191.1Sabsfi
1201.1Sabsfind $BSDSRCDIR -name \*.o -o -name obj.\* -o -name obj -exec rm \{\} \;
1211.1Sabs
1221.1Sabsif [ -z $BSDOBJDIR ] ; then
1231.1Sabs    BSDOBJDIR=/usr/obj
1241.1Sabsfi
1251.1Sabsif [ -d $BSDOBJDIR ] ; then
1261.1Sabs    rm -rf $BSDOBJDIR
1271.1Sabsfi
1281.1Sabs
1291.1Sabscd $BSDSRCDIR && make cleandir
1301.1Sabs
1311.1Sabs---cut here---
1321.1Sabs
1331.1SabsCritical utilities:
1341.1Sabs^^^^^^^^^^^^^^^^^^^
1351.1Sabs	gnu/usr.bin/egcs
1361.3Sitojun	usr.bin/compile_et
1371.1Sabs	usr.bin/make
1381.1Sabs	usr.bin/yacc
1391.1Sabs	usr.bin/lex
1401.11Slukem	usr.bin/xlint
1411.2Smrg	usr.sbin/config
1421.1Sabs
1431.1SabsOther problems and possibly solutions:
1441.1Sabs^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1451.1SabsSymptom:Unreasonable compiler errors.
1461.1SabsFix:	Rebuild gnu/usr.bin/egcs
1471.1Sabs
1481.1SabsSymptom:Complaints involving a Makefile.
1491.14ShubertfFix:	Rebuild usr.bin/make
1501.1SabsFix:	Make sure .mk files are up to date.
1511.1Sabs	cd share/mk && make install
1521.2Smrg
1531.2SmrgSymptom:Kernel `config' fails to configure any kernel, including GENERIC.
1541.2SmrgFix:	Rebuild usr.sbin/config
1551.1Sabs
1561.1SabsSymptom:
1571.1SabsFix:	Rebuild usr.bin/yacc
1581.1Sabs
1591.1SabsSymptom:
1601.1SabsFix:	Rebuild usr.bin/lex
1611.1Sabs
1621.1SabsSymptom:
1631.1SabsFix:	rm /usr/lib/libbfd.a
1641.4Sitojun
1651.4SitojunSymptom:Obsolete intermediate files are used during compilation
1661.4SitojunFix:	Try the following sequence of commands in the directory in question.
1671.4Sitojun	make cleandir; rm `make print-objdir`; make cleandir; make obj
1681.4Sitojun	(If you built the tree without "make obj" in the past, obsolete files
1691.4Sitojun	may remain.  The command tries to clean everything up)
1701.5Swiz
1711.5SwizSymptom:.../sysinst/run.c:xx: warning: initialization from incompatible pointer type
1721.5SwizFix:	Rebuild and install usr.bin/menuc
1731.12Sitojun
1741.12SitojunSymptom:mklocale not found during build in share/locale/ctype
1751.12SitojunFix:	Build and install usr.bin/mklocale
1761.13Sdogcow
1771.13SdogcowSymptom:undefined reference to `__assert13'
1781.13SdogcowFix:    Rebuild and install lib/libc
1791.13Sdogcow
1801.13Sdogcow
181