good night nightly(1); long live 'make build'
[unleashed.git] / Makefile
blob4d38d06db73c07269746abc6245272c5f5b9a433
1 SUBDIR = bin \
2 boot \
3 etc \
4 include \
5 kernel \
6 lib \
7 libexec \
8 share
10 .if !make(build) && !make(gen-config)
11 .if !exists(${.CURDIR}/cfgparam.mk)
12 .error run make gen-config to generate cfgparam.mk
13 .endif
14 .include "cfgparam.mk"
15 .endif
17 .if make(build) && !defined(DESTDIR)
18 .MAKEFLAGS+= DESTDIR=${.CURDIR}/proto/root_i386
19 .endif
20 build::
21 .if !exists(${.CURDIR}/cfgparam.mk)
22 ${.MAKE} gen-config
23 .endif
24 ${.MAKE} obj
25 ${.MAKE} -C include # kernel/ depends on these; build separately
26 ${.MAKE}
27 ${.MAKE} install
28 ${.MAKE} -C lib build32 # special multiarch target
29 ${.MAKE} -C kernel all
30 ${.MAKE} -C kernel install
31 ${.MAKE} -C usr install # dmake expects libs to already be in DESTDIR
32 ${.MAKE} -C tools/postbuild clean obj
33 ${.MAKE} -C tools/postbuild
35 .include <unleashed.mk>
36 .include <subdir.mk>
38 cleandir: clean_artifacts clean_tools clean_cfgparam
39 clean_artifacts::
40 rm -rf ${.CURDIR}/proto/root_i386 ${.CURDIR}/packages/i386/nightly/repo.redist
41 # tools/ is not in SUBDIR
42 clean_tools::
43 ${.MAKE} -C tools cleandir
44 # FIXME this is pretty dumb: we need cfgparam.mk to clean some subdirs. this is
45 # because eg. include/ has additional subdirs based on some config...
46 clean_cfgparam:: ${SUBDIR}
47 rm -f ${.CURDIR}/cfgparam.mk ${.CURDIR}/usr/src/Makefile.cfgparam ${.CURDIR}/include/sys/cfgparam.h
50 # Config related support
53 .if !empty(BUILD_ARCH)
54 CFGARCH=${BUILD_ARCH}
55 .elif ${MACHINE} == "i86pc" || ${MACHINE} == "i386" || ${MACHINE} == "amd64"
56 CFGARCH=x86
57 .elif ${MACHINE} == "sparc"
58 CFGARCH=sparc
59 .else
60 .error "Unknown machine architecture ${MACHINE}; override it via BUILD_ARCH"
61 .endif
63 CFGFILE=arch/${CFGARCH}/Sconfig
65 gen-config::
66 ${.MAKE} -C tools obj
67 ${.MAKE} -C tools
68 ${.CURDIR}/tools/mkconfig/obj/mkconfig -I _SYS_CFGPARAM_H -H -o include/sys/cfgparam.h ${CFGFILE}
69 ${.CURDIR}/tools/mkconfig/obj/mkconfig -m -o usr/src/Makefile.cfgparam ${CFGFILE}
70 ${.CURDIR}/tools/mkconfig/obj/mkconfig -M -o cfgparam.mk ${CFGFILE}