-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile.inc1.preflash
210 lines (187 loc) · 7.08 KB
/
Makefile.inc1.preflash
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
#
# *** HEAVILY UNDER CONSTRUCTION ***
#
# This file contains make targets which are private to the build process,
# and which are not intended to be directly invoked by the user.
# Its role in the build process is identical to that of the Makefile.inc1
# file in the FreeBSD build.
#
# The intended user-driven targets are listed in ./Makefile. Most of
# these targets are defined in this file.
#
# Standard targets (not defined here) are documented in the makefiles in
# /usr/share/mk. These include:
# obj depend all install clean cleandepend cleanobj
#
# ----------------------------------------------------------------------------
# Put initial settings here.
SUBDIR=
# ----------------------------------------------------------------------------
# Default configuration variables go here. Anything not already
# specified in the environment will be sourced from here.
# ----------------------------------------------------------------------------
# Please set ${SRC} to the absolute location of your FreeBSD source.
SRC?= /usr/src
CDROM_ISO?= closedbsd.iso
#
# Build up the $SUBDIR from the source tree components we have installed.
# Initially:- kernel bin closedbsd sbin share usr.bin usr.sbin
#
.if exists(${.CURDIR}/bin)
SUBDIR += bin
.endif
.if exists(${.CURDIR}/sbin)
SUBDIR += sbin
.endif
.if exists(${.CURDIR}/share) && !defined(NOSHARE)
SUBDIR += share
.endif
.if exists(${.CURDIR}/usr.bin)
SUBDIR += usr.bin
.endif
.if exists(${.CURDIR}/usr.sbin)
SUBDIR += usr.sbin
.endif
.if exists(${.CURDIR}/closedbsd)
SUBDIR += closedbsd
.endif
# private closedbsd kernel build directory
.if exists(${.CURDIR}/kernel)
SUBDIR += kernel
.endif
.if defined(NOCLEANDIR)
CLEANDIR= clean cleandepend
.else
CLEANDIR= cleandir
.endif
SUP?= /usr/local/bin/cvsup
SUPFLAGS?= -g -L 2 -P -
.if defined(SUPHOST)
SUPFLAGS+= -h ${SUPHOST}
.endif
MAKEOBJDIRPREFIX?= /usr/obj
TARGET_ARCH?= ${MACHINE_ARCH}
TARGET?= ${MACHINE}
.if make(buildworld)
BUILD_ARCH!= sysctl -n hw.machine_arch
.if ${MACHINE_ARCH} != ${BUILD_ARCH}
.error To cross-build, set TARGET_ARCH.
.endif
.endif
.if ${MACHINE_ARCH} == ${TARGET_ARCH}
OBJTREE= ${MAKEOBJDIRPREFIX}
.else
OBJTREE= ${MAKEOBJDIRPREFIX}/${TARGET_ARCH}
.endif
WORLDTMP= ${OBJTREE}${.CURDIR}/${MACHINE_ARCH}
STRICTTMPPATH= ${WORLDTMP}/usr/sbin:${WORLDTMP}/usr/bin:${WORLDTMP}/usr/games
TMPPATH= ${STRICTTMPPATH}:${PATH}
OBJFORMAT_PATH?= /usr/libexec
TMPDIR?= /tmp
TMPPID!= echo $$$$
INSTALLTMP= ${TMPDIR}/install.${TMPPID}
# ----------------------------------------------------------------------------
# Steps which need to be performed ahead of anything else will go here.
# ----------------------------------------------------------------------------
# build-tool and temporary build tree stage
TMAKEENV= MAKEOBJDIRPREFIX=${OBJTREE} \
PATH=${TMPPATH}
TMAKE= ${TMAKEENV} ${MAKE} -f Makefile.inc1
# world stage
WMAKEENV= ${CROSSENV} \
DESTDIR=${WORLDTMP} \
PATH=${TMPPATH}
WMAKE= ${WMAKEENV} ${MAKE} -f Makefile.inc1
# media stage, propagate the required build environment variables.
FMAKEENV= ${CROSSENV} \
TARGET_ARCH=${TARGET_ARCH} \
CDROM_BOOT=${CDROM_BOOT} \
CDROM_ISO=${CDROM_ISO} \
SRC=${SRC} \
DESTDIR=${WORLDTMP} \
PATH=${TMPPATH}
FMAKE= ${FMAKEENV} ${MAKE}
# ----------------------------------------------------------------------------
# Public makefile targets go here.
# ----------------------------------------------------------------------------
STARTTIME!= LC_ALL=C date
buildworld:
@echo "--------------------------------------------------------------"
@echo ">>> ClosedBSD/${TARGET_ARCH} buildworld on ${STARTTIME}"
@echo "--------------------------------------------------------------"
@echo
@echo "--------------------------------------------------------------"
@echo ">>> Rebuilding the temporary build tree"
@echo "--------------------------------------------------------------"
.if !defined(NOCLEAN)
rm -rf ${WORLDTMP}
.else
for dir in bin sbin closedbsd usr.bin usr.sbin ; do \
rm -rf ${WORLDTMP}/usr/$$dir; \
done
.endif
.if !defined(NOCLEAN)
@echo "--------------------------------------------------------------"
@echo ">>> stage 1: cleaning up the object tree"
@echo "--------------------------------------------------------------"
cd ${.CURDIR}; ${TMAKE} ${CLEANDIR:S/^/par-/}
.endif
@echo
@echo "--------------------------------------------------------------"
@echo ">>> stage 2: rebuilding the object tree"
@echo "--------------------------------------------------------------"
cd ${.CURDIR}; ${TMAKE} par-obj
@echo
@echo "--------------------------------------------------------------"
@echo ">>> stage 3: building everything..."
@echo "--------------------------------------------------------------"
cd ${.CURDIR}; ${WMAKE} all
iso: buildworld
@echo "--------------------------------------------------------------"
@echo ">>> ClosedBSD/${TARGET_ARCH} buildiso on ${STARTTIME}"
@echo "--------------------------------------------------------------"
.if !defined(NOCLEAN)
@echo "--------------------------------------------------------------"
@echo ">>> stage 1: cleaning up the object tree"
@echo "--------------------------------------------------------------"
cd ${.CURDIR}/release/cdrom; TARGET_MEDIA=CDROM ${FMAKE} ${CLEANDIR}
.endif
@echo
@echo "--------------------------------------------------------------"
@echo ">>> stage 2: rebuilding the object tree"
@echo "--------------------------------------------------------------"
cd ${.CURDIR}/release/cdrom; TARGET_MEDIA=CDROM ${FMAKE} obj
@echo
@echo "--------------------------------------------------------------"
@echo ">>> stage 3: building everything..."
@echo "--------------------------------------------------------------"
cd ${.CURDIR}/release/cdrom/kernel; TARGET_MEDIA=CDROM ${FMAKE} all
cd ${.CURDIR}/release/cdrom/monolith; TARGET_MEDIA=CDROM ${FMAKE} all
cd ${.CURDIR}/release/cdrom/tree; TARGET_MEDIA=CDROM ${FMAKE} all
@echo "--------------------------------------------------------------"
@echo ">>> ClosedBSD/${TARGET_ARCH} iso build complete ${STARTTIME}"
@echo "--------------------------------------------------------------"
@echo "Image file now resides in: ${.OBJDIR}/release/cdrom/tree/${CDROM_ISO}"
@echo "Have a nice day."
@echo
# ----------------------------------------------------------------------------
# Private makefile targets go here.
# ----------------------------------------------------------------------------
# parallel build and clean magic
.for __target in clean cleandepend cleandir depend obj
.for entry in ${SUBDIR}
${entry}.${__target}__D: .PHONY
@if test -d ${.CURDIR}/${entry}.${MACHINE_ARCH}; then \
${ECHODIR} "===> ${DIRPRFX}${entry}.${MACHINE_ARCH}"; \
edir=${entry}.${MACHINE_ARCH}; \
cd ${.CURDIR}/$${edir}; \
else \
${ECHODIR} "===> ${DIRPRFX}${entry}"; \
edir=${entry}; \
cd ${.CURDIR}/$${edir}; \
fi; \
${MAKE} ${__target} DIRPRFX=${DIRPRFX}$${edir}/
.endfor
par-${__target}: ${SUBDIR:S/$/.${__target}__D/}
.endfor
.include <bsd.subdir.mk>