74 GNU make
# Query the default goal.
ifeq ($(.DEFAULT_GOAL),)
$(warning no default goal is set)
endif
.PHONY: foo
foo: ; @echo $@
$(warning default goal is $(.DEFAULT_GOAL))
# Reset the default goal.
.DEFAULT_GOAL :=
.PHONY: bar
bar: ; @echo $@
$(warning default goal is $(.DEFAULT_GOAL))
# Set our own.
.DEFAULT_GOAL := foo
This makefile prints:
no default goal is set
default goal is foo
default goal is bar
foo
Note that assigning more than one target name to .DEFAULT_GOAL is invalid
and will result in an error.
MAKE_RESTARTS
This variable is set only if this instance of make has restarted (see Section 3.5
[How Makefiles Are Remade], page 14): it will contain the number of times this
instance has restarted. Note this is not the same as recursion (counted by the
MAKELEVEL variable). You should not set, modify, or export this variable.
MAKE_TERMOUT
MAKE_TERMERR
When make starts it will check whether stdout and stderr will show their output
on a terminal. If so, it will set MAKE_TERMOUT and MAKE_TERMERR, respectively,
to the name of the terminal device (or true if this cannot be determined). If set
these variables will be marked for export. These variables will not be changed
by make and they will not be modified if already set.
These values can be used (particularly in combination with output synchroniza-
tion (see Section 5.4.1 [Output During Parallel Execution], page 47) to deter-
mine whether make itself is writing to a terminal; they can be tested to decide
whether to force recipe commands to generate colorized output for example.
If you invoke a sub-make and redirect its stdout or stderr it is your responsibility
to reset or unexport these variables as well, if your makefiles rely on them.
Comentários a estes Manuais