aboutsummaryrefslogtreecommitdiff
path: root/targets/pseudo/bootstrap-tools/Makefile
blob: 49fccde88661a0c5a8ffa4553568c9e444b54c83 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# $FreeBSD$

# building clang is particularly tedious - so avoid re-inventing wheels

all: bootstrap-toolchain

UPDATE_DEPENDFILE= no
.export UPDATE_DEPENDFILE

# we build for the pseudo machine "host"
TARGET_MACHINE= host

HOST_MACHINE!= uname -m
HOST_MACHINE_ARCH!= uname -p
BTOOLSDIR?= ${HOST_OBJTOP}/tools
LEGACY_TOOLS?= ${BTOOLSDIR}/legacy

BSENV= \
	unset MAKEOBJDIR; MAKEOBJDIRPREFIX=${BTOOLSDIR} \
	MAKESYSPATH=${SRCTOP}/tools/build/mk:${SRCTOP}/share/mk \
	TARGET=${HOST_MACHINE} TARGET_ARCH=${HOST_MACHINE_ARCH} \
	WITHOUT_STAGING=1 STAGE_ROOT= \
	WORLDTMP=${BTOOLSDIR} LEGACY_TOOLS=${LEGACY_TOOLS}

BSARGS= \
	DESTDIR= \
	SSP_CFLAGS= \
	MK_HTML=no MK_INFO=no NO_LINT=yes MK_MAN=no \
	-DNO_PIC MK_PROFILE=no -DNO_SHARED \
	-DWITH_CLANG_BOOTSTRAP \
	-DNO_CPU_CFLAGS -DNO_WARNS MK_CTF=no -DEARLY_BUILD MK_TESTS=no


legacy: .MAKE .META
	mkdir -p ${LEGACY_TOOLS}
	${MAKE} -C ${SRCTOP}/etc distrib-dirs DESTDIR=${BTOOLSDIR} > $@2
	${MAKE} -C ${SRCTOP}/etc distrib-dirs DESTDIR=${LEGACY_TOOLS} > $@
	${BSENV} ${MAKE} -C ${SRCTOP} -f Makefile.inc1 ${BSARGS} $@
	touch $@

bootstrap-tools: legacy
build-tools: bootstrap-tools
cross-tools: build-tools

cross-tools build-tools bootstrap-tools: .MAKE .META
	${BSENV} ${MAKE} -C ${SRCTOP} -f Makefile.inc1 ${BSARGS} $@
	touch $@

# MAKELEVEL=0 so that dirdeps.mk does its thing
# LEGACY_TOOLS lets us use the bootstaped stuff above
# TARGET* is so that MK_CLANG gets set correctly.
BSTCENV= \
	MAKELEVEL=0 \
	MACHINE=host \
	LEGACY_TOOLS=${LEGACY_TOOLS} \
	TARGET=${HOST_MACHINE} \
	TARGET_ARCH=${HOST_MACHINE_ARCH}

BSTCARGS= \
	${BSARGS} \
	-DWITH_STAGING \
	-DWITH_TOOLSDIR

# finally we build toolchain leveraging the above.
bootstrap-toolchain:	.MAKE cross-tools
	${BSTCENV} ${MAKE} -C ${.CURDIR:H:H} ${BSTCARGS} toolchain