Index: head/share/mk/bsd.progs.mk =================================================================== --- head/share/mk/bsd.progs.mk (revision 296121) +++ head/share/mk/bsd.progs.mk (revision 296122) @@ -1,132 +1,140 @@ # $FreeBSD$ # $Id: progs.mk,v 1.11 2012/11/06 17:18:54 sjg Exp $ # # @(#) Copyright (c) 2006, Simon J. Gerraty # # This file is provided in the hope that it will # be of use. There is absolutely NO WARRANTY. # Permission to copy, redistribute or otherwise # use this file is hereby granted provided that # the above copyright notice and this notice are # left intact. # # Please send copies of changes and bug-fixes to: # sjg@crufty.net # .MAIN: all .if defined(PROGS) || defined(PROGS_CXX) # we really only use PROGS below... PROGS += ${PROGS_CXX} # In meta mode, we can capture dependenices for _one_ of the progs. # if makefile doesn't nominate one, we use the first. .ifndef UPDATE_DEPENDFILE_PROG UPDATE_DEPENDFILE_PROG = ${PROGS:[1]} .export UPDATE_DEPENDFILE_PROG .endif .if defined(PROG) # just one of many PROG_OVERRIDE_VARS += BINDIR BINGRP BINOWN BINMODE DPSRCS MAN NO_WERROR \ PROGNAME SRCS WARNS PROG_VARS += CFLAGS CPPFLAGS CXXFLAGS DPADD DPLIBS LDADD LIBADD LINKS \ LDFLAGS MLINKS ${PROG_OVERRIDE_VARS} .for v in ${PROG_VARS:O:u} .if empty(${PROG_OVERRIDE_VARS:M$v}) .if defined(${v}.${PROG}) $v += ${${v}.${PROG}} .elif defined(${v}_${PROG}) $v += ${${v}_${PROG}} .endif .else $v ?= .endif .endfor # for meta mode, there can be only one! .if ${PROG} == ${UPDATE_DEPENDFILE_PROG} UPDATE_DEPENDFILE ?= yes .endif UPDATE_DEPENDFILE ?= NO # prog.mk will do the rest .else # !defined(PROG) .if !defined(_SKIP_BUILD) all: ${PROGS} .endif # We cannot capture dependencies for meta mode here UPDATE_DEPENDFILE = NO + +.if ${MK_STAGING} != "no" +.if !empty(PROGS) +stage_files.prog: ${PROGS} .endif +.endif # ${MK_STAGING} != "no" +.endif .endif # PROGS || PROGS_CXX # These are handled by the main make process. .ifdef _RECURSING_PROGS +MK_STAGING= no + _PROGS_GLOBAL_VARS= CLEANFILES CLEANDIRS CONFGROUPS FILESGROUPS INCSGROUPS \ SCRIPTS .for v in ${_PROGS_GLOBAL_VARS} $v = .endfor .endif # handle being called [bsd.]progs.mk .include .if !empty(PROGS) && !defined(_RECURSING_PROGS) && !defined(PROG) # tell progs.mk we might want to install things PROGS_TARGETS+= checkdpadd clean cleandepend cleandir depend install # Find common sources among the PROGS and depend on them before building # anything. This allows parallelization without them each fighting over # the same objects. _PROGS_COMMON_SRCS= _PROGS_ALL_SRCS= .for p in ${PROGS} .for s in ${SRCS.${p}} .if ${_PROGS_ALL_SRCS:M${s}} && !${_PROGS_COMMON_SRCS:M${s}} _PROGS_COMMON_SRCS+= ${s} .else _PROGS_ALL_SRCS+= ${s} .endif .endfor .endfor .if !empty(_PROGS_COMMON_SRCS) _PROGS_COMMON_OBJS= ${_PROGS_COMMON_SRCS:M*.[dhly]} .if !empty(_PROGS_COMMON_SRCS:N*.[dhly]) _PROGS_COMMON_OBJS+= ${_PROGS_COMMON_SRCS:N*.[dhly]:R:S/$/.o/g} .endif ${PROGS}: ${_PROGS_COMMON_OBJS} .endif .for p in ${PROGS} .if defined(PROGS_CXX) && !empty(PROGS_CXX:M$p) # bsd.prog.mk may need to know this x.$p= PROG_CXX=$p .endif # Main PROG target $p ${p}_p: .PHONY .MAKE (cd ${.CURDIR} && \ DEPENDFILE=.depend.$p \ NO_SUBDIR=1 ${MAKE} -f ${MAKEFILE} _RECURSING_PROGS=t \ PROG=$p ${x.$p}) # Pseudo targets for PROG, such as 'install'. .for t in ${PROGS_TARGETS:O:u} $p.$t: .PHONY .MAKE (cd ${.CURDIR} && \ DEPENDFILE=.depend.$p \ NO_SUBDIR=1 ${MAKE} -f ${MAKEFILE} _RECURSING_PROGS=t \ PROG=$p ${x.$p} ${@:E}) .endfor .endfor # Depend main pseudo targets on all PROG.pseudo targets too. .for t in ${PROGS_TARGETS:O:u} .if make(${t}) $t: ${PROGS:%=%.$t} .endif .endfor .endif # !empty(PROGS) && !defined(_RECURSING_PROGS) && !defined(PROG) Index: head/share/mk/bsd.test.mk =================================================================== --- head/share/mk/bsd.test.mk (revision 296121) +++ head/share/mk/bsd.test.mk (revision 296122) @@ -1,122 +1,96 @@ # $FreeBSD$ # # Generic build infrastructure for test programs. # # This is the only public file that should be included by Makefiles when # tests are to be built. All other *.test.mk files are internal and not # to be included directly. .include ____: # Third-party software (kyua, etc) prefix. LOCALBASE?= /usr/local # Tests install directory TESTSDIR?= ${TESTSBASE}/${RELDIR:H} # List of subdirectories containing tests into which to recurse. This has the # same semantics as SUBDIR at build-time. However, the directories listed here # get registered into the run-time test suite definitions so that the test # engines know to recurse into these directories. # # In other words: list here any directories that contain test programs but use # SUBDIR for directories that may contain helper binaries and/or data files. TESTS_SUBDIRS?= # If defined, indicates that the tests built by the Makefile are not part of # the FreeBSD Test Suite. The implication of this is that the tests won't be # installed under /usr/tests/ and that Kyua won't be able to run them. #NOT_FOR_TEST_SUITE= # List of variables to pass to the tests at run-time via the environment. TESTS_ENV?= # Force all tests in a separate distribution file. # # We want this to be the case even when the distribution name is already # overriden. For example: we want the tests for programs in the 'games' # distribution to end up in the 'tests' distribution; the test programs # themselves have all the necessary logic to detect that the games are not # installed and thus won't cause false negatives. DISTRIBUTION:= tests # Ordered list of directories to construct the PATH for the tests. TESTS_PATH+= ${DESTDIR}/bin ${DESTDIR}/sbin \ ${DESTDIR}/usr/bin ${DESTDIR}/usr/sbin TESTS_ENV+= PATH=${TESTS_PATH:tW:C/ +/:/g} # Ordered list of directories to construct the LD_LIBRARY_PATH for the tests. TESTS_LD_LIBRARY_PATH+= ${DESTDIR}/lib ${DESTDIR}/usr/lib TESTS_ENV+= LD_LIBRARY_PATH=${TESTS_LD_LIBRARY_PATH:tW:C/ +/:/g} # List of all tests being built. The various *.test.mk modules extend this # variable as needed. _TESTS= # Pull in the definitions of all supported test interfaces. .include .include .include # kyua automatically descends directories; only run make check on the # top-level directory .if !make(check) .for ts in ${TESTS_SUBDIRS} .if empty(SUBDIR:M${ts}) SUBDIR+= ${ts} .endif .endfor SUBDIR_PARALLEL= t .endif # it is rare for test cases to have man pages .if !defined(MAN) MAN= .endif # tell progs.mk we might want to install things PROG_VARS+= BINDIR PROGS_TARGETS+= install .if !defined(NOT_FOR_TEST_SUITE) .include .endif .if !target(realcheck) realcheck: .PHONY @echo "$@ not defined; skipping" .endif beforecheck realcheck aftercheck check: .PHONY .ORDER: beforecheck realcheck aftercheck check: beforecheck realcheck aftercheck -.ifdef PROG -# we came here via bsd.progs.mk below -# parent will do staging. -MK_STAGING= no -.endif - -.if !empty(PROGS) || !empty(PROGS_CXX) || !empty(SCRIPTS) .include -.endif -.include - -.if !defined(PROG) && ${MK_STAGING} != "no" -.if !defined(_SKIP_BUILD) -# this will handle staging if needed -_SKIP_STAGING= no -# but we don't want it to build anything -_SKIP_BUILD= -.endif -.if !empty(PROGS) -stage_files.prog: ${PROGS} -.endif -.include -.endif - -.if !target(objwarn) -.include -.endif