[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How to write an elegant makefile with -fprofile-generate and -fprofi
Martin d Anjou
Re: How to write an elegant makefile with -fprofile-generate and -fprofile-use ?
Wed, 3 Sep 2008 10:11:31 -0400 (EDT)
Alpine 1.10 (LNX 962 2008-03-14)
So, I'm looking for an idea to compile twice the same program (with the
same .o) with different option.
You could use as command line variable (see Overriding Variables in the
make manual). Suppose you compile with this rule:
$(COMPILER) $(MY_OPT) toto.c -ouput toto.o
Then from the command line you can call it with either:
or nothing at all:
If you do not specify MY_OPT, make will put a blank for $(MY_OPT). It will
not complain that it is undefined (see -warn-undefined-variables in the
Please ignore that I do not know how to compile C programs and that the
-output switch is probably wrong. My point is to use MY_OPT as a command
line variable to show you one way of doing what you want. There are other
ways, but this is the first that comes to my mind.