Home | History | Annotate | Line # | Download | only in src
UPDATING revision 1.3
      1 $NetBSD: UPDATING,v 1.3 2000/08/20 19:51:24 itojun Exp $
      2 
      3 This file is intended to be a brief introduction to the build
      4 process and a reference on what to do if something doesn't work.
      5 
      6 For a more detailed description see Makefile.
      7 
      8 Recent changes:
      9 ^^^^^^^^^^^^^^^
     10 
     11 20000623:
     12 	MKCRYPTO and friends added to share/mk/bsd.own.mk.
     13 	'cd share/mk ; make install' needed before make build.
     14 
     15 
     16 Hints for a more successful build:
     17 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     18     Build a new kernel first:
     19 	This makes sure that any new system calls or features
     20 	   expected by the new userland will be present.  This
     21 	   helps to avoid critical errors when upgrading.
     22     Use object directories:
     23 	This helps to keep stale object
     24 	   files from polluting the build if a Makefile "forgets"
     25 	   about one.  It also makes it easier to clean up after
     26 	   a build.  It's also necessary if you want to use the
     27 	   same source tree for multiple machines.
     28 	   To use object directories:
     29 	    a) cd /usr/src ; make cleandir
     30 	    b) Add "OBJMACHINE=yes" to /etc/mk.conf
     31 	    c) Add "MKOBJDIRS=yes" to /etc/mk.conf
     32 	    d) cd /usr/src ; make build
     33 	   Note that running "make obj" in a directory will create
     34 	   in obj.$MACHINE directory.
     35     Build to a DESTDIR:
     36 	This helps to keep old
     37 	   installed files (especially libraries) from interfering
     38 	   with the new build.
     39 	   To build to a DESTDIR, set the DESTDIR environment
     40 	   variable before running make build.  It should be set to
     41 	   the pathname of an initially empty directory.
     42 	   Problems: you might need to update critical utilities
     43 		without using DESTDIR since nothing is executed
     44 		from what is installed in DESTDIR.
     45 		(See critical utils, below)
     46     Build often:
     47 	This keeps critical utilities current enough to not choke
     48 	on any other part of the source tree that depends on up to
     49 	date functionality.
     50  
     51 What to do if things don't work:
     52 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     53 When things don't work there is usually a few things that commonly
     54 should be done.
     55     1)	make includes
     56 	This should be done automatically by make build.
     57     2)  cd share/mk && make install
     58 	Again, automatically done by make build.
     59 
     60 Failsafe rebuild of a small part of the tree:
     61 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     62 To make sure you rebuild something correctly you want to do
     63 something like the following:
     64     1)  Make sure the includes and .mk files are up to date.
     65     2)  Make sure any program used to build the particular
     66 	utility is up to date.  (yacc, lex, etc...)
     67     3)  cd ...path/to/util...
     68 	make cleandir
     69 	rm ...all obj directories...
     70 	make cleandir			# yes, again
     71 	make obj
     72 	make depend && make
     73 
     74 Failsafe rebuild of the entire tree:
     75 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     76 If you really want to make sure the source tree is clean and
     77 ready for a build try the following.  Note that sourcing /etc/mk.conf
     78 (a make(1) Makefile) in this manner is not right, and will not work
     79 for anyone who uses any make(1) features in /etc/mk.conf.
     80 
     81 ---cut here---
     82 #!/bin/sh
     83 . /etc/mk.conf
     84 
     85 if [ -z $BSDSRCDIR ] ; then
     86     BSDSRCDIR=/usr/src
     87 fi
     88 if [ \! -d $BSDSRCDIR ] ; then
     89     echo Unable to find sources
     90     exit 1
     91 fi
     92 find $BSDSRCDIR -name \*.o -o -name obj.\* -o -name obj -exec rm \{\} \;
     93 
     94 if [ -z $BSDOBJDIR ] ; then
     95     BSDOBJDIR=/usr/obj
     96 fi
     97 if [ -d $BSDOBJDIR ] ; then
     98     rm -rf $BSDOBJDIR
     99 fi
    100 
    101 cd $BSDSRCDIR && make cleandir
    102 
    103 ---cut here---
    104 
    105 Critical utilities:
    106 ^^^^^^^^^^^^^^^^^^^
    107 	gnu/usr.bin/egcs
    108 	usr.bin/compile_et
    109 	usr.bin/make
    110 	usr.bin/yacc
    111 	usr.bin/lex
    112 	usr.sbin/config
    113 
    114 Other problems and possibly solutions:
    115 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    116 Symptom:Unreasonable compiler errors.
    117 Fix:	Rebuild gnu/usr.bin/egcs
    118 
    119 Symptom:Complaints involving a Makefile.
    120 Fix:	Make sure .mk files are up to date.
    121 	cd share/mk && make install
    122 Fix:	Rebuild usr.bin/make
    123 
    124 Symptom:Kernel `config' fails to configure any kernel, including GENERIC.
    125 Fix:	Rebuild usr.sbin/config
    126 
    127 Symptom:
    128 Fix:	Rebuild usr.bin/yacc
    129 
    130 Symptom:
    131 Fix:	Rebuild usr.bin/lex
    132 
    133 Symptom:
    134 Fix:	rm /usr/lib/libbfd.a
    135