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