help-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

conditional based on target? + profiling


From: Ross Boylan
Subject: conditional based on target? + profiling
Date: Thu, 13 Jan 2005 14:56:40 -0800

Profiling my code is almost the same as a regular build, so I added a
profile target.

The problem is that I need to add -pg to CXXFLAGS and LDFLAGS in this
case, so that implicit rules work properly.

My understanding is that I can't do this via conditionals, since
conditionals don't depend on target choice.

I also think this won't work:
profile:
        CXXFLAGS += -pg
        ......

because the assignment will be local to the subshell executing the
CXXFLAGS line only.

At the moment, I just edit the Makefile appropriately, but that's not so
great.

I suspect the right thing is to make a separate directory for the
profile build anyway, since otherwise I may get confused and mix
different types of .o files (with and without -pg).  In that case the
problem is easy to solve.

So, any advice about how to handle profiling?

And, even if the separate directory solution is the right one, I'm still
curious if there's a way to set variables based on the target.  Again,
because I'm using implicit rules, the variable setting needs to be
"global;" I can't just add it to particular lines.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]