Mail Archives: djgpp-workers/2001/12/24/10:14:10
Hello.
Martin Stromberg wrote:
> Ok. What if we have gcc-profile.opt and gcc-noprofile.opt and let
> "make" do "cp gcc-profile.opt gcc.opt; make clean; make; cp
> gcc-noprofile.opt gcc.opt; make clean; make;"? Or add a target
> "profile" that builds a profiling libc or something like that?
It might be cleaner to add something like this to src/makefile.inc:
PROFILE ?= 0
ifeq ($(PROFILE), 1)
PROFILE_CFLAGS=-pg
endif
and then use PROFILE_GCCOPTS in the XGCC, etc. rules, e.g.:
XGCC = $(CROSS_GCC) $(GCC_OPT) -I. -I- -isystem $(TOP)/../../include
$(CFLAGS)
$(PROFILE_CFLAGS)
XLGCC = $(CROSS_GCC) $(GCCL_OPT) -I. -I- -isystem $(TOP)/../../include
$(CFLAGS) $(PROFILE_CFLAGS)
We can't just add -pg to CFLAGS, because we don't want the non-profiling
gcc compile to use -pg:
XNOPGGCC = $(CROSS_GCC) $(shell sed -f $(TOP)/../noprof.sed
$(TOP)/../gcc.opt) -I. -I- -isystem $(TOP)/../../include $(CFLAGS)
With this you could get a profiling library like so:
cd src; make clean && make PROFILE=1
Another choice is to choose the options file depending on the setting of
PROFILE. I think this approach may be better, because then all compiler
options would be taken from files, rather than being modified by
environment variables. E.g.:
ifeq ($(PROFILE),1)
GCC_OPT_FILE=gcc-pg.opt
else
GCC_OPT_FILE=gcc.opt
endif
GCCL_OPT_FILE=gcc-l.opt
and replace all uses of $(TOP)/../gcc*.opt with the appropriate variable.
Bye, Rich =]
--
Richard Dawe [ http://www.phekda.freeserve.co.uk/richdawe/ ]
- Raw text -