]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - targets/pseudo/bootstrap-tools/Makefile
MFstable/12 r340788:
[FreeBSD/FreeBSD.git] / targets / pseudo / bootstrap-tools / Makefile
1 # $FreeBSD$
2
3 # building clang is particularly tedious - so avoid re-inventing wheels
4
5 all: bootstrap-toolchain
6
7 UPDATE_DEPENDFILE= no
8 .export UPDATE_DEPENDFILE
9
10 # we build for the pseudo machine "host"
11 TARGET_MACHINE= host
12
13 HOST_MACHINE!= uname -m
14 HOST_MACHINE_ARCH!= uname -p
15 BTOOLSDIR?= ${HOST_OBJTOP}/tools
16 WORLDTMP= ${BTOOLSDIR}
17 LEGACY_TOOLS?= ${BTOOLSDIR}/legacy
18
19 BSENV= \
20         MAKESYSPATH=${SRCTOP}/tools/build/mk:${SRCTOP}/share/mk \
21         TARGET=${HOST_MACHINE} TARGET_ARCH=${HOST_MACHINE_ARCH} \
22         WITHOUT_STAGING=1 STAGE_ROOT= BOOTSTRAPPING_TOOLS=1 \
23         WORLDTMP=${BTOOLSDIR} \
24         INSTALL="sh ${SRCTOP}/tools/install.sh" \
25         PATH=${LEGACY_TOOLS}/usr/sbin:${LEGACY_TOOLS}/usr/bin:${LEGACY_TOOLS}/bin:${PATH}
26
27 .if !defined(OSRELDATE)
28 ord_h= /usr/include/osreldate.h
29 .if exists(${ord_h})
30 OSRELDATE!= sed -n '/define.*__FreeBSD_version/{s,^[^0-9]*,,p;q;}' ${ord_h}
31 .endif
32 OSRELDATE?= 0
33 .endif
34
35 # need to keep this in sync with src/Makefile.inc1 
36 BSARGS=         DESTDIR= \
37                 OBJTOP='${WORLDTMP}/obj-tools' \
38                 OBJROOT='$${OBJTOP}/' \
39                 MAKEOBJDIRPREFIX= \
40                 BOOTSTRAPPING=${OSRELDATE} \
41                 BWPHASE=${.TARGET} \
42                 SSP_CFLAGS= \
43                 MK_HTML=no NO_LINT=yes MK_MAN=no \
44                 -DNO_PIC MK_PROFILE=no -DNO_SHARED \
45                 -DNO_CPU_CFLAGS MK_WARNS=no MK_CTF=no \
46                 MK_CLANG_EXTRAS=no MK_CLANG_FULL=no \
47                 MK_LLDB=no MK_TESTS=no \
48                 MK_INCLUDES=yes
49
50 # We will handle building the toolchain and cross-compiler.
51 BSARGS+= MK_CROSS_COMPILER=no MK_CLANG=no MK_GCC=no
52
53 DISTRIB_ENV=    INSTALL="sh ${SRCTOP}/tools/install.sh" NO_FSCHG=1 MK_TESTS=no
54 legacy: .MAKE ${META_DEPS}
55         mkdir -p ${LEGACY_TOOLS}
56         ${DISTRIB_ENV} ${MAKE} -C ${SRCTOP}/etc distrib-dirs \
57             DESTDIR=${BTOOLSDIR} > $@.distrib-dirs_btoolsdir
58         ${DISTRIB_ENV} ${MAKE} -C ${SRCTOP}/etc distrib-dirs \
59             DESTDIR=${LEGACY_TOOLS} > $@.distrib-dirs_legacy_tools
60         ${BSENV} ${MAKE} -C ${SRCTOP} -f Makefile.inc1 ${BSARGS} $@
61
62 bootstrap-tools: legacy
63 build-tools: bootstrap-tools
64 cross-tools: build-tools
65
66 cross-tools build-tools bootstrap-tools: .MAKE ${META_DEPS}
67         ${BSENV} ${MAKE} -C ${SRCTOP} -f Makefile.inc1 ${BSARGS} $@
68
69 # MAKELEVEL=0 so that dirdeps.mk does its thing
70 # BSENV:MPATH=* lets us use the bootstrapped stuff in LEGACY_TOOLS above.
71 # TARGET* is so that MK_CLANG gets set correctly.
72 BSTCENV= \
73         MAKELEVEL=0 \
74         MACHINE=host \
75         BOOTSTRAPPING_TOOLS=1 \
76         TARGET=${HOST_MACHINE} \
77         TARGET_ARCH=${HOST_MACHINE_ARCH} \
78         ${BSENV:MPATH=*}
79
80 BSTCARGS= \
81         ${BSARGS:NDESTDIR=*:NOBJTOP=*:NOBJROOT=*:NMK_CROSS_COMPILER=*:NMK_CLANG=*:NMK_GCC=*} \
82         BUILD_DIRDEPS=yes \
83         LLVM_TBLGEN=${TOOLSDIR}/usr/bin/llvm-tblgen \
84         CLANG_TBLGEN=${TOOLSDIR}/usr/bin/clang-tblgen \
85         -DWITH_STAGING \
86         -DWITH_TOOLSDIR
87
88 # finally we build toolchain leveraging the above.
89 bootstrap-toolchain:    .MAKE cross-tools
90         ${BSTCENV} ${MAKE} -C ${SRCTOP} ${BSTCARGS} toolchain
91
92 # Ensure CCACHE_DIR is ignored since we are processing .meta files here.
93 .include <bsd.compiler.mk>