]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - share/mk/local.sys.dirdeps.mk
zfs: merge openzfs/zfs@0ee9b0239
[FreeBSD/FreeBSD.git] / share / mk / local.sys.dirdeps.mk
1
2 # local configuration specific to meta mode
3 # we assume that MK_DIRDEPS_BUILD=yes
4
5 # we need this until there is an alternative
6 MK_INSTALL_AS_USER= yes
7
8 .-include <site.sys.dirdeps.mk>
9 # previously only included for DIRDEPS_BUILD anyway
10 .-include <site.meta.sys.mk>
11
12 .if ${MK_STAGING} == "yes"
13
14 STAGE_TARGET_OBJTOP:= ${STAGE_ROOT}/${TARGET_OBJ_SPEC}
15 # These are exported for hooking in out-of-tree builds.  They will always
16 # be overridden in sub-makes above when building in-tree.
17 .if ${.MAKE.LEVEL} > 0
18 .export STAGE_OBJTOP STAGE_TARGET_OBJTOP STAGE_HOST_OBJTOP
19 .endif
20
21 # Use tools/install.sh which can avoid the need for xinstall for simple cases.
22 INSTALL?=       sh ${SRCTOP}/tools/install.sh
23 # This is for stage-install to pickup from the environment.
24 REAL_INSTALL:=  ${INSTALL}
25 .export REAL_INSTALL
26 STAGE_INSTALL=  sh ${.PARSEDIR:tA}/stage-install.sh OBJDIR=${.OBJDIR:tA}
27
28 STAGE_LIBDIR= ${STAGE_OBJTOP}${_LIBDIR:U${LIBDIR:U/lib}}
29 STAGE_INCLUDEDIR= ${STAGE_OBJTOP}${INCLUDEDIR:U/usr/include}
30 # this is not the same as INCLUDEDIR
31 STAGE_INCSDIR= ${STAGE_OBJTOP}${INCSDIR:U/include}
32 # the target is usually an absolute path
33 STAGE_SYMLINKS_DIR= ${STAGE_OBJTOP}
34
35 #LDFLAGS_LAST+= -Wl,-rpath-link,${STAGE_LIBDIR}
36 .if ${MK_SYSROOT} == "yes"
37 SYSROOT?= ${STAGE_OBJTOP}
38 .else
39 LDFLAGS_LAST+= -L${STAGE_LIBDIR}
40 .endif
41
42 .endif                          # MK_STAGING
43
44 .-include "local.toolchain.mk"
45
46 .if ${.MAKE.LEVEL} > 0 && ${MACHINE} == "host" && ${.MAKE.DEPENDFILE:E} != "host"
47 # we can use this but should not update it.
48 UPDATE_DEPENDFILE?= NO
49 .endif
50
51 # define the list of places that contain files we are responsible for
52 .MAKE.META.BAILIWICK = ${SB} ${OBJROOT} ${STAGE_ROOT}
53
54 CSU_DIR.${MACHINE_ARCH} ?= csu/${MACHINE_ARCH}
55 CSU_DIR := ${CSU_DIR.${MACHINE_ARCH}}
56
57 .if !empty(TIME_STAMP)
58 TRACER= ${TIME_STAMP} ${:U}
59 .endif
60 .if !defined(_RECURSING_PROGS) && !defined(_RECURSING_CRUNCH) && \
61     !make(print-dir)
62 WITH_META_STATS= t
63 .endif
64
65 # toolchains can be a pain - especially bootstrappping them
66 TOOLCHAIN_VARS= AS AR CC CLANG_TBLGEN CXX CPP LD NM OBJCOPY RANLIB \
67                 STRINGS SIZE LLVM_TBLGEN
68 _toolchain_bin_CLANG_TBLGEN=    /usr/bin/clang-tblgen
69 _toolchain_bin_LLVM_TBLGEN=     /usr/bin/llvm-tblgen
70 _toolchain_bin_CXX=             /usr/bin/c++
71 .ifdef WITH_TOOLSDIR
72 TOOLSDIR?= ${HOST_OBJTOP}/tools
73 .elif defined(STAGE_HOST_OBJTOP)
74 TOOLSDIR?= ${STAGE_HOST_OBJTOP}
75 .endif
76 .if ${MK_DIRDEPS_BUILD} == "yes" && ${MACHINE} != "host"
77 # ideally tools needed by makefiles like sh,csh,tinfo
78 # would be built in their own directories but for now
79 # this works well enough.
80 BTOOLSPATH= ${HOST_OBJTOP}/${RELDIR}
81 .else
82 # Only define if it exists in case user didn't run bootstrap-tools.  Otherwise
83 # the tool will be built during the build.  Building it assumes it is
84 # TARGET==MACHINE.
85 .if exists(${HOST_OBJTOP}/tools${.CURDIR})
86 BTOOLSPATH= ${HOST_OBJTOP}/tools${.CURDIR}
87 .endif
88 .endif
89
90 # Don't use the bootstrap tools logic on itself.
91 .if ${.TARGETS:Mbootstrap-tools} == "" && \
92     !make(test-system-*) && !make(showconfig) && !make(print-dir) && \
93     !defined(BOOTSTRAPPING_TOOLS) && !empty(TOOLSDIR) && ${.MAKE.LEVEL} == 0
94 .for dir in /sbin /bin /usr/sbin /usr/bin
95 PATH:= ${TOOLSDIR}${dir}:${PATH}
96 .endfor
97 .export PATH
98 # Prefer the TOOLSDIR version of the toolchain if present vs the host version.
99 .for var in ${TOOLCHAIN_VARS}
100 _toolchain_bin.${var}=  ${TOOLSDIR}${_toolchain_bin_${var}:U/usr/bin/${var:tl}}
101 .if exists(${_toolchain_bin.${var}})
102 HOST_${var}?=   ${_toolchain_bin.${var}}
103 .export         HOST_${var}
104 .endif
105 .endfor
106 .endif
107
108 .for var in ${TOOLCHAIN_VARS}
109 HOST_${var}?=   ${_toolchain_bin_${var}:U/usr/bin/${var:tl}}
110 .endfor
111
112 .if ${MACHINE} == "host"
113 .for var in ${TOOLCHAIN_VARS}
114 ${var}=         ${HOST_${var}}
115 .endfor
116 .endif
117
118 .if ${MACHINE:Nhost:Ncommon} != "" && ${MACHINE} != ${HOST_MACHINE}
119 # cross-building
120 .if !defined(FREEBSD_REVISION)
121 FREEBSD_REVISION!= sed -n '/^REVISION=/{s,.*=,,;s,",,g;p; }' ${SRCTOP}/sys/conf/newvers.sh
122 .export FREEBSD_REVISION
123 .endif
124 CROSS_TARGET_FLAGS?= -target ${MACHINE_ARCH}-unknown-freebsd${FREEBSD_REVISION}
125 CFLAGS+= ${CROSS_TARGET_FLAGS}
126 ACFLAGS+= ${CROSS_TARGET_FLAGS}
127 .endif
128
129 # we set these here, rather than local.gendirdeps.mk
130 # so we can ensure any DEP_* values that might be used in
131 # conditionals do not cause syntax errors when Makefile.depend
132 # is included at level 1+
133
134 # order of this list matters!
135 GENDIRDEPS_FILTER_DIR_VARS+= \
136        CSU_DIR \
137        BOOT_MACHINE_DIR
138
139 # order of this list matters!
140 GENDIRDEPS_FILTER_VARS+= \
141        KERNEL_NAME \
142        DEP_MACHINE_CPUARCH \
143        DEP_MACHINE_ARCH \
144        DEP_MACHINE
145
146 .if ${.MAKE.LEVEL} > 0
147 .for V in ${GENDIRDEPS_FILTER_DIR_VARS:MDEP_*:O:u} \
148         ${GENDIRDEPS_FILTER_VARS:MDEP_*:O:u}
149 $V?= ${${V:S,DEP_,,}}
150 .endfor
151 .endif
152
153 .if ${MACHINE} == "host" && ${.MAKE.OS} != "FreeBSD"
154 # some makefiles expect this
155 BOOTSTRAPPING= 0
156 .endif