This example is the one from an earlier section. We will use symbols to generalize it.
options=IGNORECACHE LINEDEBUG DEBUG
test: test.e
ec test IGNORECACHE LINEDEBUG DEBUG
if warn
echo "Error: compile failed"
else
echo "Compiled OK... running"
test
endif
As a first step every use of the actual name `test' is replaced by a constant and the compiler options are put in a symbol:
OPTIONS=IGNORECACHE LINEDEBUG DEBUG
PGM=test
$(PGM): $(PGM).e
ec $(pgm) $(OPTIONS)
if warn
echo "Error: compile failed"
else
echo "Compiled OK... running"
$(PGM)
endif
To indicate that we want to handle the target of the actions we should rather use $(target) instead of the $(PGM). Note that both uses are correct. We should use $(dep), too.
PGM=test
OPTIONS=IGNORECACHE LINEDEBUG DEBUG
$(PGM): $(PGM).e
ec $(dep) $(OPTIONS)
if warn
echo "Error: compile failed"
else
echo "Compiled OK... running"
$(target)
endif
Take a look at the line where the source is compiled. This line can be used for every source since the name of the file is in the preset symbol. If you like you could even make a symbol that holds this line:
COMPILE=ec $(dep) $(options)
Go to the Next or Previous section or the Detailed Contents.