Initial import from FreeBSD RELENG_4:
[dragonfly.git] / release / picobsd / build / Makefile.conf
1 # $FreeBSD: src/release/picobsd/build/Makefile.conf,v 1.5.2.11 2001/11/01 16:27:49 luigi Exp $
2 #
3 # Makefile for building PICOBSD kernels and running crunchgen
4 #
5 # Needs SRC pointing to the source tree,
6 # MY_TREE ponting to my tree
7 # BUILDDIR pointing to the build directory
8 # PICO_OBJ pointing to the object directory
9 # When building a kernel, also need ${name} from the environment
10 # and CONFIG may indicate an alternate config program
11
12 SRC?=/usr/src
13 CONFIG?=config
14 MODULES?=-DNO_MODULES   # do not build them as a default
15
16 # caller will set MODULES to empty if modules are needed.
17 # Indeed, it can be used to specify other Makefile options as well.
18
19 # These 3 variables determine where the kernel is built.
20 # If config were smart enough, we could place the config
21 # file in some other place than ${SRC}/sys/i386/conf, but
22 # at the moment (Oct.2001) this is not possible yet.
23 CONF=${SRC}/sys/i386/conf
24 #CONF=${BUILDDIR}/conf          # XXX does not work yet
25 CONFFILE=PICOBSD-${name}
26
27 # We can, however, compile the kernel somewhere else
28 #COMPILE=${CONF}/../../compile/${CONFFILE}
29 COMPILE=${BUILDDIR}/${CONFFILE}
30
31 KERNFILE=${COMPILE}/kernel
32
33 ${BUILDDIR}/kernel: ${KERNFILE}
34         cp -p ${.OODATE} ${.TARGET}
35         strip ${.TARGET}
36         strip --remove-section=.note --remove-section=.comment ${.TARGET}
37
38 ${KERNFILE}: ${COMPILE} do_a_make_in_the_kernel_directory_anyways
39
40 do_a_make_in_the_kernel_directory_anyways:
41         (cd ${COMPILE}; make KERNEL=kernel ${MODULES} )
42
43 ${COMPILE}: ${CONF}/${CONFFILE}
44         (cd ${CONF}; ${CONFIG} -d ${COMPILE} ${CONFFILE}; \
45         cd ${COMPILE}; make KERNEL=kernel ${MODULES} depend )
46
47 ${CONF}/${CONFFILE}: PICOBSD
48         # -mkdir -p ${CONF}             # XXX not needed yet.
49         cp ${.OODATE} ${.TARGET}
50         if [ -f PICOBSD.hints ] ; then cp PICOBSD.hints ${CONF}/PICOBSD.hints ; fi
51
52 # This part creates crunch1.conf and crunch.mk from crunch.conf
53 ${BUILDDIR}/crunch.mk: ${BUILDDIR}/crunch1.conf
54         -(cd ${BUILDDIR}/crunch ; \
55         crunchgen -p ${PICO_OBJ} -o -m ${.TARGET} ${.OODATE} )
56
57 ${BUILDDIR}/crunch1.conf: ${MY_TREE}/crunch.conf
58         (cd ${BUILDDIR}/crunch ; cat ${.OODATE} | \
59             sed -e "s@/usr/src@${SRC}@" -e "s+@__CWD__@+${MY_TREE}+" > ${.TARGET} )