]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/bmake/unit-tests/cmdline.mk
Update to bmake-20201101
[FreeBSD/FreeBSD.git] / contrib / bmake / unit-tests / cmdline.mk
1 # $NetBSD: cmdline.mk,v 1.1 2020/07/28 22:44:44 rillig Exp $
2 #
3 # Tests for command line parsing and related special variables.
4
5 RUN?=           @set -eu;
6 TMPBASE?=       /tmp
7 SUB1=           a7b41170-53f8-4cc2-bc5c-e4c3dd93ec45    # just a random UUID
8 SUB2=           6a8899d2-d227-4b55-9b6b-f3c8eeb83fd5    # just a random UUID
9 MAKE_CMD=       env TMPBASE=${TMPBASE}/${SUB1} ${.MAKE} -f ${MAKEFILE} -r
10 DIR2=           ${TMPBASE}/${SUB2}
11 DIR12=          ${TMPBASE}/${SUB1}/${SUB2}
12
13 all: prepare-dirs
14 all: makeobjdir-direct makeobjdir-indirect
15
16 prepare-dirs:
17         ${RUN} rm -rf ${DIR2} ${DIR12}
18         ${RUN} mkdir -p ${DIR2} ${DIR12}
19
20 # The .OBJDIR can be set via the MAKEOBJDIR command line variable.
21 # It must be a command line variable; an environment variable would not work.
22 makeobjdir-direct:
23         @echo $@:
24         ${RUN} ${MAKE_CMD} MAKEOBJDIR=${DIR2} show-objdir
25
26 # The .OBJDIR can be set via the MAKEOBJDIR command line variable,
27 # and that variable could even contain the usual modifiers.
28 # Since the .OBJDIR=MAKEOBJDIR assignment happens very early,
29 # the SUB2 variable in the modifier is not defined yet and is therefore empty.
30 # The SUB1 in the resulting path comes from the environment variable TMPBASE,
31 # see MAKE_CMD.
32 makeobjdir-indirect:
33         @echo $@:
34         ${RUN} ${MAKE_CMD} MAKEOBJDIR='$${TMPBASE}/$${SUB2}' show-objdir
35
36 show-objdir:
37         @echo $@: ${.OBJDIR:Q}