source: rtems/make/compilers/gcc.cfg.in @ 0162910

4.104.114.84.95
Last change on this file since 0162910 was 946b3cb, checked in by Joel Sherrill <joel.sherrill@…>, on Oct 14, 1998 at 7:42:45 PM

Patch from Ralf Corsepius <corsepiu@…>:

  1. "make profile" doesn't work. It aborts when building host-tools

for embedded targets. I didn't yet have enough time to fix this
problem. AFAIS this problem is related to handling of
LDFLAGS_PROFILE[|_V] in gcc.cfg.in. For host applications, we use
gcc for linking host applications, too. With profiling enabled
CFLAGS_PROFILE_V contains -pg and is used to compile, but
LDFLAGS_PROFILE_V is empty, hence -pg will not be passed to the
linker causing gcc to fail to link, because it can't resolve some
symbols introduced by compiling with -pg.

I am not sure if I can provide a patch for this - Ether it is trivial
to fix or requires basic work on host configuration ;-

Fixing this one was trivial - But hard to trace.

LDFLAGS_PROFILE_V needs to contain the same flags as CFLAGS_PROFILE_V,
if gcc is used for linking (What else should have been expected ?,
:-). The same problem was present for *_DEBUG_V, but apparently wasn't
noticed by anybody, because things didn't break, but were silently
ignored.

I fixed these problems by setting these flags in configure.in whenever
gcc is reported to be the host-compiler. For non-gcc host compilers
"make debug" and "make profile" now becomes the same as an ordinary
"make". This is a hack and addressing this problen could be more
sophisticated, but I don't think it gives much sense to support
compile variants for any host program (Who will ever try to
profile/debug host tools?). Therefore I don't think it's useful
to invest more effort into this problem.

  • Property mode set to 100644
