make commands
ifeq
else
endif
...
They MUST NOT be indented with TAB characters as (almost) all lines with TAB characters as the first character on the line in a makefile are passed to the shell (/bin/sh). The shell doesn't know anything about make commands. make commands can be indented with a set of SPACE characters but this might be misleading as recipies is what MUST be indented with TABs.
Recipies
They must be indented with TAB character in order to be passed to shell.
Targets
Targets are labels that allow make to execute a group of commands together.
Makefile:
target1:
@echo target1 is executing
target2:
@echo target2 is executing
We can now run make as:
$ make target1
or
$ make target2
Minimal (but working) example of Makefile:
docker-run:
@echo Building and running Docker image...
docker build -t cpp-demo . && docker run --rm --name cpp-demo cpp-demo
To run it:
$ make docker-run
Conditional Execution
Use ifeq-endif or ifeq-else-endif blocks.
Makefile:
VAR1= test
VAR2=nottest
demo-if-else-endif:
ifeq($(VAR1), $(VAR2))
...
else
...
endif
Makefile ifeq: when are they evaluated?
Variable comparison
TEST=ON
ifeq ($(TEST),ON)
@echo PASSED
else
@echo FAILED
endif
To check if variable is empty:
ifeq ($(TEST),)
TEST := $(something else)
endif
Makefile set if variable is empty
1 comment:
BE SMART AND BECOME RICH IN LESS THAN 3DAYS....It all depends on how fast
you can be to get the new PROGRAMMED blank ATM card that is capable of
hacking into any ATM machine,anywhere in the world. I got to know about
this BLANK ATM CARD when I was searching for job online about a month
ago..It has really changed my life for good and now I can say I'm rich and
I can never be poor again. The least money I get in a day with it is about
$50,000.(fifty thousand USD) Every now and then I keeping pumping money
into my account. Though is illegal,there is no risk of being caught
,because it has been programmed in such a way that it is not traceable,it
also has a technique that makes it impossible for the CCTVs to detect
you..For details on how to get yours today, email the hackers on : (
atmmachinehackers1@gmail.com ). Tell your
loved once too, and start to live large. That's the simple testimony of how
my life changed for good...Love you all ...the email address again is ;
atmmachinehackers1@gmail.com
Post a Comment