UPDATING revision 1.1
1$NetBSD: UPDATING,v 1.1 2000/08/17 20:17:43 abs 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
1120000623:
12	MKCRYPTO and friends added to share/mk/bsd.own.mk.
13	'cd share/mk ; make install' needed before make build.
14
15
16Hints for a more successful build:
17^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
18    Use object directories:
19	This helps to keep stale object
20	   files from polluting the build if a Makefile "forgets"
21	   about one.  It also makes it easier to clean up after
22	   a build.  It's also necessary if you want to use the
23	   same source tree for multiple machines.
24	   To use object directories:
25	    a) cd /usr/src ; make cleandir
26	    b) Add "OBJMACHINE=obj.<arch>" to /etc/mk.conf
27	    c) cd /usr/src ; make obj
28	    d) cd /usr/src ; make build
29    Build to a DESTDIR:
30	This helps to keep old
31	   installed files (especially libraries) from interfering
32	   with the new build.
33	   To build to a DESTDIR, set the DESTDIR environment
34	   variable before running make build.
35	   Problems: you might need to update critical utilities
36		without using DESTDIR since nothing is executed
37		from what is installed in DESTDIR.
38		(See critical utils, below)
39    Build often:
40	This keeps critical utilities current enough to not choke
41	on any other part of the source tree that depends on up to
42	date functionality.
43 
44What to do if things don't work:
45^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
46When things don't work there is usually a few things that commonly
47should be done.
48    1)	make includes
49	This should be done automatically by make build.
50    2)  cd share/mk && make install
51	Again, automatically done by make build.
52
53Failsafe rebuild of a small part of the tree:
54^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
55To make sure you rebuild something correctly you want to do
56something like the following:
57    1)  Make sure the includes and .mk files are up to date.
58    2)  Make sure any program used to build the particular
59	utility is up to date.  (yacc, lex, etc...)
60    3)  cd ...path/to/util...
61	make cleandir
62	rm ...all obj directories...
63	make cleandir			# yes, again
64	make obj
65	make depend && make
66
67Failsafe rebuild of the entire tree:
68^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
69If you really want to make sure the source tree is clean and
70ready for a build try the following:
71
72---cut here---
73#!/bin/sh
74. /etc/mk.conf
75
76if [ -z $BSDSRCDIR ] ; then
77    BSDSRCDIR=/usr/src
78fi
79if [ \! -d $BSDSRCDIR ] ; then
80    echo Unable to find sources
81    exit 1
82fi
83find $BSDSRCDIR -name \*.o -o -name obj.\* -o -name obj -exec rm \{\} \;
84
85if [ -z $BSDOBJDIR ] ; then
86    BSDOBJDIR=/usr/obj
87fi
88if [ -d $BSDOBJDIR ] ; then
89    rm -rf $BSDOBJDIR
90fi
91
92cd $BSDSRCDIR && make cleandir
93
94---cut here---
95
96Critical utilities:
97^^^^^^^^^^^^^^^^^^^
98	gnu/usr.bin/egcs
99	usr.bin/make
100	usr.bin/yacc
101	usr.bin/lex
102	crypto-*/usr.bin/compile_et
103	crypto-*/usr.bin/make_cmds
104
105Other problems and possibly solutions:
106^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
107Symptom:Unreasonable compiler errors.
108Fix:	Rebuild gnu/usr.bin/egcs
109
110Symptom:Complaints involving a Makefile.
111Fix:	Make sure .mk files are up to date.
112	cd share/mk && make install
113Fix:	Rebuild usr.bin/make
114
115Symptom:
116Fix:	Rebuild usr.bin/yacc
117
118Symptom:
119Fix:	Rebuild usr.bin/lex
120
121Symptom:
122Fix:	rm /usr/lib/libbfd.a
123