File size: 4.8 KB
Line 
1#
2#  $Id$
3#
4# gcc 2.6.x native compiler
5# Compiler (and tools) configuration
6#
7
8# Additional target names (other than debug, profile)
9TARGET_VARIANTS +=
10
11#
12# Pre-processor defines.
13# Local tailoring (on the command line) can be done by setting XCPPFLAGS
14# which is never set in the Makefile's
15#
16
17CPPFLAGS=$(XCPPFLAGS) $(DEFINES)
18
19#
20# Local tailoring (on the command line) can be done by setting CFLAGS
21# which is never set in the Makefile's
22#
23
24#
25# CFLAGS_OPTIMIZE_V, CFLAGS_DEBUG_V, CFLAGS_PROFILE_V are the values we
26# would want the corresponding macros to be set to.
27#
28# CFLAGS_OPTIMIZE, CFLAGS_DEBUG, CFLAGS_PROFILE are set in the leaf
29# Makefiles by the 'debug:' and 'profile:' targets to their _V values.
30#
31
32# default flags
33
34CFLAGS_DEFAULT = @CC_CFLAGS_DEFAULT@
35
36#  Under MS-DOS do not use pipes
37#  It turns out the pipes don't work with some non-gas assemblers either. :(
38# ifneq ($(RTEMS_HOST),msdos)
39# # CFLAGS_DEFAULT += -pipe
40# CFLAGS_DEFAULT +=
41# endif
42
43# Additional target names (other than debug, profile)
44
45# optimize flag: typically -0, could use -O4 or -fast
46# -O4 is ok for RTEMS
47CFLAGS_OPTIMIZE_V=-O
48
49# debug flag; typically -g
50CFLAGS_DEBUG_V=@CC_CFLAGS_DEBUG_V@
51
52# when debugging, optimize flag: typically empty
53# some compilers do allow optimization with their "-g"
54CFLAGS_DEBUG_OPTIMIZE_V=
55
56# profile flag; use gprof(1)
57CFLAGS_PROFILE_V=@CC_CFLAGS_PROFILE_V@
58
59# default is to optimize
60CFLAGS_OPTIMIZE=$(CFLAGS_OPTIMIZE_V)
61
62# dynamic libraries
63CFLAGS_DYNAMIC_V=-fpic
64ASFLAGS_DYNAMIC_V=
65
66# XCFLAGS are now local flags to avoid conflict with cygnus configure
67XCFLAGS=$(CFLAGS_OPTIMIZE) $(CFLAGS_DEBUG) $(CFLAGS_PROFILE) \
68       $(CFLAGS_DEFAULT)
69
70# List of library paths without -L
71LD_PATHS=
72
73# libraries you want EVERYONE to link with
74LD_LIBS=
75
76# ld flag to ensure pure-text
77LDFLAGS_MUST_BE_PURE_V =
78
79# ld flag for [un]shared objects
80LDFLAGS_STATIC_LIBRARIES_V =
81LDFLAGS_SHARED_LIBRARIES_V =
82
83# ld flag for incomplete link
84LDFLAGS_INCOMPLETE = -r
85
86# Special linker options when building lib.so
87LDFLAGS_DYNAMIC_V = ??
88
89# Some dynamic linking systems want the preferred name recorded in the binary
90# ref: src/libxil/Makefile
91LDFLAGS_DYNAMIC_LIBNAME_V = -h $(DYNAMIC_VERSION_LIBNAME)
92
93# ld flags for profiling, debugging
94LDFLAGS_PROFILE_V = @CC_LDFLAGS_PROFILE_V@
95LDFLAGS_DEBUG_V =
96
97LDFLAGS=$(LDFLAGS_PROFILE) $(LDFLAGS_DEBUG) $(LD_PATHS:%=-L %)
98
99#
100# Stuff to clean and clobber for the compiler and its tools
101#
102
103CLEAN_CC = a.out *.o *.BAK
104CLOBBER_CC =
105
106#
107# Client compiler and support tools
108#
109
110# CC_FOR_BUILD=gcc -O
111# override CC=$(CC_FOR_BUILD)
112
113CC=@CC@
114
115# CPP command to write file to standard output
116CPP=$(CC) -E
117
118# flags set by cc when running cpp
119CPP_CC_FLAGS=-D__STDC__
120
121# egrep regexp to ignore symbol table entries in ar archives.
122# Only used to make sure we skip them when coalescing libraries.
123# skip __.SYMDEF and empty names (maybe bug in ranlib??).
124AR_SYMBOL_TABLE="HIGHLY-UNLIKELY-TO-CONFLICT"
125ARFLAGS=ruv
126
127#
128# Command to convert a normal archive to one searchable by $(LD)
129# Not needed on SVR4
130# FIXME: Should be handled by autoconf. Doesn't matter, because
131#        rtems doesn't have any host-libraries until now.
132#
133
134MKLIB=echo library is complete:
135
136#
137# How to compile stuff into ${ARCH} subdirectory
138#
139# NOTE: we override COMPILE.c
140#
141
142COMPILE.c=$(CC) $(CFLAGS) $(CPPFLAGS) $(XCFLAGS) -c
143
144${ARCH}/%.o: %.c
145        ${COMPILE.c} -o $@ $<
146
147${ARCH}/%.o: %.cc
148        ${COMPILE.c} -o $@ $<
149
150# assembly runs gasp
151${ARCH}/%.o: %.s
152        $(CPP) ${CPPFLAGS} $< | $(SED) 's/% /%/g' | $(SED) 's/^#.*//' >$(ARCH)/$*.i
153        $(AS) -o $@ $(ARCH)/$*.i
154        $(RM) $(ARCH)/$*.i
155
156# Link host applications.
157define make-exe
158        ${CC} ${LDFLAGS} -o $@ $^ ${LD_LIBS}
159endef
160
161# Specify our own default rule for this to prevent having CFLAGS and
162# CPPFLAGS being passed to linker
163#
164# NOTE: This rule is only used as fallback for host-tool makefiles
165# which don't provide their own rule
166${ARCH}/%$(EXEEXT): ${ARCH}/%.o
167        $(make-exe)
168
169# create $(ARCH)/pgm from pgm.sh
170${ARCH}/%: %.sh
171        $(RM) $@
172        $(CP) $< $@
173        $(CHMOD) +x $@
174
175# Dependency files for use by gmake
176# NOTE: we don't put in $(TARGET_ARCH)
177#       so that 'make clean' doesn't blow it away
178
179DEPEND=Depends-$(TARGET_ARCH:o-%=%)
180
181CLEAN_DEPEND=$(DEPEND).tmp
182CLOBBER_DEPEND=$(DEPEND)
183
184# We deliberately don't have anything depend on the
185# $(DEPEND) file; otherwise it will get rebuilt even
186# on 'make clean'
187#
188
189depend: $(C_FILES) $(CC_FILES) $(S_FILES)
190ifneq ($(words $(C_FILES) $(CC_FILES) $(S_FILES)), 0)
191#       Use gcc -M to generate dependencies
192#       Replace foo.o with $(ARCH)/foo.o
193#       Replace $(ARCH) value with string $(ARCH)
194#           so that it will for debug and profile cases
195        $(COMPILE.c) -M   $^    |  \
196        $(SED) -e 's?^\(.*\)\.o[ ]*:?$$(ARCH)/\1.o:?' \
197            -e 's?$(ARCH)/?$$(ARCH)/?'   >$(DEPEND).tmp
198        $(MV) $(DEPEND).tmp $(DEPEND)
199endif
200
201define make-rel
202        $(LD) $(LDFLAGS_INCOMPLETE) $(XLDFLAGS) -o $@ $(OBJS)
203endef
Note: See TracBrowser for help on using the repository browser.