Merge branch master
[unleashed/lotheac.git] / Makefile
bloba67576fedffc08d12c76e94a87116a1b6c28b38f
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:: tools gen-config
21 ${.MAKE} obj
22 ${.MAKE} -C include # kernel/ depends on these; build separately
23 ${.MAKE}
24 ${.MAKE} install
25 ${.MAKE} -C lib build32 # special multiarch target
26 ${.MAKE} -C usr install # dmake expects libs to already be in DESTDIR
27 ${.MAKE} -C tools/postbuild clean obj
28 ${.MAKE} -C tools/postbuild
30 .include <unleashed.mk>
31 .include <subdir.mk>
33 cleandir: clean_artifacts clean_tools clean_lib
34 clean_artifacts::
35 rm -rf ${.CURDIR}/proto/root_i386 ${.CURDIR}/packages/i386/nightly/repo.redist
36 # tools/ is not in SUBDIR
37 clean_tools::
38 ${.MAKE} -C tools cleandir
39 clean_lib::
40 ${.MAKE} -C lib cleanboth
41 # FIXME pretty dumb, but we need cfgparam.mk to clean some subdirs. this is
42 # because eg. include/ has additional subdirs based on some config. so do not
43 # remove gen-config outputs even if cleandir is specified, for now.
44 #clean_cfgparam::
45 # rm -f ${.CURDIR}/usr/src/Makefile.cfgparam ${.CURDIR}/include/sys/cfgparam.h
48 # Config related support
51 .if !empty(BUILD_ARCH)
52 CFGARCH=${BUILD_ARCH}
53 .elif ${MACHINE} == "i86pc" || ${MACHINE} == "i386" || ${MACHINE} == "amd64"
54 CFGARCH=x86
55 .elif ${MACHINE} == "sparc"
56 CFGARCH=sparc
57 .else
58 .error "Unknown machine architecture ${MACHINE}; override it via BUILD_ARCH"
59 .endif
61 CFGFILE=arch/${CFGARCH}/Sconfig
63 tools::
64 ${.MAKE} -C tools obj
65 ${.MAKE} -C tools
67 ${.CURDIR}/include/sys/cfgparam.h: tools
68 ${.CURDIR}/tools/mkconfig/obj/mkconfig -I _SYS_CFGPARAM_H -H -o $@ ${CFGFILE}
69 ${.CURDIR}/usr/src/Makefile.cfgparam: tools
70 ${.CURDIR}/tools/mkconfig/obj/mkconfig -m -o $@ ${CFGFILE}
71 ${.CURDIR}/cfgparam.mk: tools
72 ${.CURDIR}/tools/mkconfig/obj/mkconfig -M -o $@ ${CFGFILE}
73 gen-config:: ${.CURDIR}/cfgparam.mk ${.CURDIR}/include/sys/cfgparam.h ${.CURDIR}/usr/src/Makefile.cfgparam