10
10
# -DNO_KERNELCONFIG do not run config in ${MAKE} buildkernel
11
11
# -DNO_KERNELCLEAN do not run ${MAKE} clean in ${MAKE} buildkernel
12
12
# -DNO_KERNELOBJ do not run ${MAKE} obj in ${MAKE} buildkernel
13
- # -DNO_PORTSUPDATE do not update ports in ${MAKE} update
14
13
# -DNO_ROOT install without using root privilege
15
- # -DNO_DOCUPDATE do not update doc in ${MAKE} update
16
14
# -DWITHOUT_CTF do not run the DTrace CTF conversion tools on built objects
17
15
# LOCAL_DIRS="list of dirs" to add additional dirs to the SUBDIR list
18
16
# LOCAL_ITOOLS="list of tools" to add additional tools to the ITOOLS list
19
17
# LOCAL_LIB_DIRS="list of dirs" to add additional dirs to libraries target
20
18
# LOCAL_MTREE="list of mtree files" to process to allow local directories
21
19
# to be created before files are installed
20
+ # LOCAL_LEGACY_DIRS="list of dirs" to add additional dirs to the legacy
21
+ # target
22
+ # LOCAL_BSTOOL_DIRS="list of dirs" to add additional dirs to the
23
+ # bootstrap-tools target
22
24
# LOCAL_TOOL_DIRS="list of dirs" to add additional dirs to the build-tools
23
- # list
25
+ # target
24
26
# LOCAL_XTOOL_DIRS="list of dirs" to add additional dirs to the
25
27
# cross-tools target
26
28
# METALOG="path to metadata log" to write permission and ownership
27
- # when NO_ROOT is set. (default: ${DESTDIR}/METALOG)
29
+ # when NO_ROOT is set. (default: ${DESTDIR}/${DISTDIR}/METALOG,
30
+ # check /etc/make.conf for DISTDIR)
28
31
# TARGET="machine" to crossbuild world for a different machine type
29
32
# TARGET_ARCH= may be required when a TARGET supports multiple endians
30
33
# BUILDENV_SHELL= shell to launch for the buildenv target (def:${SHELL})
@@ -226,15 +229,6 @@ WANT_COMPILER_VERSION_FILE= lib/clang/include/clang/Basic/Version.inc
226
229
WANT_COMPILER_VERSION!= \
227
230
awk '$$2 == "CLANG_VERSION" {split($$3, a, "."); print a[1] * 10000 + a[2] * 100 + a[3]}' \
228
231
${SRCDIR}/${WANT_COMPILER_VERSION_FILE} || echo unknown
229
- .elif ${WANT_COMPILER_TYPE} == "gcc"
230
- WANT_COMPILER_MIDNIGHTBSD_VERSION_FILE= gnu/usr.bin/cc/cc_tools/freebsd-native.h
231
- WANT_COMPILER_MIDNIGHTBSD_VERSION!= \
232
- awk '$$2 == "FBSD_CC_VER" {printf("%d\n", $$3)}' \
233
- ${SRCDIR}/${WANT_COMPILER_MIDNIGHTBSD_VERSION_FILE} || echo unknown
234
- WANT_COMPILER_VERSION_FILE= contrib/gcc/BASE-VER
235
- WANT_COMPILER_VERSION!= \
236
- awk -F. '{print $$1 * 10000 + $$2 * 100 + $$3}' \
237
- ${SRCDIR}/${WANT_COMPILER_VERSION_FILE} || echo unknown
238
232
.endif
239
233
.export WANT_COMPILER_MIDNIGHTBSD_VERSION WANT_COMPILER_VERSION
240
234
.endif # !defined(WANT_COMPILER_MIDNIGHTBSD_VERSION)
@@ -253,7 +247,6 @@ WANT_COMPILER_VERSION!= \
253
247
${X_COMPILER_MIDNIGHTBSD_VERSION} == ${WANT_COMPILER_MIDNIGHTBSD_VERSION}
254
248
# Everything matches, disable the bootstrap compiler.
255
249
MK_CLANG_BOOTSTRAP= no
256
- MK_GCC_BOOTSTRAP= no
257
250
USING_SYSTEM_COMPILER= yes
258
251
.endif # ${WANT_COMPILER_TYPE} == ${COMPILER_TYPE}
259
252
@@ -349,6 +342,7 @@ _TOOLCHAIN_METADATA_VARS= COMPILER_VERSION \
349
342
COMPILER_TYPE \
350
343
COMPILER_FEATURES \
351
344
COMPILER_MIDNIGHTBSD_VERSION \
345
+ COMPILER_RESOURCE_DIR \
352
346
LINKER_VERSION \
353
347
LINKER_FEATURES \
354
348
LINKER_TYPE \
@@ -524,14 +518,12 @@ OSRELDATE= 0
524
518
.endif
525
519
526
520
# Set VERSION for CTFMERGE to use via the default CTFFLAGS=-L VERSION.
527
- .if !defined(_REVISION)
528
- _REVISION!= ${MAKE} -C ${SRCDIR}/release MK_AUTO_OBJ=no -V REVISION
529
- .export _REVISION
530
- .endif
531
- .if !defined(_BRANCH)
532
- _BRANCH!= ${MAKE} -C ${SRCDIR}/release MK_AUTO_OBJ=no -V BRANCH
533
- .export _BRANCH
521
+ .for _V in BRANCH REVISION
522
+ .if !defined(_${_V})
523
+ _${_V}!= eval $$(awk '/^${_V}=/{print}' ${SRCTOP}/sys/conf/newvers.sh); echo $$${_V}
524
+ .export _${_V}
534
525
.endif
526
+ .endfor
535
527
.if !defined(SRCRELDATE)
536
528
SRCRELDATE!= awk '/^\#define[[:space:]]*__MidnightBSD_version/ { print $$3 }' \
537
529
${SRCDIR}/sys/sys/param.h
@@ -749,10 +741,10 @@ HMAKE+= PATH=${TMPPATH} METALOG=${METALOG} -DNO_ROOT
749
741
750
742
CROSSENV+= CC="${XCC} ${XCFLAGS}" CXX="${XCXX} ${XCXXFLAGS} ${XCFLAGS}" \
751
743
CPP="${XCPP} ${XCFLAGS}" \
752
- AS="${XAS}" AR="${XAR}" LD ="${XLD }" LLVM_LINK ="${XLLVM_LINK }" \
753
- NM=${XNM} OBJCOPY="${XOBJCOPY}" \
744
+ AS="${XAS}" AR="${XAR}" ELFCTL ="${XELFCTL }" LD ="${XLD }" \
745
+ LLVM_LINK="${XLLVM_LINK}" NM=${XNM} OBJCOPY="${XOBJCOPY}" \
754
746
RANLIB=${XRANLIB} STRINGS=${XSTRINGS} \
755
- SIZE="${XSIZE}"
747
+ SIZE="${XSIZE}" STRIPBIN="${XSTRIPBIN}"
756
748
757
749
.if defined(CROSS_BINUTILS_PREFIX) && exists(${CROSS_BINUTILS_PREFIX})
758
750
# In the case of xdev-build tools, CROSS_BINUTILS_PREFIX won't be a
@@ -788,20 +780,19 @@ XCFLAGS+= --sysroot=${WORLDTMP}
788
780
XCFLAGS+= ${BFLAGS}
789
781
.endif
790
782
791
- .if ${MK_LIB32} != "no" && (${TARGET_ARCH} == "amd64" || \
792
- ${TARGET_ARCH} == "powerpc64" || ${TARGET_ARCH:Mmips64*} != "")
793
- LIBCOMPAT= 32
783
+ .if ${MK_LIB32} == "yes"
784
+ _LIBCOMPAT= 32
794
785
.include "Makefile.libcompat"
795
- .elif ${MK_LIBSOFT} != "no" && ${TARGET_ARCH:Marmv[67]*} ! = ""
796
- LIBCOMPAT = SOFT
786
+ .elif ${MK_LIBSOFT} = = "yes "
787
+ _LIBCOMPAT = SOFT
797
788
.include "Makefile.libcompat"
798
789
.endif
799
790
800
791
# META_MODE normally ignores host file changes since every build updates
801
792
# timestamps (see NO_META_IGNORE_HOST in sys.mk). There are known times
802
793
# when the ABI breaks though that we want to force rebuilding WORLDTMP
803
794
# to get updated host tools.
804
- .if ${MK_META_MODE} == "yes" && defined(NO_CLEAN) && \
795
+ .if ${MK_META_MODE} == "yes" && ${MK_CLEAN} == "no" && \
805
796
!defined(NO_META_IGNORE_HOST) && !defined(NO_META_IGNORE_HOST_HEADERS) && \
806
797
!defined(_MKSHOWCONFIG)
807
798
# r318736 - ino64 major ABI breakage
@@ -863,7 +854,8 @@ IMAKEENV+= PATH=${TMPPATH}:${INSTALLTMP}
863
854
864
855
# When generating install media, do not allow user and group information from
865
856
# the build host to affect the contents of the distribution.
866
- .if make(distributeworld) || make(distrib-dirs) || make(distribution)
857
+ .if make(distributeworld) || make(distrib-dirs) || make(distribution) || \
858
+ make(stageworld)
867
859
DB_FROM_SRC= yes
868
860
.endif
869
861
@@ -886,14 +878,16 @@ MTREEFLAGS+= -W
886
878
INSTALLFLAGS+= -h sha256
887
879
.endif
888
880
.if defined(DB_FROM_SRC) || defined(NO_ROOT)
889
- IMAKE_INSTALL= INSTALL="install ${INSTALLFLAGS}"
890
- IMAKE_MTREE= MTREE_CMD="mtree ${MTREEFLAGS}"
881
+ IMAKE_INSTALL= INSTALL="${INSTALL_CMD} ${INSTALLFLAGS}"
882
+ IMAKE_MTREE= MTREE_CMD="${MTREE_CMD} ${MTREEFLAGS}"
891
883
.endif
892
884
.if make(distributeworld)
893
- CERTCTLDESTDIR= ${DESTDIR}/${DISTDIR}/base
885
+ CERTCTLDESTDIR= ${DESTDIR}/${DISTDIR}
886
+ CERTCTLFLAGS+= -d /base
894
887
.else
895
888
CERTCTLDESTDIR= ${DESTDIR}
896
889
.endif
890
+ CERTCTLFLAGS+= -D "${CERTCTLDESTDIR}"
897
891
898
892
DESTDIR_MTREEFLAGS= -deU
899
893
# When creating worldtmp we don't need to set the directories as owned by root
@@ -904,9 +898,12 @@ WORLDTMP_MTREEFLAGS= -deUW
904
898
# that are created by mtree to be owned by root/wheel.
905
899
DESTDIR_MTREEFLAGS+= -W
906
900
.endif
907
- MTREE?= mtree
908
- WORLDTMP_MTREE= ${MTREE} ${WORLDTMP_MTREEFLAGS}
909
- DESTDIR_MTREE= ${MTREE} ${DESTDIR_MTREEFLAGS}
901
+ DISTR_MTREE= ${MTREE_CMD}
902
+ .if ${BUILD_WITH_STRICT_TMPPATH} != 0
903
+ DISTR_MTREE= ${WORLDTMP}/legacy/usr/sbin/mtree
904
+ .endif
905
+ WORLDTMP_MTREE= ${DISTR_MTREE} ${WORLDTMP_MTREEFLAGS}
906
+ DESTDIR_MTREE= ${DISTR_MTREE} ${DESTDIR_MTREEFLAGS}
910
907
911
908
# kernel stage
912
909
KMAKEENV= ${WMAKEENV:NSYSROOT=*}
@@ -1064,13 +1061,18 @@ _worldtmp: .PHONY
1064
1061
.if ${USING_SYSTEM_LINKER} == "yes"
1065
1062
@rm -f ${WORLDTMP}/usr/bin/ld ${WORLDTMP}/usr/bin/ld.lld
1066
1063
.endif # ${USING_SYSTEM_LINKER} == "yes"
1067
- .endif # !defined(NO_CLEAN)
1064
+ .endif # ${MK_CLEAN} == "yes"
1068
1065
@mkdir -p ${WORLDTMP}
1069
1066
@touch ${WORLDTMP}/${.TARGET}
1070
1067
# We can't use mtree to create the worldtmp directories since it may not be
1071
1068
# available on the target system (this happens e.g. when building on non-MidnightBSD)
1072
1069
cd ${.CURDIR}/tools/build; \
1073
1070
${MAKE} DIRPRFX=tools/build/ DESTDIR=${WORLDTMP}/legacy installdirs
1071
+ # In order to build without inheriting $PATH we need to add symlinks to the host
1072
+ # tools in $WORLDTMP for the tools that we don't build during bootstrap-tools
1073
+ cd ${.CURDIR}/tools/build; \
1074
+ ${MAKE} DIRPRFX=tools/build/ DESTDIR=${WORLDTMP}/legacy host-symlinks
1075
+
1074
1076
_legacy:
1075
1077
@echo
1076
1078
@echo "--------------------------------------------------------------"
@@ -1098,24 +1100,26 @@ _bootstrap-tools:
1098
1100
${WORLDTMP_MTREE} -f ${.CURDIR}/${_mtree} -p ${WORLDTMP} > /dev/null
1099
1101
.endfor
1100
1102
_cleanobj:
1101
- .if !defined(NO_CLEAN)
1103
+ .if ${MK_CLEAN} == "yes"
1102
1104
@echo
1103
1105
@echo "--------------------------------------------------------------"
1104
1106
@echo ">>> stage 2.1: cleaning up the object tree"
1105
1107
@echo "--------------------------------------------------------------"
1106
- ${_+_}cd ${.CURDIR}; ${WMAKE} ${CLEANDIR}
1107
- .if defined(LIBCOMPAT)
1108
- ${_+_}cd ${.CURDIR}; ${LIBCOMPATWMAKE} -f Makefile.inc1 ${CLEANDIR}
1108
+ # Avoid including bsd.compiler.mk in clean and obj with _NO_INCLUDE_COMPILERMK
1109
+ # since the restricted $PATH might not contain a valid cc binary
1110
+ ${_+_}cd ${.CURDIR}; ${WMAKE} _NO_INCLUDE_COMPILERMK=t ${CLEANDIR}
1111
+ .if defined(_LIBCOMPAT)
1112
+ ${_+_}cd ${.CURDIR}; ${LIBCOMPATWMAKE} _NO_INCLUDE_COMPILERMK=t -f Makefile.inc1 ${CLEANDIR}
1109
1113
.endif
1110
1114
.else
1111
- ${_+_}cd ${.CURDIR}; ${WMAKE} _cleanobj_fast_depend_hack
1112
- .endif # !defined(NO_CLEAN)
1115
+ ${_+_}cd ${.CURDIR}; ${WMAKE} _NO_INCLUDE_COMPILERMK=t _cleanobj_fast_depend_hack
1116
+ .endif # ${MK_CLEAN} == "yes"
1113
1117
_obj:
1114
1118
@echo
1115
1119
@echo "--------------------------------------------------------------"
1116
1120
@echo ">>> stage 2.2: rebuilding the object tree"
1117
1121
@echo "--------------------------------------------------------------"
1118
- ${_+_}cd ${.CURDIR}; ${WMAKE} obj
1122
+ ${_+_}cd ${.CURDIR}; ${WMAKE} _NO_INCLUDE_COMPILERMK=t obj
1119
1123
_build-tools:
1120
1124
@echo
1121
1125
@echo "--------------------------------------------------------------"
@@ -1156,11 +1160,12 @@ _libraries:
1156
1160
@echo "--------------------------------------------------------------"
1157
1161
${_+_}cd ${.CURDIR}; \
1158
1162
${WMAKE} -DNO_FSCHG MK_HTML=no -DNO_LINT MK_MAN=no \
1159
- MK_PROFILE=no MK_TESTS=no MK_TESTS_SUPPORT=${MK_TESTS} libraries
1163
+ MK_PROFILE=no MK_TESTS=no MK_TESTS_SUPPORT=${MK_TESTS_SUPPORT} \
1164
+ libraries
1160
1165
everything: .PHONY
1161
1166
@echo
1162
1167
@echo "--------------------------------------------------------------"
1163
- @echo ">>> stage 4.3 : building everything"
1168
+ @echo ">>> stage 4.4 : building everything"
1164
1169
@echo "--------------------------------------------------------------"
1165
1170
${_+_}cd ${.CURDIR}; _PARALLEL_SUBDIR_OK=1 ${WMAKE} all
1166
1171
0 commit comments