Makefile
my_test:
ifdef $(toto)
@echo 'toto is defined'
else
@echo 'no toto around'
endif
Expected behavior
$ make my_test
no toto around
$ make my_test toto
toto is defined
Current behavior
$ make my_test
no toto around
$ make my_test toto
no toto around
make: *** No rule to make target `toto'. Stop.
When I run make my_test
I get the else text as expected no toto around
. However
make my_test toto
no toto around
make: *** No rule to make target `toto'. Stop.
Makefile version
$ make -v
GNU Make 3.81
SLE version
$ cat /etc/*release
VERSION_ID="11.4"
PRETTY_NAME="SUSE Linux Enterprise Server 11 SP4"
PS
The point is to make make my_test
verbose if toto
, if toto
not given then the command will run silently
make
4.2.1.toto
, there's no rule to buildtoto
, make tells you that there's no rule to buildtoto
. What else did you expect?toto
is defined then you'll need to define it -make my_test toto=1
might be what you're after?make
withoutmake
interpreting them as its own command line flags, targets or variable assignments.