Yanghui Bian wrote:
Hello,
Generally I could get the make target from "makecmdgoals" provided by
GNU make.
But sometimes people will invoke make like below:
make target1 target2 target3
I assume make process the target1 first then the next target just like I
invoke it as:
Make target1; make target2; make target3; In the first case, is there any way to get the target which is under
processing?

Yyou can have a workaround if your set of toplevel targets if limited.


Here is how:

(1) for each of toplevel targets, change ":" to "::" in their rules

(2) at the beginning of makefile, add these lines for each toplevel target:

    target1:: TARGET=target1
    target2:: TARGET=target2
    target3:: TARGET=target3

(3) Caution: *don't* write these lines as

    target1: TARGET=$@   # No. Won't work
    target1: TARGET:=$@  # No. Won't work

No, the 'TARGET=$@' won't work for you. Only 'TARGET=target1' will work,
with target literally repeated:

target1:: TARGET=target1


(3) Use $(TARGET) as current toplevel target execued



Jacob Lerner




_______________________________________________
Help-make mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/help-make

Reply via email to