Index: head/Makefile =================================================================== --- head/Makefile (revision 138514) +++ head/Makefile (revision 138515) @@ -1,298 +1,299 @@ # # $FreeBSD$ # # The user-driven targets are: # # universe - *Really* build *everything* (buildworld and # all kernels on all architectures). # buildworld - Rebuild *everything*, including glue to help do # upgrades. # installworld - Install everything built by "buildworld". # world - buildworld + installworld. # buildkernel - Rebuild the kernel and the kernel-modules. # installkernel - Install the kernel and the kernel-modules. # installkernel.debug # reinstallkernel - Reinstall the kernel and the kernel-modules. # reinstallkernel.debug # kernel - buildkernel + installkernel. # update - Convenient way to update your source tree (cvs). # # This makefile is simple by design. The FreeBSD make automatically reads # the /usr/share/mk/sys.mk unless the -m argument is specified on the # command line. By keeping this makefile simple, it doesn't matter too # much how different the installed mk files are from those in the source # tree. This makefile executes a child make process, forcing it to use # the mk files from the source tree which are supposed to DTRT. # # The user-driven targets (as listed above) are implemented in Makefile.inc1. # # If you want to build your system from source be sure that /usr/obj has # at least 400MB of diskspace available. # # For individuals wanting to build from the sources currently on their # system, the simple instructions are: # # 1. `cd /usr/src' (or to the directory containing your source tree). # 2. `make world' # # For individuals wanting to upgrade their sources (even if only a # delta of a few days): # # 1. `cd /usr/src' (or to the directory containing your source tree). # 2. `make buildworld' # 3. `make buildkernel KERNCONF=YOUR_KERNEL_HERE' (default is GENERIC). # 4. `make installkernel KERNCONF=YOUR_KERNEL_HERE' (default is GENERIC). # 5. `reboot' (in single user mode: boot -s from the loader prompt). # 6. `mergemaster -p' # 7. `make installworld' # 8. `mergemaster' # 9. `reboot' # # See src/UPDATING `COMMON ITEMS' for more complete information. # # If TARGET_ARCH=arch (e.g. ia64, sparc64, ...) is specified you can # cross build world for other architectures using the buildworld target, # and once the world is built you can cross build a kernel using the # buildkernel target. # # Define the user-driven targets. These are listed here in alphabetical # order, but that's not important. # # Targets that begin with underscore are internal targets intended for # developer convenience only. They are intentionally not documented and # completely subject to change without notice. # TGTS= all all-man buildkernel buildworld checkdpadd clean \ cleandepend cleandir depend distribute distributeworld everything \ hierarchy install installcheck installkernel installkernel.debug\ reinstallkernel reinstallkernel.debug installworld \ kernel-toolchain libraries lint maninstall \ obj objlink regress rerelease tags toolchain update \ _worldtmp _legacy _bootstrap-tools _cleanobj _obj \ _build-tools _cross-tools _includes _libraries _depend \ build32 install32 BITGTS= files includes BITGTS:=${BITGTS} ${BITGTS:S/^/build/} ${BITGTS:S/^/install/} TGTS+= ${BITGTS} .ORDER: buildworld installworld .ORDER: buildworld distributeworld .ORDER: buildworld buildkernel .ORDER: buildkernel installkernel .ORDER: buildkernel installkernel.debug .ORDER: buildkernel reinstallkernel .ORDER: buildkernel reinstallkernel.debug PATH= /sbin:/bin:/usr/sbin:/usr/bin MAKEOBJDIRPREFIX?= /usr/obj _MAKEOBJDIRPREFIX!= /usr/bin/env -i \ PATH=${PATH} MAKEFLAGS="${.MAKEFLAGS}" ${MAKE} \ -f /dev/null -V MAKEOBJDIRPREFIX dummy .if !empty(_MAKEOBJDIRPREFIX) .error MAKEOBJDIRPREFIX can only be set in environment, not as a global\ (in /etc/make.conf) or command-line variable. .endif MAKEPATH= ${MAKEOBJDIRPREFIX}${.CURDIR}/make.${MACHINE} BINMAKE= \ `if [ -x ${MAKEPATH}/make ]; then echo ${MAKEPATH}/make; else echo ${MAKE}; fi` \ -m ${.CURDIR}/share/mk _MAKE= PATH=${PATH} ${BINMAKE} -f Makefile.inc1 # # Make sure we have an up-to-date make(1). Only world and buildworld # should do this as those are the initial targets used for upgrades. # The user can define ALWAYS_CHECK_MAKE to have this check performed # for all targets. # .if defined(ALWAYS_CHECK_MAKE) ${TGTS}: upgrade_checks .else buildworld: upgrade_checks .endif # # This 'cleanworld' target is not included in TGTS, because it is not a # recursive target. All of the work for it is done right here. It is # expected that BW_CANONICALOBJDIR == the CANONICALOBJDIR as would be # created by bsd.obj.mk, except that we don't want to .include that file # in this makefile. # # In the following, the first 'rm' in a series will usually remove all # files and directories. If it does not, then there are probably some # files with chflags set, so this unsets them and tries the 'rm' a # second time. There are situations where this target will be cleaning # some directories via more than one method, but that duplication is # needed to correctly handle all the possible situations. # BW_CANONICALOBJDIR:=${MAKEOBJDIRPREFIX}${.CURDIR} cleanworld: .if ${.CURDIR} == ${.OBJDIR} || ${.CURDIR}/obj == ${.OBJDIR} .if exists(${BW_CANONICALOBJDIR}/) -rm -rf ${BW_CANONICALOBJDIR}/* chflags -R 0 ${BW_CANONICALOBJDIR} rm -rf ${BW_CANONICALOBJDIR}/* .endif # To be safe in this case, fall back to a 'make cleandir' ${_+_}@cd ${.CURDIR}; ${_MAKE} cleandir .else -rm -rf ${.OBJDIR}/* chflags -R 0 ${.OBJDIR} rm -rf ${.OBJDIR}/* .endif # # Handle the user-driven targets, using the source relative mk files. # ${TGTS}: ${_+_}@cd ${.CURDIR}; \ ${_MAKE} ${.TARGET} # Set a reasonable default .MAIN: all STARTTIME!= LC_ALL=C date .if defined(HISTORICAL_MAKE_WORLD) || defined(DESTDIR) # # world # # Attempt to rebuild and reinstall everything. This target is not to be # used for upgrading an existing FreeBSD system, because the kernel is # not included. One can argue that this target doesn't build everything # then. # world: upgrade_checks @echo "--------------------------------------------------------------" @echo ">>> make world started on ${STARTTIME}" @echo "--------------------------------------------------------------" .if target(pre-world) @echo @echo "--------------------------------------------------------------" @echo ">>> Making 'pre-world' target" @echo "--------------------------------------------------------------" ${_+_}@cd ${.CURDIR}; ${_MAKE} pre-world .endif ${_+_}@cd ${.CURDIR}; ${_MAKE} buildworld ${_+_}@cd ${.CURDIR}; ${_MAKE} -B installworld .if target(post-world) @echo @echo "--------------------------------------------------------------" @echo ">>> Making 'post-world' target" @echo "--------------------------------------------------------------" ${_+_}@cd ${.CURDIR}; ${_MAKE} post-world .endif @echo @echo "--------------------------------------------------------------" @echo ">>> make world completed on `LC_ALL=C date`" @echo " (started ${STARTTIME})" @echo "--------------------------------------------------------------" .else world: @echo "WARNING: make world will overwrite your existing FreeBSD" @echo "installation without also building and installing a new" @echo "kernel. This can be dangerous. Please read the handbook," @echo "'Rebuilding world', for how to upgrade your system." @echo "Define DESTDIR to where you want to install FreeBSD," @echo "including /, to override this warning and proceed as usual." @echo "You may get the historical 'make world' behavior by defining" @echo "HISTORICAL_MAKE_WORLD. You should understand the implications" @echo "before doing this." @echo "" @echo "Bailing out now..." @false .endif # # kernel # # Short hand for `make buildkernel installkernel' # kernel: buildkernel installkernel # # Perform a few tests to determine if the installed tools are adequate # for building the world. # upgrade_checks: @if ! (cd ${.CURDIR}/tools/regression/usr.bin/make && \ + PATH=${PATH} ${BINMAKE} obj >/dev/null 2>&1 && \ PATH=${PATH} ${BINMAKE} >/dev/null 2>&1); \ then \ (cd ${.CURDIR} && make make); \ fi # # Upgrade make(1) to the current version using the installed # headers, libraries and tools. # MMAKEENV= MAKEOBJDIRPREFIX=${MAKEPATH} \ DESTDIR= \ INSTALL="sh ${.CURDIR}/tools/install.sh" MMAKE= ${MMAKEENV} make \ -D_UPGRADING \ -DNOMAN -DNOSHARED \ -DNO_CPU_CFLAGS -DNO_WERROR make: .PHONY @echo @echo "--------------------------------------------------------------" @echo ">>> Building an up-to-date make(1)" @echo "--------------------------------------------------------------" ${_+_}@cd ${.CURDIR}/usr.bin/make; \ ${MMAKE} obj && \ ${MMAKE} depend && \ ${MMAKE} all && \ ${MMAKE} install DESTDIR=${MAKEPATH} BINDIR= # # universe # # Attempt to rebuild *everything* for all supported architectures, # with a reasonable chance of success, regardless of how old your # existing system is. # universe: universe_prologue universe_prologue: @echo "--------------------------------------------------------------" @echo ">>> make universe started on ${STARTTIME}" @echo "--------------------------------------------------------------" .for target in i386 i386:pc98 sparc64 alpha ia64 amd64 .for arch in ${target:C/:.*$//} .for mach in ${target:C/^.*://} universe: universe_${mach} .ORDER: universe_prologue universe_${mach} universe_epilogue universe_${mach}: @echo ">> ${mach} started on `LC_ALL=C date`" -cd ${.CURDIR} && ${MAKE} ${JFLAG} buildworld \ TARGET_ARCH=${arch} TARGET=${mach} \ __MAKE_CONF=/dev/null \ > _.${mach}.buildworld 2>&1 @echo ">> ${mach} buildworld completed on `LC_ALL=C date`" .if exists(${.CURDIR}/sys/${mach}/conf/NOTES) -cd ${.CURDIR}/sys/${mach}/conf && ${MAKE} LINT \ > ${.CURDIR}/_.${mach}.makeLINT 2>&1 .endif cd ${.CURDIR} && ${MAKE} buildkernels TARGET_ARCH=${arch} TARGET=${mach} @echo ">> ${mach} completed on `LC_ALL=C date`" .endfor .endfor .endfor universe: universe_epilogue universe_epilogue: @echo "--------------------------------------------------------------" @echo ">>> make universe completed on `LC_ALL=C date`" @echo " (started ${STARTTIME})" @echo "--------------------------------------------------------------" .if make(buildkernels) KERNCONFS!= cd ${.CURDIR}/sys/${TARGET}/conf && \ find [A-Z]*[A-Z] -type f -maxdepth 0 ! -name NOTES buildkernels: .for kernel in ${KERNCONFS} -cd ${.CURDIR} && ${MAKE} ${JFLAG} buildkernel \ KERNCONF=${kernel} \ __MAKE_CONF=/dev/null \ > _.${TARGET}.${kernel} 2>&1 .endfor .endif Index: head/tools/build/make_check/Makefile =================================================================== --- head/tools/build/make_check/Makefile (revision 138514) +++ head/tools/build/make_check/Makefile (revision 138515) @@ -1,302 +1,300 @@ # $FreeBSD$ # Test for broken LHS expansion. # This *must* cause make(1) to detect a recursive variable, and fail as such. .if make(lhs_expn) FOO= ${BAR} BAR${NIL}= ${FOO} FOO${BAR}= ${FOO} .endif DATA1= helllo DATA2:= ${DATA1} DATA3= ${DATA2:S/ll/rr/g} DATA4:= ${DATA2:S/ll/rr/g} DATA2?= allo DATA5:= ${DATA2:S/ll/ii/g} ${DATA1:S/ll/rr/g} DATA2= yello DATA1:= ${DATA5:S/l/r/g} NIL= SMAKE= MAKEFLAGS= ${MAKE} -C ${.CURDIR} all: - @if [ ! -x ./shell_test ] ; then \ - ${INSTALL} -m 555 ${.CURDIR}/shell_test.sh shell_test ; \ - fi @echo '1..17' @${SMAKE} C_check || { cd ${.CURDIR} ; ${MAKE} failure ; } @echo "ok 1 - C_check # Test of -C flag existence detected no regression." @echo 1:${DATA1} 2:${DATA2} 3:${DATA3} 4:${DATA4} 5:${DATA5} | \ diff -u ${.CURDIR}/regress.variables.out - || \ ${SMAKE} failure @echo "ok 2 - test_variables # Test variables detected no regression, output matches." @${SMAKE} double 2>/dev/null || ${SMAKE} failure @echo "ok 3 - test_targets # Test targets detected no regression." @${SMAKE} sysvmatch || ${SMAKE} failure @echo "ok 4 - sysvmatch # Test sysvmatch detected no regression." @! ${SMAKE} lhs_expn && true || ${SMAKE} failure @echo "ok 5 lhs_expn # Test lhs_expn detected no regression." @${SMAKE} notdef || ${SMAKE} failure @echo "ok 6 - notdef # Test notdef detected no regression." @${SMAKE} modifiers || ${SMAKE} failure @echo "ok 7 - modifiers # Test modifiers detected no regression." @${SMAKE} funny_targets || ${SMAKE} failure @echo "ok 8 funny_targets # Test funny_targets detected no regression." @${SMAKE} arith_expr || ${SMAKE} failure @echo "ok 9 arith_expr # Test arith_expr detected no regression." @${SMAKE} PATH_exists || ${SMAKE} failure @echo "ok 10 PATH_exists # Test PATH_exists detected no regression." @${SMAKE} double_quotes || ${SMAKE} failure @echo "ok 11 double_quotes # Test double_quotes detected no regression." @! ${SMAKE} double_quotes2 >/dev/null 2>&1 && true || ${SMAKE} failure @echo "ok 12 double_quotes2 # Test double_quotes2 detected no regression." @${SMAKE} pass_cmd_vars || ${SMAKE} failure @echo "ok 13 pass_cmd_vars # Test pass_cmd_vars detected no regression." @${SMAKE} plus_flag || ${SMAKE} failure @echo "ok 14 plus_flag # Test plus_flag detected no regression." @! ${SMAKE} shell >/dev/null 2>&1 && true || ${SMAKE} failure @echo "ok 15 shell # Test shell detected no regression." @${SMAKE} shell_1 || ${SMAKE} failure @echo "ok 16 shell_1 # Test shell_1 detected no regression." @${SMAKE} shell_2 || ${SMAKE} failure @echo "ok 17 shell_2 # Test shell_2 detected no regression." .if make(C_check) C_check: .endif .if make(double) # Doubly-defined targets. make(1) will warn, but use the "right" one. If it # switches to using the "non-right" one, it breaks things worse than a little # regression test. double: @true double: @false .endif .if make(sysvmatch) # Some versions of FreeBSD make(1) do not handle a nil LHS in sysvsubst. sysvmatch: @echo EMPTY ${NIL:=foo} LHS | \ diff -u ${.CURDIR}/regress.sysvmatch.out - || false .endif # A bogus target for the lhs_expn test; If this is reached, then the make(1) # program has not errored out because of the recursion caused by not expanding # the left-hand-side's embedded variables above. lhs_expn: @true .if make(notdef) # make(1) claims to only evaluate a conditional as far as is necessary # to determine its value; that was not always the case. .undef notdef notdef: .if defined(notdef) && ${notdef:U} .endif .endif .if make(modifiers) # See if make(1) supports the C modifier. modifiers: @if ${SMAKE} -V .CURDIR:C/.// 2>&1 >/dev/null | \ grep -q "Unknown modifier 'C'"; then \ false; \ fi .endif .if make(funny_targets) funny_targets: colons::target exclamation!target colons::target: exclamation!target: .endif .if make(arith_expr) arith_expr: # See if arithmetic expression parsing is broken. # The different spacing below is intentional. VALUE= 0 .if (${VALUE} < 0)||(${VALUE}>0) .endif .endif .if make(PATH_exists) PATH_exists: .PATH: ${.CURDIR} .if !exists(${.CURDIR}/) || !exists(${.CURDIR}/.) || !exists(${.CURDIR}/..) .error exists() failed .endif .endif .if make(double_quotes) VALUE= foo "" double_quotes: .if ${VALUE:S/$//} != ${VALUE} .error "" reduced to " .endif .endif .if make(double_quotes2) double_quotes2: @cat /dev/null "" .endif # # Check passing of variable via MAKEFLAGS # .if make(pass_cmd_vars) pass_cmd_vars: @${SMAKE} CMD1=cmd1 CMD2=cmd2 pass_cmd_vars_1 @${SMAKE} CMD1=cmd1 CMD2=cmd2 pass_cmd_vars_2 @${SMAKE} CMD1=cmd1 CMD2=cmd2 pass_cmd_vars_3 @${SMAKE} CMD1=cmd1 CMD2=cmd2 pass_cmd_vars_4 .endif .if make(pass_cmd_vars_1) # Check that the variable definition arrived from the calling make pass_cmd_vars_1: @: .if ${CMD1} != cmd1 || ${CMD2} != cmd2 .error variables not passed through MAKEFLAGS .endif # Check that the variable definition is in MAKEFLAGS .if ${.MAKEFLAGS:MCMD1=*} != "CMD1=cmd1" || ${.MAKEFLAGS:MCMD2=*} != "CMD2=cmd2" .error variable assignment not found in $${MAKEFLAGS} .endif # Check that the variable definition is not in MFLAGS .if ${MFLAGS:MCMD1=*} != "" || ${MFLAGS:MCMD2=*} != "" .error variable assignment found in $${MFLAGS} .endif .endif .if make(pass_cmd_vars_2) # Check that we cannot override the passed variables CMD1=foo1 CMD2=foo2 .if ${CMD1} != cmd1 || ${CMD2} != cmd2 .error MAKEFLAGS-passed variables overridden .endif pass_cmd_vars_2: @: .endif .if make(pass_cmd_vars_3) # Check that we can override the passed variables on the next sub-make's # command line pass_cmd_vars_3: @${SMAKE} CMD1=foo1 pass_cmd_vars_3_1 .endif .if make(pass_cmd_vars_3_1) .if ${CMD1} != foo1 || ${CMD2} != cmd2 .error MAKEFLAGS-passed variables not overridden on command line .endif pass_cmd_vars_3_1: @: .endif .if make(pass_cmd_vars_4) # Ensure that a variable assignment passed via MAKEFLAGS may be overwritten # by evaluating the .MAKEFLAGS target. .MAKEFLAGS: CMD1=baz1 pass_cmd_vars_4: @${SMAKE} pass_cmd_vars_4_1 .if ${CMD1} != baz1 || ${CMD2} != cmd2 .error MAKEFLAGS-passed variables not overridden via .MAKEFLAGS target .endif .endif .if make(pass_cmd_vars_4_1) .if ${CMD1} != baz1 || ${CMD2} != cmd2 .error MAKEFLAGS-passed variables not overridden via .MAKEFLAGS target (2) .endif pass_cmd_vars_4_1: @: .endif # # Test whether make supports the '+' flag (meaning: execute even with -n) # .if make(plus_flag) OUT != ${SMAKE} -n plus_flag_1 .if ${OUT} != "/tmp" .error make doesn't handle + flag .endif plus_flag: @: .endif .if make(plus_flag_1) plus_flag_1: +@cd /tmp; pwd .endif .if make(shell) # Test if make fully supports the .SHELL specification. .SHELL: path=/nonexistent A!= echo ok shell: .endif .if make(shell_1) # Test if setting the shell by name only works. Because we have no ksh # in the base system we test that we can set sh and csh. We try only exact # matching names and do not exercise the rather strange matching algorithm. shell_1: @${SMAKE} shell_1_csh @${SMAKE} shell_1_sh .endif .if make(shell_1_csh) .SHELL: name="csh" shell_1_csh: @ps -ax -opid,command | awk '$$1=="'$$$$'" { print $$2 }' | grep -E -q '^(/bin/)?csh$$' .endif .if make(shell_1_sh) .SHELL: name="sh" shell_1_sh: @ps -ax -opid,command | awk '$$1=="'$$$$'" { print $$2 }' | grep -q '^/bin/sh$$' .endif .if make(shell_2) # Test if we can replace the shell specification. We do this by using # a shell scripts that prints us its arguments and standard input as the shell -shell_2: +shell_2: shell_test @${SMAKE} -B shell_2B | \ diff -u ${.CURDIR}/regress.shell_2B.out - || false @${SMAKE} -j1 shell_2j | \ diff -u ${.CURDIR}/regress.shell_2j.out - || false .endif .if make(shell_2B) .SHELL: name="echo" path="${.OBJDIR}/shell_test" quiet="be quiet" echo="be verbose" filter="be verbose" echoFlag="x" errFlag="y" hasErrCtl=y check="check errors" ignore="ignore errors" shell_2B: -@funny $$ funnier $$ .endif .if make(shell_2j) .SHELL: name="echo" path="${.OBJDIR}/shell_test" quiet="be quiet" echo="be verbose" filter="be verbose" echoFlag="x" errFlag="y" hasErrCtl=y check="check errors" ignore="ignore errors" shell_2j: -@funny $$ funnier $$ .endif failure: @echo "not ok # Test failed: regression detected. See above." @false -clean: - rm -f shell_test +CLEANFILES= shell_test + +.include Index: head/tools/regression/usr.bin/make/Makefile =================================================================== --- head/tools/regression/usr.bin/make/Makefile (revision 138514) +++ head/tools/regression/usr.bin/make/Makefile (revision 138515) @@ -1,302 +1,300 @@ # $FreeBSD$ # Test for broken LHS expansion. # This *must* cause make(1) to detect a recursive variable, and fail as such. .if make(lhs_expn) FOO= ${BAR} BAR${NIL}= ${FOO} FOO${BAR}= ${FOO} .endif DATA1= helllo DATA2:= ${DATA1} DATA3= ${DATA2:S/ll/rr/g} DATA4:= ${DATA2:S/ll/rr/g} DATA2?= allo DATA5:= ${DATA2:S/ll/ii/g} ${DATA1:S/ll/rr/g} DATA2= yello DATA1:= ${DATA5:S/l/r/g} NIL= SMAKE= MAKEFLAGS= ${MAKE} -C ${.CURDIR} all: - @if [ ! -x ./shell_test ] ; then \ - ${INSTALL} -m 555 ${.CURDIR}/shell_test.sh shell_test ; \ - fi @echo '1..17' @${SMAKE} C_check || { cd ${.CURDIR} ; ${MAKE} failure ; } @echo "ok 1 - C_check # Test of -C flag existence detected no regression." @echo 1:${DATA1} 2:${DATA2} 3:${DATA3} 4:${DATA4} 5:${DATA5} | \ diff -u ${.CURDIR}/regress.variables.out - || \ ${SMAKE} failure @echo "ok 2 - test_variables # Test variables detected no regression, output matches." @${SMAKE} double 2>/dev/null || ${SMAKE} failure @echo "ok 3 - test_targets # Test targets detected no regression." @${SMAKE} sysvmatch || ${SMAKE} failure @echo "ok 4 - sysvmatch # Test sysvmatch detected no regression." @! ${SMAKE} lhs_expn && true || ${SMAKE} failure @echo "ok 5 lhs_expn # Test lhs_expn detected no regression." @${SMAKE} notdef || ${SMAKE} failure @echo "ok 6 - notdef # Test notdef detected no regression." @${SMAKE} modifiers || ${SMAKE} failure @echo "ok 7 - modifiers # Test modifiers detected no regression." @${SMAKE} funny_targets || ${SMAKE} failure @echo "ok 8 funny_targets # Test funny_targets detected no regression." @${SMAKE} arith_expr || ${SMAKE} failure @echo "ok 9 arith_expr # Test arith_expr detected no regression." @${SMAKE} PATH_exists || ${SMAKE} failure @echo "ok 10 PATH_exists # Test PATH_exists detected no regression." @${SMAKE} double_quotes || ${SMAKE} failure @echo "ok 11 double_quotes # Test double_quotes detected no regression." @! ${SMAKE} double_quotes2 >/dev/null 2>&1 && true || ${SMAKE} failure @echo "ok 12 double_quotes2 # Test double_quotes2 detected no regression." @${SMAKE} pass_cmd_vars || ${SMAKE} failure @echo "ok 13 pass_cmd_vars # Test pass_cmd_vars detected no regression." @${SMAKE} plus_flag || ${SMAKE} failure @echo "ok 14 plus_flag # Test plus_flag detected no regression." @! ${SMAKE} shell >/dev/null 2>&1 && true || ${SMAKE} failure @echo "ok 15 shell # Test shell detected no regression." @${SMAKE} shell_1 || ${SMAKE} failure @echo "ok 16 shell_1 # Test shell_1 detected no regression." @${SMAKE} shell_2 || ${SMAKE} failure @echo "ok 17 shell_2 # Test shell_2 detected no regression." .if make(C_check) C_check: .endif .if make(double) # Doubly-defined targets. make(1) will warn, but use the "right" one. If it # switches to using the "non-right" one, it breaks things worse than a little # regression test. double: @true double: @false .endif .if make(sysvmatch) # Some versions of FreeBSD make(1) do not handle a nil LHS in sysvsubst. sysvmatch: @echo EMPTY ${NIL:=foo} LHS | \ diff -u ${.CURDIR}/regress.sysvmatch.out - || false .endif # A bogus target for the lhs_expn test; If this is reached, then the make(1) # program has not errored out because of the recursion caused by not expanding # the left-hand-side's embedded variables above. lhs_expn: @true .if make(notdef) # make(1) claims to only evaluate a conditional as far as is necessary # to determine its value; that was not always the case. .undef notdef notdef: .if defined(notdef) && ${notdef:U} .endif .endif .if make(modifiers) # See if make(1) supports the C modifier. modifiers: @if ${SMAKE} -V .CURDIR:C/.// 2>&1 >/dev/null | \ grep -q "Unknown modifier 'C'"; then \ false; \ fi .endif .if make(funny_targets) funny_targets: colons::target exclamation!target colons::target: exclamation!target: .endif .if make(arith_expr) arith_expr: # See if arithmetic expression parsing is broken. # The different spacing below is intentional. VALUE= 0 .if (${VALUE} < 0)||(${VALUE}>0) .endif .endif .if make(PATH_exists) PATH_exists: .PATH: ${.CURDIR} .if !exists(${.CURDIR}/) || !exists(${.CURDIR}/.) || !exists(${.CURDIR}/..) .error exists() failed .endif .endif .if make(double_quotes) VALUE= foo "" double_quotes: .if ${VALUE:S/$//} != ${VALUE} .error "" reduced to " .endif .endif .if make(double_quotes2) double_quotes2: @cat /dev/null "" .endif # # Check passing of variable via MAKEFLAGS # .if make(pass_cmd_vars) pass_cmd_vars: @${SMAKE} CMD1=cmd1 CMD2=cmd2 pass_cmd_vars_1 @${SMAKE} CMD1=cmd1 CMD2=cmd2 pass_cmd_vars_2 @${SMAKE} CMD1=cmd1 CMD2=cmd2 pass_cmd_vars_3 @${SMAKE} CMD1=cmd1 CMD2=cmd2 pass_cmd_vars_4 .endif .if make(pass_cmd_vars_1) # Check that the variable definition arrived from the calling make pass_cmd_vars_1: @: .if ${CMD1} != cmd1 || ${CMD2} != cmd2 .error variables not passed through MAKEFLAGS .endif # Check that the variable definition is in MAKEFLAGS .if ${.MAKEFLAGS:MCMD1=*} != "CMD1=cmd1" || ${.MAKEFLAGS:MCMD2=*} != "CMD2=cmd2" .error variable assignment not found in $${MAKEFLAGS} .endif # Check that the variable definition is not in MFLAGS .if ${MFLAGS:MCMD1=*} != "" || ${MFLAGS:MCMD2=*} != "" .error variable assignment found in $${MFLAGS} .endif .endif .if make(pass_cmd_vars_2) # Check that we cannot override the passed variables CMD1=foo1 CMD2=foo2 .if ${CMD1} != cmd1 || ${CMD2} != cmd2 .error MAKEFLAGS-passed variables overridden .endif pass_cmd_vars_2: @: .endif .if make(pass_cmd_vars_3) # Check that we can override the passed variables on the next sub-make's # command line pass_cmd_vars_3: @${SMAKE} CMD1=foo1 pass_cmd_vars_3_1 .endif .if make(pass_cmd_vars_3_1) .if ${CMD1} != foo1 || ${CMD2} != cmd2 .error MAKEFLAGS-passed variables not overridden on command line .endif pass_cmd_vars_3_1: @: .endif .if make(pass_cmd_vars_4) # Ensure that a variable assignment passed via MAKEFLAGS may be overwritten # by evaluating the .MAKEFLAGS target. .MAKEFLAGS: CMD1=baz1 pass_cmd_vars_4: @${SMAKE} pass_cmd_vars_4_1 .if ${CMD1} != baz1 || ${CMD2} != cmd2 .error MAKEFLAGS-passed variables not overridden via .MAKEFLAGS target .endif .endif .if make(pass_cmd_vars_4_1) .if ${CMD1} != baz1 || ${CMD2} != cmd2 .error MAKEFLAGS-passed variables not overridden via .MAKEFLAGS target (2) .endif pass_cmd_vars_4_1: @: .endif # # Test whether make supports the '+' flag (meaning: execute even with -n) # .if make(plus_flag) OUT != ${SMAKE} -n plus_flag_1 .if ${OUT} != "/tmp" .error make doesn't handle + flag .endif plus_flag: @: .endif .if make(plus_flag_1) plus_flag_1: +@cd /tmp; pwd .endif .if make(shell) # Test if make fully supports the .SHELL specification. .SHELL: path=/nonexistent A!= echo ok shell: .endif .if make(shell_1) # Test if setting the shell by name only works. Because we have no ksh # in the base system we test that we can set sh and csh. We try only exact # matching names and do not exercise the rather strange matching algorithm. shell_1: @${SMAKE} shell_1_csh @${SMAKE} shell_1_sh .endif .if make(shell_1_csh) .SHELL: name="csh" shell_1_csh: @ps -ax -opid,command | awk '$$1=="'$$$$'" { print $$2 }' | grep -E -q '^(/bin/)?csh$$' .endif .if make(shell_1_sh) .SHELL: name="sh" shell_1_sh: @ps -ax -opid,command | awk '$$1=="'$$$$'" { print $$2 }' | grep -q '^/bin/sh$$' .endif .if make(shell_2) # Test if we can replace the shell specification. We do this by using # a shell scripts that prints us its arguments and standard input as the shell -shell_2: +shell_2: shell_test @${SMAKE} -B shell_2B | \ diff -u ${.CURDIR}/regress.shell_2B.out - || false @${SMAKE} -j1 shell_2j | \ diff -u ${.CURDIR}/regress.shell_2j.out - || false .endif .if make(shell_2B) .SHELL: name="echo" path="${.OBJDIR}/shell_test" quiet="be quiet" echo="be verbose" filter="be verbose" echoFlag="x" errFlag="y" hasErrCtl=y check="check errors" ignore="ignore errors" shell_2B: -@funny $$ funnier $$ .endif .if make(shell_2j) .SHELL: name="echo" path="${.OBJDIR}/shell_test" quiet="be quiet" echo="be verbose" filter="be verbose" echoFlag="x" errFlag="y" hasErrCtl=y check="check errors" ignore="ignore errors" shell_2j: -@funny $$ funnier $$ .endif failure: @echo "not ok # Test failed: regression detected. See above." @false -clean: - rm -f shell_test +CLEANFILES= shell_test + +.include