Index: head/share/mk/bsd.confs.mk =================================================================== --- head/share/mk/bsd.confs.mk (revision 289330) +++ head/share/mk/bsd.confs.mk (revision 289331) @@ -1,90 +1,87 @@ # $FreeBSD$ .if !target(____) .error bsd.conf.mk cannot be included directly. .endif .if ${MK_INCLUDES} != "no" CONFGROUPS?= CONFS .if !target(buildconfig) .for group in ${CONFSGROUPS} buildconfig: ${${group}} .endfor .endif all: buildconfig .if !target(installconfig) .for group in ${CONFGROUPS} .if defined(${group}) && !empty(${group}) ${group}OWN?= ${SHAREOWN} ${group}GRP?= ${SHAREGRP} ${group}MODE?= ${CONFMODE} ${group}DIR?= ${CONFIGDIR}/ STAGE_SETS+= ${group} STAGE_DIR.${group}= ${STAGE_OBJTOP}${${group}DIR} STAGE_SYMLINKS_DIR.${group}= ${STAGE_OBJTOP} _${group}CONFS= .for cnf in ${${group}} .if defined(${group}OWN_${cnf:T}) || defined(${group}GRP_${cnf:T}) || \ defined(${group}MODE_${cnf:T}) || defined(${group}DIR_${cnf:T}) || \ defined(${group}NAME_${cnf:T}) || defined(${group}NAME) ${group}OWN_${cnf:T}?= ${${group}OWN} ${group}GRP_${cnf:T}?= ${${group}GRP} ${group}MODE_${cnf:T}?= ${${group}MODE} ${group}DIR_${cnf:T}?= ${${group}DIR} .if defined(${group}NAME) ${group}NAME_${cnf:T}?= ${${group}NAME} .else ${group}NAME_${cnf:T}?= ${cnf:T} .endif STAGE_AS_SETS+= ${cnf:T} STAGE_AS_${cnf:T}= ${${group}NAME_${cnf:T}} # XXX {group}OWN,GRP,MODE STAGE_DIR.${cnf:T}= ${STAGE_OBJTOP}${${group}DIR_${cnf:T}} stage_as.${cnf:T}: ${cnf} stage_config: stage_as.${cnf:T} installconfig: _${group}INS_${cnf:T} _${group}INS_${cnf:T}: ${cnf} ${INSTALL} -C -o ${${group}OWN_${.ALLSRC:T}} \ -g ${${group}GRP_${.ALLSRC:T}} -m ${${group}MODE_${.ALLSRC:T}} \ ${.ALLSRC} \ ${DESTDIR}${${group}DIR_${.ALLSRC:T}}/${${group}NAME_${.ALLSRC:T}} .else _${group}CONFS+= ${cnf} .endif .endfor .if !empty(_${group}CONFS) stage_files.${group}: ${_${group}CONFS} stage_config: stage_files.${group} installconfig: _${group}INS _${group}INS: ${_${group}CONFS} .if defined(${group}NAME) ${INSTALL} -C -o ${${group}OWN} -g ${${group}GRP} -m ${${group}MODE} \ ${.ALLSRC} ${DESTDIR}${${group}DIR}/${${group}NAME} .else ${INSTALL} -C -o ${${group}OWN} -g ${${group}GRP} -m ${${group}MODE} \ ${.ALLSRC} ${DESTDIR}${${group}DIR} .endif .endif .endif # defined(${group}) && !empty(${group}) .endfor .endif # !target(installconfig) .if ${MK_STAGING} != "no" && !defined(_SKIP_BUILD) .if !defined(NO_STAGE_CONFIG) STAGE_TARGETS+= stage_config .endif .endif -config: buildconfig installconfig -.ORDER: buildconfig installconfig - .endif # ${MK_INCLUDES} != "no" Index: head/share/mk/bsd.files.mk =================================================================== --- head/share/mk/bsd.files.mk (revision 289330) +++ head/share/mk/bsd.files.mk (revision 289331) @@ -1,100 +1,97 @@ # $FreeBSD$ .if !target(____) .error bsd.files.mk cannot be included directly. .endif .if !target(____) ____: FILESGROUPS?= FILES .for group in ${FILESGROUPS} # Add in foo.yes and remove duplicates from all the groups ${${group}}:= ${${group}} ${${group}.yes} ${${group}}:= ${${group}:O:u} buildfiles: ${${group}} .endfor all: buildfiles .for group in ${FILESGROUPS} .if defined(${group}) && !empty(${group}) installfiles: installfiles-${group} ${group}OWN?= ${SHAREOWN} ${group}GRP?= ${SHAREGRP} ${group}MODE?= ${SHAREMODE} ${group}DIR?= ${BINDIR} .if !make(buildincludes) STAGE_SETS+= ${group} .endif STAGE_DIR.${group}= ${STAGE_OBJTOP}${${group}DIR} STAGE_SYMLINKS_DIR.${group}= ${STAGE_OBJTOP} _${group}FILES= .for file in ${${group}} .if defined(${group}OWN_${file:T}) || defined(${group}GRP_${file:T}) || \ defined(${group}MODE_${file:T}) || defined(${group}DIR_${file:T}) || \ defined(${group}NAME_${file:T}) ${group}OWN_${file:T}?= ${${group}OWN} ${group}GRP_${file:T}?= ${${group}GRP} ${group}MODE_${file:T}?= ${${group}MODE} ${group}DIR_${file:T}?= ${${group}DIR} .if defined(${group}NAME) ${group}NAME_${file:T}?= ${${group}NAME} .else ${group}NAME_${file:T}?= ${file:T} .endif .if !make(buildincludes) STAGE_AS_SETS+= ${file:T} .endif STAGE_AS_${file:T}= ${${group}NAME_${file:T}} # XXX {group}OWN,GRP,MODE STAGE_DIR.${file:T}= ${STAGE_OBJTOP}${${group}DIR_${file:T}} stage_as.${file:T}: ${file} installfiles-${group}: _${group}INS_${file:T} _${group}INS_${file:T}: ${file} ${INSTALL} -o ${${group}OWN_${.ALLSRC:T}} \ -g ${${group}GRP_${.ALLSRC:T}} -m ${${group}MODE_${.ALLSRC:T}} \ ${.ALLSRC} \ ${DESTDIR}${${group}DIR_${.ALLSRC:T}}/${${group}NAME_${.ALLSRC:T}} .else _${group}FILES+= ${file} .endif .endfor .if !empty(_${group}FILES) stage_files.${group}: ${_${group}FILES} installfiles-${group}: _${group}INS _${group}INS: ${_${group}FILES} .if defined(${group}NAME) ${INSTALL} -o ${${group}OWN} -g ${${group}GRP} \ -m ${${group}MODE} ${.ALLSRC} \ ${DESTDIR}${${group}DIR}/${${group}NAME} .else ${INSTALL} -o ${${group}OWN} -g ${${group}GRP} \ -m ${${group}MODE} ${.ALLSRC} ${DESTDIR}${${group}DIR} .endif .endif .endif # defined(${group}) && !empty(${group}) .endfor realinstall: installfiles .ORDER: beforeinstall installfiles .if ${MK_STAGING} != "no" .if !empty(STAGE_SETS) buildfiles: stage_files .if !empty(STAGE_AS_SETS) buildfiles: stage_as .endif .endif .endif -files: buildfiles installfiles -.ORDER: buildfiles installfiles - .endif # !target(____) Index: head/share/mk/bsd.incs.mk =================================================================== --- head/share/mk/bsd.incs.mk (revision 289330) +++ head/share/mk/bsd.incs.mk (revision 289331) @@ -1,105 +1,102 @@ # $FreeBSD$ .if !target(____) .error bsd.incs.mk cannot be included directly. .endif .if ${MK_INCLUDES} != "no" INCSGROUPS?= INCS .if !target(buildincludes) .for group in ${INCSGROUPS} buildincludes: ${${group}} .endfor .endif all: buildincludes .if !target(installincludes) .for group in ${INCSGROUPS} .if defined(${group}) && !empty(${group}) ${group}OWN?= ${BINOWN} ${group}GRP?= ${BINGRP} ${group}MODE?= ${NOBINMODE} ${group}DIR?= ${INCLUDEDIR}${PRIVATELIB:D/private/${LIB}} STAGE_SETS+= ${group} STAGE_DIR.${group}= ${STAGE_OBJTOP}${${group}DIR} STAGE_SYMLINKS_DIR.${group}= ${STAGE_OBJTOP} _${group}INCS= .for header in ${${group}} .if defined(${group}OWN_${header:T}) || defined(${group}GRP_${header:T}) || \ defined(${group}MODE_${header:T}) || defined(${group}DIR_${header:T}) || \ defined(${group}NAME_${header:T}) || defined(${group}NAME) ${group}OWN_${header:T}?= ${${group}OWN} ${group}GRP_${header:T}?= ${${group}GRP} ${group}MODE_${header:T}?= ${${group}MODE} ${group}DIR_${header:T}?= ${${group}DIR} .if defined(${group}NAME) ${group}NAME_${header:T}?= ${${group}NAME} .else ${group}NAME_${header:T}?= ${header:T} .endif STAGE_AS_SETS+= ${header:T} STAGE_AS_${header:T}= ${${group}NAME_${header:T}} # XXX {group}OWN,GRP,MODE STAGE_DIR.${header:T}= ${STAGE_OBJTOP}${${group}DIR_${header:T}} stage_as.${header:T}: ${header} stage_includes: stage_as.${header:T} installincludes: _${group}INS_${header:T} _${group}INS_${header:T}: ${header} ${INSTALL} -C -o ${${group}OWN_${.ALLSRC:T}} \ -g ${${group}GRP_${.ALLSRC:T}} -m ${${group}MODE_${.ALLSRC:T}} \ ${.ALLSRC} \ ${DESTDIR}${${group}DIR_${.ALLSRC:T}}/${${group}NAME_${.ALLSRC:T}} .else _${group}INCS+= ${header} .endif .endfor .if !empty(_${group}INCS) stage_files.${group}: ${_${group}INCS} stage_includes: stage_files.${group} installincludes: _${group}INS _${group}INS: ${_${group}INCS} .if defined(${group}NAME) ${INSTALL} -C -o ${${group}OWN} -g ${${group}GRP} -m ${${group}MODE} \ ${.ALLSRC} ${DESTDIR}${${group}DIR}/${${group}NAME} .else ${INSTALL} -C -o ${${group}OWN} -g ${${group}GRP} -m ${${group}MODE} \ ${.ALLSRC} ${DESTDIR}${${group}DIR} .endif .endif .endif # defined(${group}) && !empty(${group}) .endfor .if defined(INCSLINKS) && !empty(INCSLINKS) installincludes: .for s t in ${INCSLINKS} @${ECHO} "$t -> $s" ; \ ${INSTALL_SYMLINK} $s ${DESTDIR}$t .endfor .endif .endif # !target(installincludes) realinstall: installincludes .ORDER: beforeinstall installincludes .if ${MK_STAGING} != "no" && !defined(_SKIP_BUILD) .if !defined(NO_STAGE_INCLUDES) STAGE_TARGETS+= stage_includes .if !empty(INCSLINKS) STAGE_TARGETS+= stage_symlinks STAGE_SYMLINKS.INCS= ${INCSLINKS} .endif .endif .endif -includes: buildincludes installincludes -.ORDER: buildincludes installincludes - .endif # ${MK_INCLUDES} != "no" Index: head/share/mk/bsd.subdir.mk =================================================================== --- head/share/mk/bsd.subdir.mk (revision 289330) +++ head/share/mk/bsd.subdir.mk (revision 289331) @@ -1,142 +1,156 @@ # from: @(#)bsd.subdir.mk 5.9 (Berkeley) 2/1/91 # $FreeBSD$ # # The include file contains the default targets # for building subdirectories. # # For all of the directories listed in the variable SUBDIRS, the # specified directory will be visited and the target made. There is # also a default target which allows the command "make subdir" where # subdir is any directory listed in the variable SUBDIRS. # # # +++ variables +++ # # DISTRIBUTION Name of distribution. [base] # # SUBDIR A list of subdirectories that should be built as well. # Each of the targets will execute the same target in the # subdirectories. SUBDIR.yes is automatically appeneded # to this list. # # +++ targets +++ # # distribute: # This is a variant of install, which will # put the stuff into the right "distribution". # # See ALL_SUBDIR_TARGETS for list of targets that will recurse. # Custom targets can be added to SUBDIR_TARGETS in src.conf. # .if !target(____) ____: -ALL_SUBDIR_TARGETS= all all-man buildconfig buildfiles buildincludes \ - checkdpadd clean cleandepend cleandir cleanilinks \ - cleanobj config depend distribute files includes \ - installconfig installfiles installincludes lint \ - maninstall manlint obj objlink realinstall regress tags \ - ${SUBDIR_TARGETS} +ALL_SUBDIR_TARGETS= all all-man checkdpadd clean cleandepend cleandir \ + cleanilinks cleanobj depend distribute lint maninstall manlint obj \ + objlink realinstall regress tags ${SUBDIR_TARGETS} .include .if !defined(NEED_SUBDIR) .if ${.MAKE.LEVEL} == 0 && ${MK_META_MODE} == "yes" && !empty(SUBDIR) && !(make(clean*) || make(destroy*)) .include # ignore this _SUBDIR: .endif .endif .if !target(_SUBDIR) .if defined(SUBDIR) SUBDIR:=${SUBDIR} ${SUBDIR.yes} SUBDIR:=${SUBDIR:u} .endif DISTRIBUTION?= base .if !target(distribute) distribute: .MAKE .for dist in ${DISTRIBUTION} ${_+_}cd ${.CURDIR}; \ ${MAKE} install -DNO_SUBDIR DESTDIR=${DISTDIR}/${dist} SHARED=copies .endfor .endif _SUBDIR: .USE .MAKE .if defined(SUBDIR) && !empty(SUBDIR) && !defined(NO_SUBDIR) @${_+_}for entry in ${SUBDIR:N.WAIT}; do \ if test -d ${.CURDIR}/$${entry}.${MACHINE_ARCH}; then \ ${ECHODIR} "===> ${DIRPRFX}$${entry}.${MACHINE_ARCH} (${.TARGET:S,realinstall,install,:S,^_sub.,,})"; \ edir=$${entry}.${MACHINE_ARCH}; \ cd ${.CURDIR}/$${edir}; \ else \ ${ECHODIR} "===> ${DIRPRFX}$$entry (${.TARGET:S,realinstall,install,:S,^_sub.,,})"; \ edir=$${entry}; \ cd ${.CURDIR}/$${edir}; \ fi; \ ${MAKE} ${.TARGET:S,realinstall,install,:S,^_sub.,,} \ DIRPRFX=${DIRPRFX}$$edir/; \ done .endif ${SUBDIR:N.WAIT}: .PHONY .MAKE ${_+_}@if test -d ${.TARGET}.${MACHINE_ARCH}; then \ cd ${.CURDIR}/${.TARGET}.${MACHINE_ARCH}; \ else \ cd ${.CURDIR}/${.TARGET}; \ fi; \ ${MAKE} all # Work around parsing of .if nested in .for by putting .WAIT string into a var. __wait= .WAIT .for __target in ${ALL_SUBDIR_TARGETS} .ifdef SUBDIR_PARALLEL __subdir_targets= .for __dir in ${SUBDIR} .if ${__wait} == ${__dir} __subdir_targets+= .WAIT .else __subdir_targets+= ${__target}_subdir_${__dir} __deps= .for __dep in ${SUBDIR_DEPEND_${__dir}} __deps+= ${__target}_subdir_${__dep} .endfor ${__target}_subdir_${__dir}: .MAKE ${__deps} .if !defined(NO_SUBDIR) @${_+_}if test -d ${.CURDIR}/${__dir}.${MACHINE_ARCH}; then \ ${ECHODIR} "===> ${DIRPRFX}${__dir}.${MACHINE_ARCH} (${__target:realinstall=install})"; \ edir=${__dir}.${MACHINE_ARCH}; \ cd ${.CURDIR}/$${edir}; \ else \ ${ECHODIR} "===> ${DIRPRFX}${__dir} (${__target:realinstall=install})"; \ edir=${__dir}; \ cd ${.CURDIR}/$${edir}; \ fi; \ ${MAKE} ${__target:realinstall=install} \ DIRPRFX=${DIRPRFX}$$edir/ .endif .endif .endfor ${__target}: ${__subdir_targets} .else ${__target}: _sub.${__target} _sub.${__target}: _SUBDIR +.endif +.endfor + +# This is to support 'make includes' calling 'make buildincludes' and +# 'make installincludes' in the proper order, and to support these +# targets as SUBDIR_TARGETS. +.for __target in files includes config +.for __stage in build install +${__stage}${__target}: +.if make(${__stage}${__target}) +${__stage}${__target}: _sub.${__stage}${__target} +_sub.${__stage}${__target}: _SUBDIR +.endif +.endfor +.if !target(${__target}) +${__target}: .MAKE + ${_+_}cd ${.CURDIR}; ${MAKE} build${__target}; ${MAKE} install${__target} .endif .endfor .endif .if !target(install) .if !target(beforeinstall) beforeinstall: .endif .if !target(afterinstall) afterinstall: .endif install: beforeinstall realinstall afterinstall .ORDER: beforeinstall realinstall afterinstall .endif .endif