Can I expand macro JUST ONE TIME in specific target?

Posted by naive231 on Stack Overflow See other posts from Stack Overflow or by naive231
Published on 2013-10-17T10:08:17Z Indexed on 2013/10/18 3:54 UTC
Read the original article Hit count: 136

Filed under:
|
A = "demo"
%.o:%.cpp
    $(CC) -c $^ $(A) -o $@
default:$(all_objs)
game:A = $(shell read -p 'Enter game version: ' gv && echo $$gv)
game:$(all_objs)

Just a snippet makefile above. If I make game, main problem is each compilation of sources will expand $(A) and it will request user to input game version over and over. $(A) has default content "demo" only if user doesn't make game target.

So, is there any way to set $(A) to be expanded && ?

© Stack Overflow or respective owner

Related posts about makefile

Related posts about make