[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: .PHONY, FORCE, target execution
From: |
Leeuwesteijn,Joost |
Subject: |
RE: .PHONY, FORCE, target execution |
Date: |
Tue, 2 May 2006 14:33:22 +0200 |
Hi Paul | tr "Pu" " l"
> l> Is it possible to force the execution of the banner target?
> No; the only way to do it is to re-invoke make recursively to
> build the target.
I've figured out the pattern rules and target specific variables (see test
makefile below). This could compact my code dramatically. Right now I have
a, pretty identical, cc/asm/link recipe for each module (except for module
specific variable names), which is not what I want. I was trying:
%.o : %.c TARGET_VAR:=FOO
to set the target/pattern specific variables but the manual helped out.
I've also found the "canned command sequences" chapter in the
way-too-big-so-many-options manual :-) Could be useful perhaps.
Because I like fancy output, and who knows what else it can be used for, I
hereby propose/request a new built-in target called .SUPERPHONY, .PHONY++ or
.FRAUD :-)
If a target is defined as .FRAUD, it will be executed -everytime- it is
listed as a prerequisite, it will be -ignored- in any $<, $?, $^ automatic
variables and will -not- cause a target to go out of date (which .PHONY
seems to do, just once).
Pseudo example:
-------------------------------
app : module1.a module2.a
@touch app
.FRAUD : banner
banner :
echo "Do stuff everytime (module=$(MODULE))"
module1.a : MODULE := module1
module1.a : banner mod1file1.o mod1file2.o
# $^ = mod1file1.o mod1file2.o ; $< = mod1file1.o
module2.a : MODULE := module2
module2.a : mod2file1.c banner mod2file2.c
# $^ = mod2file1.o mod2file2.o ; $< = mod2file1.o
-------------------------------
Output (after a previous full build):
-------------------------------
Do stuff everytime (module=module1)
Do stuff everytime (module=module2)
make: `app' is up to date.
-------------------------------
If I ever find the time to look at the make sourcecode... :-)
Regards,
Joost
##########################################
#
# Test makefile
#
##########################################
app : module1.a module2.a
@touch app
@echo2 "$@ created!"
# ----------------------------------------
module1.a : MODULE:=module1
module1.a : CFLAGS=foo
module1.a : banner mod1file1.o mod1file2.o
module2.a : MODULE:=module2
module2.a : CFLAGS=bar
module2.a : banner
module2.a : mod2file1.o mod2file2.o
# ----------------------------------------
%.a :
@echo2 "Linking address@hidden"
@echo2 " $?"
@touch $@
%.o : %.c
@echo2 "Compiling $@ (module=$(MODULE), CFLAGS=$(CFLAGS))"
@touch $@
# ----------------------------------------
banner : FORCE
@echo2
@echo2 "--- Building $(MODULE)...
FORCE : ;
# FORCE FORCE FORCE! I want the banner :-)
- .PHONY, FORCE, target execution, Leeuwesteijn,Joost, 2006/05/02
- RE: .PHONY, FORCE, target execution,
Leeuwesteijn,Joost <=
- RE: .PHONY, FORCE, target execution, Leeuwesteijn,Joost, 2006/05/02
- RE: .PHONY, FORCE, target execution, Leeuwesteijn,Joost, 2006/05/03