UPDATING revision 1.9
1$NetBSD: UPDATING,v 1.9 2001/01/01 15:29:16 sommerfeld Exp $
2
3This file is intended to be a brief introduction to the build
4process and a reference on what to do if something doesn't work.
5
6For a more detailed description see Makefile.
7
8Recent changes:
9^^^^^^^^^^^^^^^
10
1120010101:
12	bsd.subdir.mk committed 20001230 had a bug which caused
13	afterinstall targets to run too soon; update again.
14
1520001230:
16	New share/mk files needed to support .WAIT in SUBDIR variables.
17	If you get make errors, 
18		(cd share/mk; make install)
19	Also, PRINTOBJDIR has changed and is now used more heavily.
20
2120001019:
22	The `ca' device driver has been replaced by `ld'; although the
23	major and minor numbers haven't changed, you should update your /dev
24	directory.
25
2620000929:
27	The following make directives are obsoleted.
28	MKCRYPTO_RSA NOCRYPTO_RSA NOCRYPTO_RC5 NOCRYPTO_IDEA 
29	By default, RSA is built into libcrypto.  IDEA and RC5 will not be
30	bulit into libcrypto.  By using MKCRYPTO_{RC5,IDEA}, you can build
31	additional library libcrypto_{idea,rc5}.
32
3320000623:
34	MKCRYPTO and friends added to share/mk/bsd.own.mk.
35	'cd share/mk ; make install' needed before make build.
36
37
38Hints for a more successful build:
39^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
40    Build a new kernel first:
41	This makes sure that any new system calls or features
42	   expected by the new userland will be present.  This
43	   helps to avoid critical errors when upgrading.
44    Use object directories:
45	This helps to keep stale object
46	   files from polluting the build if a Makefile "forgets"
47	   about one.  It also makes it easier to clean up after
48	   a build.  It's also necessary if you want to use the
49	   same source tree for multiple machines.
50	   To use object directories:
51	    a) cd /usr/src ; make cleandir
52	    b) Add "OBJMACHINE=yes" to /etc/mk.conf
53	    c) Add "MKOBJDIRS=yes" to /etc/mk.conf
54	    d) cd /usr/src ; make build
55	   Note that running "make obj" in a directory will create
56	   in obj.$MACHINE directory.
57    Build to a DESTDIR:
58	This helps to keep old
59	   installed files (especially libraries) from interfering
60	   with the new build.
61	   To build to a DESTDIR, set the DESTDIR environment
62	   variable before running make build.  It should be set to
63	   the pathname of an initially empty directory.
64	   Problems: you might need to update critical utilities
65		without using DESTDIR since nothing is executed
66		from what is installed in DESTDIR.
67		(See critical utils, below)
68    Build often:
69	This keeps critical utilities current enough to not choke
70	on any other part of the source tree that depends on up to
71	date functionality.
72 
73What to do if things don't work:
74^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
75When things don't work there is usually a few things that commonly
76should be done.
77    1)	make includes
78	This should be done automatically by make build.
79    2)  cd share/mk && make install
80	Again, automatically done by make build.
81
82Failsafe rebuild of a small part of the tree:
83^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
84To make sure you rebuild something correctly you want to do
85something like the following:
86    1)  Make sure the includes and .mk files are up to date.
87    2)  Make sure any program used to build the particular
88	utility is up to date.  (yacc, lex, etc...)
89    3)  cd ...path/to/util...
90	make cleandir
91	rm ...all obj directories...
92	make cleandir			# yes, again
93	make obj
94	make depend && make
95
96Failsafe rebuild of the entire tree:
97^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
98If you really want to make sure the source tree is clean and
99ready for a build try the following.  Note that sourcing /etc/mk.conf
100(a make(1) Makefile) in this manner is not right, and will not work
101for anyone who uses any make(1) features in /etc/mk.conf.
102
103---cut here---
104#!/bin/sh
105. /etc/mk.conf
106
107if [ -z $BSDSRCDIR ] ; then
108    BSDSRCDIR=/usr/src
109fi
110if [ \! -d $BSDSRCDIR ] ; then
111    echo Unable to find sources
112    exit 1
113fi
114find $BSDSRCDIR -name \*.o -o -name obj.\* -o -name obj -exec rm \{\} \;
115
116if [ -z $BSDOBJDIR ] ; then
117    BSDOBJDIR=/usr/obj
118fi
119if [ -d $BSDOBJDIR ] ; then
120    rm -rf $BSDOBJDIR
121fi
122
123cd $BSDSRCDIR && make cleandir
124
125---cut here---
126
127Critical utilities:
128^^^^^^^^^^^^^^^^^^^
129	gnu/usr.bin/egcs
130	usr.bin/compile_et
131	usr.bin/make
132	usr.bin/yacc
133	usr.bin/lex
134	usr.sbin/config
135
136Other problems and possibly solutions:
137^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
138Symptom:Unreasonable compiler errors.
139Fix:	Rebuild gnu/usr.bin/egcs
140
141Symptom:Complaints involving a Makefile.
142Fix:	Make sure .mk files are up to date.
143	cd share/mk && make install
144Fix:	Rebuild usr.bin/make
145
146Symptom:Kernel `config' fails to configure any kernel, including GENERIC.
147Fix:	Rebuild usr.sbin/config
148
149Symptom:
150Fix:	Rebuild usr.bin/yacc
151
152Symptom:
153Fix:	Rebuild usr.bin/lex
154
155Symptom:
156Fix:	rm /usr/lib/libbfd.a
157
158Symptom:Obsolete intermediate files are used during compilation
159Fix:	Try the following sequence of commands in the directory in question.
160	make cleandir; rm `make print-objdir`; make cleandir; make obj
161	(If you built the tree without "make obj" in the past, obsolete files
162	may remain.  The command tries to clean everything up)
163
164Symptom:.../sysinst/run.c:xx: warning: initialization from incompatible pointer type
165Fix:	Rebuild and install usr.bin/menuc
166