local.sys.mk (89ea69b2faeab753b868e1f665853c464e083058) | local.sys.mk (4113aa90776ac4b6d192cfbef7f021f8d6a98cf4) |
---|---|
1WITH_INSTALL_AS_USER= yes 2 | 1WITH_INSTALL_AS_USER= yes 2 |
3.if defined(.PARSEDIR) # bmake | |
4.if !defined(_TARGETS) 5# some things we do only once | 3.if !defined(_TARGETS) 4# some things we do only once |
6_TARGETS := ${.TARGETS} | 5_TARGETS:= ${.TARGETS} |
7.export _TARGETS 8.endif | 6.export _TARGETS 7.endif |
9.if ${_TARGETS:Mbuildworld} 10WITHOUT_STAGING= 11WITHOUT_SYSROOT= | 8 9.if (!empty(_TARGETS) && ${_TARGETS:Nbuildworld:Nuniverse:Ninstallworld} == "") || defined(WITHOUT_META_MODE) 10MK_AUTO_OBJ= no 11MK_META_MODE= no 12MK_STAGING= no 13MK_STAGING_PROG= no 14MK_SYSROOT= no |
12UPDATE_DEPENDFILE=NO | 15UPDATE_DEPENDFILE=NO |
13NO_AUTO_OBJ= | |
14.endif | 16.endif |
17 |
|
15SRCCONF:= ${.PARSEDIR}/src.conf 16# ensure we are self contained 17__MAKE_CONF:= ${SRCCONF} 18.-include "src.conf" 19 20# some handy macros 21_this = ${.PARSEDIR:tA}/${.PARSEFILE} 22# some useful modifiers --- 12 unchanged lines hidden (view full) --- 35# type should be a builtin in any sh since about 1980, 36# AUTOCONF := ${autoconf:L:${M_whence}} 37M_type = @x@(type $$x 2> /dev/null); echo;@:sh:[0]:N* found*:[@]:C,[()],,g 38M_whence = ${M_type}:M/*:[1] 39 40# convert a path to a valid shell variable 41M_P2V = tu:C,[./-],_,g 42 | 18SRCCONF:= ${.PARSEDIR}/src.conf 19# ensure we are self contained 20__MAKE_CONF:= ${SRCCONF} 21.-include "src.conf" 22 23# some handy macros 24_this = ${.PARSEDIR:tA}/${.PARSEFILE} 25# some useful modifiers --- 12 unchanged lines hidden (view full) --- 38# type should be a builtin in any sh since about 1980, 39# AUTOCONF := ${autoconf:L:${M_whence}} 40M_type = @x@(type $$x 2> /dev/null); echo;@:sh:[0]:N* found*:[@]:C,[()],,g 41M_whence = ${M_type}:M/*:[1] 42 43# convert a path to a valid shell variable 44M_P2V = tu:C,[./-],_,g 45 |
43# absoulte path to what we are reading. 44_PARSEDIR = ${.PARSEDIR:tA} 45 46.if !empty(SB) 47SB_SRC ?= ${SB}/src 48SB_OBJROOT ?= ${SB}/obj/ 49# this is what we use below 50SRCTOP ?= ${SB_SRC} 51OBJROOT ?= ${SB_OBJROOT} 52.endif 53 54.if empty(SRCTOP) 55SRCTOP := ${_PARSEDIR:H:H} 56OBJROOT ?= ${SRCTOP:H}/obj/ 57OBJROOT := ${OBJROOT} 58.endif 59.export OBJROOT SRCTOP 60 61# we need HOST_TARGET etc below. 62.include <host-target.mk> 63 64# from src/Makefile (for universe) 65TARGET_ARCHES_arm?= arm armeb armv6 armv6eb 66TARGET_ARCHES_mips?= mipsel mips mips64el mips64 mipsn32 67TARGET_ARCHES_powerpc?= powerpc powerpc64 68TARGET_ARCHES_pc98?= i386 69 70# some corner cases 71CSU_DIR.i386 = csu/i386-elf 72BOOT_MACHINE_DIR.amd64 = boot/i386 73MACHINE_ARCH.host = ${_HOST_ARCH} 74 75# the list of machines we support 76ALL_MACHINE_LIST?= amd64 arm i386 ia64 mips pc98 powerpc sparc64 77.for m in ${ALL_MACHINE_LIST:O:u} 78MACHINE_ARCH_LIST.$m?= ${TARGET_ARCHES_${m}:U$m} 79MACHINE_ARCH.$m?= ${MACHINE_ARCH_LIST.$m:[1]} 80BOOT_MACHINE_DIR.$m ?= boot/$m 81.endfor 82.ifndef _TARGET_SPEC 83.if empty(MACHINE_ARCH) 84.if !empty(TARGET_ARCH) 85MACHINE_ARCH= ${TARGET_ARCH} 86.else 87MACHINE_ARCH= ${MACHINE_ARCH.${MACHINE}} 88.endif 89.endif 90MACHINE_ARCH?= ${MACHINE_ARCH.${MACHINE}} 91MACHINE_ARCH:= ${MACHINE_ARCH} 92.else 93# we got here via dirdeps 94MACHINE_ARCH:= ${MACHINE_ARCH.${MACHINE}} 95.endif 96 97.if ${.MAKE.LEVEL} == 0 98# 1st time only 99.-include <sys.env.mk> 100.if !empty(OBJROOT) 101.if ${OBJROOT:M*/} != "" 102OBJROOT:= ${OBJROOT:tA}/ 103.else 104OBJROOT:= ${OBJROOT:H:tA}/${OBJROOT:T} 105.endif 106.export OBJROOT 107.endif 108.endif 109 110# now because for universe we want to potentially 111# build for multiple MACHINE_ARCH per MACHINE 112# we need more than MACHINE in TARGET_SPEC 113TARGET_SPEC_VARS= MACHINE MACHINE_ARCH 114# see dirdeps.mk 115.if ${TARGET_SPEC:Uno:M*,*} != "" 116_tspec := ${TARGET_SPEC:S/,/ /g} 117MACHINE := ${_tspec:[1]} 118MACHINE_ARCH := ${_tspec:[2]} 119# etc. 120# We need to stop that TARGET_SPEC affecting any submakes 121# and deal with MACHINE=${TARGET_SPEC} in the environment. 122TARGET_SPEC= 123# export but do not track 124.export-env TARGET_SPEC 125.export ${TARGET_SPEC_VARS} 126.for v in ${TARGET_SPEC_VARS:O:u} 127.if empty($v) 128.undef $v 129.endif 130.endfor 131.endif 132# make sure we know what TARGET_SPEC is 133# as we may need it to find Makefile.depend* 134TARGET_SPEC = ${TARGET_SPEC_VARS:@v@${$v:U}@:ts,} 135 136# to be consistent with src/Makefile just concatenate with '.'s 137TARGET_OBJ_SPEC:= ${TARGET_SPEC:S;,;.;g} 138OBJTOP:= ${OBJROOT}${TARGET_OBJ_SPEC} 139 140.if !empty(SRCTOP) 141.if ${.CURDIR} == ${SRCTOP} 142RELDIR = . 143.elif ${.CURDIR:M${SRCTOP}/*} 144RELDIR := ${.CURDIR:S,${SRCTOP}/,,} 145.endif 146.endif 147 148HOST_OBJTOP ?= ${OBJROOT}${HOST_TARGET} 149 150.if ${OBJTOP} == ${HOST_OBJTOP} || ${REQUESTED_MACHINE:U${MACHINE}} == "host" 151MACHINE= host 152.if ${TARGET_MACHINE:Uno} == ${HOST_TARGET} 153# not what we want 154TARGET_MACHINE= host 155.endif 156.endif 157.if ${MACHINE} == "host" 158OBJTOP := ${HOST_OBJTOP} 159.endif 160 161# the logic in bsd.own.mk forces this dance 162.ifndef WITHOUT_META_MODE 163WITH_META_MODE= yes 164 165.ifndef WITHOUT_SYSROOT 166WITH_SYSROOT= yes 167.endif 168.ifndef WITHOUT_STAGING 169WITH_STAGING= yes 170.ifndef WITHOUT_STAGING_PROG 171WITH_STAGING_PROG= yes 172.endif 173.endif 174 175PYTHON ?= /usr/local/bin/python 176 177.if ${.MAKE.LEVEL} == 0 178# just in case -m, MAKESYSPATH or our default has .../ 179# export a sanitised version... 180# first any -m* from command line, 181# then any MAKESYSPATH and finally ${.PARSEDIR} 182_makesyspath:= ${.MAKEFLAGS:tW:S/ -m / -m/g:tw:M-m*:S,^-m,,} \ 183 ${MAKESYSPATH:U} \ 184 ${.PARSEDIR} 185# replace .../.* with ${.PARSEDIR}, not perfect but pretty close 186MAKESYSPATH:= ${_makesyspath:S,:, ,g:C,^\.\.\./.*,${.PARSEDIR},:u:ts:} 187.export MAKESYSPATH 188 189# this works best if share/mk is ready for it. 190BUILD_AT_LEVEL0= no 191# By default only MACHINE0 updates dependencies 192# see local.autodep.mk 193MACHINE0 := ${MACHINE} 194.export MACHINE0 195.export PYTHON 196.endif 197 198# we want to end up with a singe stage tree for all machines 199.ifndef WITHOUT_STAGING 200.if empty(STAGE_ROOT) 201STAGE_ROOT?= ${OBJROOT}stage 202.export STAGE_ROOT 203.endif 204.endif 205 206.if !empty(STAGE_ROOT) && !defined(WITHOUT_STAGING) 207.if ${MACHINE} == "host" 208STAGE_MACHINE= ${HOST_TARGET} 209.else 210STAGE_MACHINE:= ${TARGET_OBJ_SPEC} 211.endif 212STAGE_OBJTOP:= ${STAGE_ROOT}/${STAGE_MACHINE} 213STAGE_COMMON_OBJTOP:= ${STAGE_ROOT}/common 214STAGE_HOST_OBJTOP:= ${STAGE_ROOT}/${HOST_TARGET} 215 216STAGE_LIBDIR= ${STAGE_OBJTOP}${_LIBDIR:U${LIBDIR:U/lib}} 217# this is not the same as INCLUDEDIR 218STAGE_INCSDIR= ${STAGE_OBJTOP}${INCSDIR:U/include} 219# the target is usually an absolute path 220STAGE_SYMLINKS_DIR= ${STAGE_OBJTOP} 221 222.if ${MACHINE} == "host" && defined(EARLY_BUILD) 223# we literally want to build with host cc and includes 224.else 225.ifdef WITH_SYSROOT 226SYSROOT?= ${STAGE_OBJTOP}/ 227.endif 228LDFLAGS_LAST+= -Wl,-rpath-link -Wl,${STAGE_LIBDIR} 229STAGED_INCLUDE_DIR= ${STAGE_OBJTOP}/usr/include 230.endif 231.endif # EARLY_BUILD for host 232 233# this is sufficient for most of the tree. 234.MAKE.DEPENDFILE_DEFAULT = ${.MAKE.DEPENDFILE_PREFIX} 235 236# but if we have a machine qualified file it should be used in preference 237.MAKE.DEPENDFILE_PREFERENCE = \ 238 ${.MAKE.DEPENDFILE_PREFIX}.${MACHINE} \ 239 ${.MAKE.DEPENDFILE_PREFIX} 240 241.undef .MAKE.DEPENDFILE 242 243.include "sys.dependfile.mk" 244 245.include "meta.sys.mk" 246 247.if ${.MAKE.LEVEL} > 0 && ${MACHINE} == "host" && ${.MAKE.DEPENDFILE:E} != "host" 248# we can use this but should not update it. 249UPDATE_DEPENDFILE= NO 250.endif 251 252.MAKE.META.BAILIWICK = ${SB} ${OBJROOT} ${STAGE_ROOT} 253 254CSU_DIR.i386 = csu/i386-elf 255CSU_DIR.${MACHINE_ARCH} ?= csu/${MACHINE_ARCH} 256CSU_DIR := ${CSU_DIR.${MACHINE_ARCH}} 257 258.endif # meta mode 259 260# ensure we have a value 261.MAKE.MODE ?= normal 262 | |
263MAKE_PRINT_VAR_ON_ERROR+= \ 264 .CURDIR \ 265 .MAKE \ 266 .OBJDIR \ 267 .TARGETS \ 268 DESTDIR \ 269 LD_LIBRARY_PATH \ 270 MACHINE \ 271 MACHINE_ARCH \ 272 MAKEOBJDIRPREFIX \ 273 MAKESYSPATH \ 274 MAKE_VERSION\ | 46MAKE_PRINT_VAR_ON_ERROR+= \ 47 .CURDIR \ 48 .MAKE \ 49 .OBJDIR \ 50 .TARGETS \ 51 DESTDIR \ 52 LD_LIBRARY_PATH \ 53 MACHINE \ 54 MACHINE_ARCH \ 55 MAKEOBJDIRPREFIX \ 56 MAKESYSPATH \ 57 MAKE_VERSION\ |
58 SRCTOP \ |
|
275 OBJTOP \ 276 ${MAKE_PRINT_VAR_ON_ERROR_XTRAS} 277 278.if ${.MAKE.LEVEL} > 0 279MAKE_PRINT_VAR_ON_ERROR += .MAKE.MAKEFILES .PATH 280.endif 281 | 59 OBJTOP \ 60 ${MAKE_PRINT_VAR_ON_ERROR_XTRAS} 61 62.if ${.MAKE.LEVEL} > 0 63MAKE_PRINT_VAR_ON_ERROR += .MAKE.MAKEFILES .PATH 64.endif 65 |
282 | |
283# these are handy 284# we can use this for a cheap timestamp at the start of a target's script, 285# but not at the end - since make will expand both at the same time. | 66# these are handy 67# we can use this for a cheap timestamp at the start of a target's script, 68# but not at the end - since make will expand both at the same time. |
286AnEmptyVar= | |
287TIME_STAMP_FMT = @ %s [%Y-%m-%d %T] 288TIME_STAMP = ${TIME_STAMP_FMT:localtime} 289# this will produce the same output but as of when date(1) is run. 290TIME_STAMP_DATE = `date '+${TIME_STAMP_FMT}'` 291TIME_STAMP_END?= ${TIME_STAMP_DATE} 292 | 69TIME_STAMP_FMT = @ %s [%Y-%m-%d %T] 70TIME_STAMP = ${TIME_STAMP_FMT:localtime} 71# this will produce the same output but as of when date(1) is run. 72TIME_STAMP_DATE = `date '+${TIME_STAMP_FMT}'` 73TIME_STAMP_END?= ${TIME_STAMP_DATE} 74 |
293.ifdef WITH_TIMESTAMPS 294TRACER= ${TIME_STAMP} ${AnEmptyVar} 295.endif 296 297# toolchains can be a pain - especially bootstrappping them 298.if ${MACHINE} == "host" 299MK_SHARED_TOOLCHAIN= no 300.endif 301.ifdef WITH_TOOLSDIR 302TOOLSDIR?= ${HOST_OBJTOP}/tools 303.elif defined(STAGE_HOST_OBJTOP) && exists(${STAGE_HOST_OBJTOP}/usr/bin) 304TOOLSDIR?= ${STAGE_HOST_OBJTOP} 305.endif 306.if ${.MAKE.LEVEL} == 0 && exists(${TOOLSDIR}/usr/bin) 307PATH:= ${PATH:S,:, ,g:@d@${exists(${TOOLSDIR}$d):?${TOOLSDIR}$d:}@:ts:}:${PATH} 308.export PATH 309.if exists(${TOOLSDIR}/usr/bin/cc) 310HOST_CC?= ${TOOLSDIR}/usr/bin/cc 311.export HOST_CC 312.endif 313.endif 314 315.if ${MACHINE:Nhost:Ncommon} != "" && ${MACHINE} != ${HOST_MACHINE} 316# cross-building 317.if !defined(FREEBSD_REVISION) 318FREEBSD_REVISION!= sed -n '/^REVISION=/{s,.*=,,;s,",,g;p; }' ${SRCTOP}/sys/conf/newvers.sh 319.export FREEBSD_REVISION 320.endif 321CROSS_TARGET_FLAGS= -target ${MACHINE_ARCH}-unknown-freebsd${FREEBSD_REVISION} 322CFLAGS+= ${CROSS_TARGET_FLAGS} 323ACFLAGS+= ${CROSS_TARGET_FLAGS} 324LDFLAGS+= -Wl,-m -Wl,elf_${MACHINE_ARCH}_fbsd 325.endif 326 327.endif # bmake | |