Index: projects/bmake/share/mk/local.dirdeps.mk =================================================================== --- projects/bmake/share/mk/local.dirdeps.mk (revision 275338) +++ projects/bmake/share/mk/local.dirdeps.mk (revision 275339) @@ -1,88 +1,94 @@ .if !target(_DIRDEP_USE) # we are the 1st makefile .if !defined(MK_CLANG) .include "${SRCTOP}/share/mk/src.opts.mk" .endif # DEP_MACHINE is set before we get here, this may not be. DEP_RELDIR ?= ${RELDIR} .if ${.TARGETS:Uall:M*/*} && empty(DIRDEPS) # This little trick let's us do # # mk -f dirdeps.mk some/dir.i386,bsd # DIRDEPS := ${.TARGETS:M*/*} ${.TARGETS:Nall}: all .endif +# making universe is special +.if defined(UNIVERSE_GUARD) +# these should be done by now +DIRDEPS_FILTER+= N*.host +.endif + # pseudo machines get no qualification .for m in host common M_dep_qual_fixes += C;($m),[^/.,]*$$;\1; .endfor #.info M_dep_qual_fixes=${M_dep_qual_fixes} # we want to supress these dependencies for host tools # but some libs are sadly needed. _need_host_libs= \ lib/libc++ \ lib/libcxxrt \ lib/libdwarf \ N_host_libs:= ${cd ${SRCTOP} && echo lib/lib*:L:sh:${_need_host_libs:${M_ListToSkip}}:${M_ListToSkip}} DIRDEPS_FILTER.host = \ ${N_host_libs} \ Ninclude* \ Nlib/csu* \ Nlib/[mn]* \ Ngnu/lib/csu* \ Ngnu/lib/lib[a-r]* \ DIRDEPS_FILTER+= \ ${DIRDEPS_FILTER.xtras:U} .endif # reset this each time DIRDEPS_FILTER.xtras= .if ${DEP_MACHINE:Npkgs*} != "" DIRDEPS_FILTER.xtras+= Nusr.bin/clang/clang.host .endif .if ${DEP_MACHINE} != "host" # this is how we can handle optional dependencies .if ${DEP_RELDIR} == "lib/libc" DIRDEPS += lib/libc_nonshared .if ${MK_SSP:Uno} != "no" DIRDEPS += gnu/lib/libssp/libssp_nonshared .endif .else DIRDEPS_FILTER.xtras+= Nlib/libc_nonshared .endif # some optional things .if ${MK_CTF} == "yes" && ${DEP_RELDIR:Mcddl/usr.bin/ctf*} == "" DIRDEPS += \ cddl/usr.bin/ctfconvert.host \ cddl/usr.bin/ctfmerge.host .endif .endif .if ${MK_CLANG} == "yes" && ${DEP_RELDIR:Nlib/clang/lib*:Nlib/libc*} == "" DIRDEPS+= lib/clang/include .endif -# we need pkgs/pseudo/stage to prep the stage tree -.if ${DEP_RELDIR} != "pkgs/pseudo/stage" -DIRDEPS += pkgs/pseudo/stage +# we need targets/pseudo/stage to prep the stage tree +.if ${DEP_RELDIR} != "targets/pseudo/stage" +DIRDEPS += targets/pseudo/stage .endif CSU_DIR.i386 = csu/i386-elf DEP_MACHINE_ARCH = ${MACHINE_ARCH.${DEP_MACHINE}} CSU_DIR.${DEP_MACHINE_ARCH} ?= csu/${DEP_MACHINE_ARCH} CSU_DIR := ${CSU_DIR.${DEP_MACHINE_ARCH}} BOOT_MACHINE_DIR:= ${BOOT_MACHINE_DIR.${DEP_MACHINE}} KERNEL_NAME:= ${KERNEL_NAME.${DEP_MACHINE}} Index: projects/bmake/share/mk/local.gendirdeps.mk =================================================================== --- projects/bmake/share/mk/local.gendirdeps.mk (revision 275338) +++ projects/bmake/share/mk/local.gendirdeps.mk (revision 275339) @@ -1,36 +1,36 @@ # supress optional/auto dependecies # local.dirdeps.mk will put them in if necessary GENDIRDEPS_FILTER+= \ Ngnu/lib/libssp/libssp_nonshared \ Ncddl/usr.bin/ctf* \ Nlib/clang/include \ Nlib/libc_nonshared \ - Npkgs/pseudo/stage* \ + Ntargets/pseudo/stage* \ Ntools/* -.if ${RELDIR:Mpkgs*} == "" +.if ${RELDIR:Mtargets*} == "" GENDIRDEPS_FILTER+= \ Nusr.bin/clang/clang.host \ Ngnu/usr.bin/cc* \ .endif # gendirdeps.mk will turn _{VAR} into ${VAR} which keeps this simple # order of this list matters! GENDIRDEPS_FILTER_DIR_VARS+= \ CSU_DIR \ BOOT_MACHINE_DIR # order of this list matters! GENDIRDEPS_FILTER_VARS+= \ KERNEL_NAME \ MACHINE_CPUARCH \ MACHINE_ARCH \ MACHINE GENDIRDEPS_FILTER+= ${GENDIRDEPS_FILTER_DIR_VARS:@v@S,${$v},_{${v}},@} GENDIRDEPS_FILTER+= ${GENDIRDEPS_FILTER_VARS:@v@S,/${$v}/,/_{${v}}/,@:NS,//,*:u} # handle the non-standard way that gnu/usr.bin/groff/tmac is staged GENDIRDEPS_FILTER+= C,.*usr/share/tmac.*stage,gnu/usr.bin/groff/tmac, Index: projects/bmake/targets/Makefile =================================================================== --- projects/bmake/targets/Makefile (revision 275338) +++ projects/bmake/targets/Makefile (revision 275339) @@ -1,185 +1,178 @@ # $FreeBSD$ # This is the top-level makefile - derrived from the Junos version # # If a subdir that matches the requested target exists, we assume # a build target and initialize DIRDEPS, dirdeps.mk does the rest. # # Otherwise we include Makefile.xtras and hope it knows what to do. # # Copyright (c) 2010-2012, Juniper Networks, Inc. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # 1. Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # 2. Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the distribution. # # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .if ${.MAKE.LEVEL} == 0 # this is our top-level makefile .if make(pkg-*) -DIRDEPS_FILTER = Mpkgs/* +DIRDEPS_FILTER = Mtargets/* .endif # in theory, this is what we want -target_dirs = pkgs pkgs/pseudo +target_dirs = targets targets/pseudo # these tweak how we do it target_prefix = pkg- build- DIRDEPS := ${.TARGETS:Nall:${target_prefix:@p@S,^$p,,@:ts:}:@t@${target_dirs:@d@$d/$t@}@:@d@${exists(${SRCTOP}/$d):?$d:}@} -.if ${DIRDEPS:Mpkgs/pseudo/*} != "" +.if ${DIRDEPS:Mtargets/pseudo/*} != "" # all bets are off PKG_MACHINE_LIST = ${ALL_MACHINE_LIST} .endif .if make(check-commit) # a special case -DIRDEPS = pkgs/pseudo/check-commit +DIRDEPS = targets/pseudo/check-commit .if defined(ALL_MACHINES) CHECK_MACHINE_LIST = all .undef ALL_MACHINES .endif SHIPDIR = no .else all_machine_list = ${ALL_MACHINE_LIST} host common .if defined(ALL_MACHINES) DIRDEPS := ${DIRDEPS:O:u:@d@${all_machine_list:O:u:@m@${exists(${SRCTOP}/$d/${.MAKE.DEPENDFILE_PREFIX:T}.$m):?$d.$m:}@}@} .undef ALL_MACHINES PKG_MACHINE_LIST ?= ${DIRDEPS:E:O:u} .elif defined(HOST_MACHINE) && ${MACHINE} == ${HOST_MACHINE} # the above may be insufficient. # some packages only support one machine which may not be ${MACHINE} # some support multiple, in which case unless ALL_MACHINES is defined # we only want ${MACHINE} plain := ${DIRDEPS:@d@${exists(${SRCTOP}/$d/${.MAKE.DEPENDFILE_PREFIX:T}):?$d:}@} .if ${plain} != ${DIRDEPS} qual := ${DIRDEPS:${plain:${M_ListToSkip}}:@d@${all_machine_list:O:u:@m@${exists(${SRCTOP}/$d/${.MAKE.DEPENDFILE_PREFIX:T}.$m):?$d.$m:}@}@} DIRDEPS := ${plain} ${qual} PKG_MACHINE_LIST ?= ${MACHINE} ${qual:E:O:u} .endif .else # check that a .MAKE.DEPENDFILE exists DIRDEPS := ${.MAKE.DEPENDFILE_PREFERENCE:T:@m@${DIRDEPS:@d@${exists(${SRCTOP}/$d/$m):?$d:}@}@:O:u} .endif .if !empty(PKG_MACHINE_LIST) .if ${PKG_MACHINE_LIST:Mdepend} != "" PKG_MACHINE_LIST = ${ALL_MACHINE_LIST} .endif PKG_MACHINE_LIST := ${PKG_MACHINE_LIST} .endif .endif # we don't use DIRDEPS_FILTER, since we only want it to # apply to this initial list .if !empty(REQUESTED_MACHINE) && !empty(DIRDEPS) # this is a variant of the logic above, we want plain # but need to filter the qualified DIRDEPS to REQUESTED_MACHINE plain := ${DIRDEPS:@d@${exists(${SRCTOP}/$d/${.MAKE.DEPENDFILE_PREFIX:T}):?$d:}@} .if ${plain} != ${DIRDEPS} qual := ${DIRDEPS:${plain:${M_ListToSkip}}:M*.${REQUESTED_MACHINE}} .if empty(qual) qual := ${DIRDEPS:@d@${exists(${SRCTOP}/$d/${.MAKE.DEPENDFILE:T}):?$d.${.MAKE.DEPENDFILE:E}:}@} .endif DIRDEPS := ${plain} ${qual} .endif .if empty(DIRDEPS) .error ${REQUESTED_MACHINE} is not appropriate for ${DEP_RELDIR:T} .endif .endif .if !empty(build_options) build_options := ${build_options:O:u} .for v in ${build_options} $v = yes .endfor .export ${build_options} .endif .if !empty(DIRDEPS) # This is printed as we read the makefile # so provides a useful clue as to when we really started. # This allows us to work out how long reading # Makefile.depend* takes. .if ${.MAKEFLAGS:M-V} == "" .info ${.newline}${TIME_STAMP} Start ${.TARGETS} now_utc = ${%s:L:gmtime} start_utc := ${now_utc} .endif _begin = count-makefiles -# by default, we clean pkgs/ which can otherwise accumulate a lot of cruft -.if ${NEED_CLEAN_PKGS:Uyes:tl} != "no" -_begin += clean-pkgs -.endif -.if defined(SHIPDIR) && ${NEED_CLEAN_SHIPDIR:Uno:tl} != "no" && exists(${SHIPDIR}) -_begin += clean-shipdir -.endif -.if ${NEED_CLEAN_ERROR_LOGS:Uyes:tl} == "yes" +__DEFAULT_YES_OPTIONS+= \ + CLEAN_ERROR_LOGS + +.include + +.if ${MK_CLEAN_ERROR_LOGS} == "yes" _begin += clean-error-logs .endif + .if !empty(_begin) && !make(clean*) dirdeps: ${_begin} .WAIT .endif .include "Makefile.inc" .include .for t in ${.TARGETS:Nall:Nclean*:${_begin:Uall:${M_ListToSkip}}} $t: dirdeps .endfor elapsed_time= seconds=`expr ${now_utc} - ${start_utc}` count-makefiles: .NOMETA @echo "${TIME_STAMP} Makefiles read: total=${.MAKE.MAKEFILES:[#]} depend=${.MAKE.MAKEFILES:M*depend*:[#]} dirdeps=${.ALLTARGETS:M${SRCTOP}*:O:u:[#]} ${elapsed_time}" .END: _build_finish _build_finish: .NOMETA @echo "${TIME_STAMP} Finished ${.TARGETS} ${elapsed_time}" .ERROR: _build_failed _build_failed: .NOMETA @echo "${TIME_STAMP} Failed ${.TARGETS} ${elapsed_time}" .endif # !empty(DIRDEPS) clean-error-logs: .NOMETA @test ! -d ${meta_error_log:H} || rm -f ${meta_error_log:H}/*log - -clean-pkgs: .NOMETA - @rm -rf ${ALL_MACHINE_LIST:N${MACHINE}:@m@${OBJROOT}$m/pkgs@} ${OBJROOT}${MACHINE}/pkgs/* - -clean-shipdir: .NOMETA - ${"${SHIPDIR:tl:Nno:N*\:*}":?rm -f ${SHIPDIR}/*:} .if !target(_DIRDEP_USE) # we did not read dirdeps.mk above, the target may be here .include "Makefile.xtras" .endif .else # dirdeps does it all all: .endif # .MAKE.LEVEL == 0 Index: projects/bmake/targets/Makefile.inc =================================================================== --- projects/bmake/targets/Makefile.inc (revision 275338) +++ projects/bmake/targets/Makefile.inc (revision 275339) @@ -1,53 +1,53 @@ # $FreeBSD$ .if !target(__${_this}__) __${_this}__: _CURDIR ?= ${.CURDIR} _OBJDIR ?= ${.OBJDIR} -.if ${RELDIR:Mpkgs/*} != "" || ${RELDIR} == "." +.if ${RELDIR:Mtargets/*} != "" || ${RELDIR} == "." -.if ${.MAKE.LEVEL} == 0 && ${RELDIR:Mpkgs/*} != "" +.if ${.MAKE.LEVEL} == 0 && ${RELDIR:Mtargets/*} != "" .if make(bootstrap*) || !exists(${_CURDIR}/${.MAKE.DEPENDFILE:T}) _bootstrap_dirdeps = yes .else # BUILD_AT_LEVEL0=no tells dirdeps.mk to use a sub-make for .CURDIR # This is useful if we need to leverage DIRDEPS BUILD_AT_LEVEL0 = no # this renders the rest harmless PKG_METHOD = no .endif .endif # The makefile in subdirs should set this to something useful # the default should do nothing. PKG_METHOD ?= none .MAIN: all .if ${build-*:${M_L_TARGETS}} != "" # just build the bits, skip packaging all: SHIPDIR = no .if ${RELDIR} != "." PKG_METHOD = no .endif .endif .if ${PKG_METHOD:Mno*} != "" all: ${PKG_METHOD} # set this to "no" for manual control UPDATE_DEPENDFILE ?= yes .endif .if ${UPDATE_DEPENDFILE:Uno} == "yes" .include .endif # all the clever packaging methods go here.... .endif # level 0 .endif # _this Index: projects/bmake/targets/pseudo/the-lot/Makefile.depend =================================================================== --- projects/bmake/targets/pseudo/the-lot/Makefile.depend (revision 275338) +++ projects/bmake/targets/pseudo/the-lot/Makefile.depend (revision 275339) @@ -1,12 +1,12 @@ # $FreeBSD$ # This file is not autogenerated - take care! DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} DIRDEPS = \ - pkgs/pseudo/kernel \ - pkgs/pseudo/toolchain \ - pkgs/pseudo/userland \ + targets/pseudo/kernel \ + targets/pseudo/toolchain \ + targets/pseudo/userland \ .include Index: projects/bmake/targets/pseudo/toolchain/Makefile.depend =================================================================== --- projects/bmake/targets/pseudo/toolchain/Makefile.depend (revision 275338) +++ projects/bmake/targets/pseudo/toolchain/Makefile.depend (revision 275339) @@ -1,19 +1,19 @@ # $FreeBSD$ # This file is not autogenerated - take care! DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} .if !defined(MK_CLANG) .include "${SRCTOP}/share/mk/src.opts.mk" .endif DIRDEPS= usr.bin/xinstall .if ${MK_CLANG} == "yes" -DIRDEPS+= pkgs/pseudo/clang +DIRDEPS+= targets/pseudo/clang .endif .if ${MK_GCC} == "yes" -DIRDEPS+= pkgs/pseudo/gcc +DIRDEPS+= targets/pseudo/gcc .endif .include Index: projects/bmake/targets/pseudo/universe/Makefile =================================================================== --- projects/bmake/targets/pseudo/universe/Makefile (revision 275338) +++ projects/bmake/targets/pseudo/universe/Makefile (revision 275339) @@ -1,73 +1,73 @@ # $FreeBSD$ # This target is "special". # # The actual work is done via another target; # UNIVERSE_TARGET_RELDIR is used to identify it. # # We leverage dirdeps.mk to run a sub-make per # MACHINE/ARCH to each build ${UNIVERSE_TARGET_RELDIR} # in meta mode. # # We simply override the level at which dirdeps.mk normally does # its thing, and give it a DIRDEPS list that corresponds to # ${UNIVERSE_TARGET_RELDIR}.${TARGET_SPEC} for each TARGET_SPEC we # want. # # This allows the computation of dependencies for each ${TARGET_SPEC} # to happen in parallel - avoiding a very long startup time. # We can even export each sub-make to a different machine if using a # cluster. # # The above works fine so long as our sub-makes remain independent. # That is; none of them attempts to visit any directory for a machine # other than the TARGET_SPEC we gave it. # For example; to build some tool for the pseudo machine "host". # To avoid that, our Makefile.depend lists all the hosttools we might # need and these will thus be built before we launch the # ${UNIVERSE_TARGET_RELDIR} sub-makes. # Further we add a filter to skip any "host" dirdeps during those # sub-makes. # # # this is the RELDIR of the target we build -UNIVERSE_TARGET_RELDIR?= pkgs/pseudo/the-lot +UNIVERSE_TARGET_RELDIR?= targets/pseudo/the-lot # the list of machines TARGET_MACHINE_LIST = i386 amd64 # some machines have more than one arch TARGET_ARCHES_arm?= arm armeb armv6 armv6hf # avoid ../Makefile.inc defining this all: .include "../Makefile.inc" .if ${.MAKE.LEVEL} > 0 # ok our prerequisites have been built .if !defined(UNIVERSE_GUARD) # just incase we end up back here, # we cannot rely on .MAKE.LEVEL as we normally would UNIVERSE_GUARD=1 .export UNIVERSE_GUARD # we want to re-use dirdeps _DIRDEP_USE_LEVEL = ${.MAKE.LEVEL} # we want our sub-makes to think they are level 0 # and we don't want failure of one to stop all. DIRDEP_USE_ENV= \ MAKELEVEL=0 \ MAKE_JOB_ERROR_TOKEN=no _target_specs:= ${TARGET_MACHINE_LIST:@m@${TARGET_ARCHES_$m:U$m:@a@$m,$a@}@:O:u} DIRDEPS:= ${_target_specs:@t@${UNIVERSE_TARGET_RELDIR}.$t@} all: dirdeps .include .endif .endif Index: projects/bmake/targets/pseudo/universe/Makefile.depend =================================================================== --- projects/bmake/targets/pseudo/universe/Makefile.depend (revision 275338) +++ projects/bmake/targets/pseudo/universe/Makefile.depend (revision 275339) @@ -1,15 +1,15 @@ # $FreeBSD$ # This file is not autogenerated - take care! # this is not normally needed, but we are not normal .if ${.MAKE.LEVEL} == 0 DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} # our role here is to build all the host tools etc. DIRDEPS = \ - pkgs/pseudo/hosttools.host \ + targets/pseudo/hosttools.host \ .include .endif Index: projects/bmake/targets/pseudo/userland/Makefile.depend =================================================================== --- projects/bmake/targets/pseudo/userland/Makefile.depend (revision 275338) +++ projects/bmake/targets/pseudo/userland/Makefile.depend (revision 275339) @@ -1,24 +1,24 @@ # $FreeBSD$ # This file is not autogenerated - take care! DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} DEP_MACHINE := ${.PARSEFILE:E} DIRDEPS = \ - pkgs/pseudo/bin \ - pkgs/pseudo/cddl \ - pkgs/pseudo/games \ - pkgs/pseudo/gnu \ - pkgs/pseudo/include \ - pkgs/pseudo/kerberos5 \ - pkgs/pseudo/lib \ - pkgs/pseudo/libexec \ - pkgs/pseudo/sbin \ - pkgs/pseudo/secure \ - pkgs/pseudo/share \ - pkgs/pseudo/usr.bin \ - pkgs/pseudo/usr.sbin \ + targets/pseudo/bin \ + targets/pseudo/cddl \ + targets/pseudo/games \ + targets/pseudo/gnu \ + targets/pseudo/include \ + targets/pseudo/kerberos5 \ + targets/pseudo/lib \ + targets/pseudo/libexec \ + targets/pseudo/sbin \ + targets/pseudo/secure \ + targets/pseudo/share \ + targets/pseudo/usr.bin \ + targets/pseudo/usr.sbin \ .include