source: rtems/c/src/make/compilers/gcc-target-default.cfg @ df413e9

4.104.114.84.95
Last change on this file since df413e9 was df413e9, checked in by Ralf Corsepius <ralf.corsepius@…>, on 11/12/02 at 10:32:05

2002-11-12 Ralf Corsepius <corsepiu@…>

  • compilers/gcc-target-default.cfg: Add -qrtems-debug handling.
  • Property mode set to 100644
File size: 5.8 KB
Line 
1#
2#  Shared compiler for all GNU tools configurations
3#
4#  $Id$
5#
6
7##
8# CFLAGS_OPTIMIZE_V, CFLAGS_DEBUG_V, CFLAGS_PROFILE_V are the values we
9# would want the corresponding macros to be set to.
10#
11# CFLAGS_OPTIMIZE, CFLAGS_DEBUG, CFLAGS_PROFILE are set in the leaf
12# Makefiles by the 'debug:' and 'profile:' targets to their _V values.
13#
14
15# default flags
16# XCPPFLAGS, XCFLAGS, XCXXFLAGS, XASFLAGS
17# are used to add flags from the shell
18# cf. make.info ("Implicit rules/variables" for details)
19
20# NOTE: Should these go to CPPFLAGS ?
21CFLAGS_DEFAULT=-g -Wall
22
23# NOTE: CPU_CFLAGS should probably be renamed to CPU_CPPFLAGS
24# NOTE: CPU_DEFINES should probably be merged with CPU_CFLAGS
25CPPFLAGS += $(CPU_DEFINES) $(CPU_CFLAGS) $(DEFINES) $(XCPPFLAGS)
26CFLAGS   = $(CFLAGS_DEFAULT) $(XCFLAGS)
27CXXFLAGS = $(CFLAGS_DEFAULT) $(XCXXFLAGS)
28ASFLAGS  = $(CPU_ASFLAGS) $(XASFLAGS)
29
30# NOTE: GCCSPECS probably belongs to CPPFLAGS
31GCCSPECS_OPTIMIZE_V =
32GCCSPECS_DEBUG_V = -qrtems_debug
33GCCSPECS_PROFILE_V =
34
35GCCSPECS = -B$(PROJECT_RELEASE)/lib/ -specs bsp_specs -qrtems
36GCCSPECS += $(GCCSPECS_$(VARIANT_V)_V)
37
38CC  += $(GCCSPECS)
39CXX += $(GCCSPECS)
40
41CPPFLAGS +=
42
43# Define this to yes if C++ is included in the development environment.
44# This requires that at least the GNU C++ compiler and libg++ be installed.
45ifeq ($(HAS_CPLUSPLUS),yes)
46CPLUS_LD_LIBS += $(PROJECT_RELEASE)/lib/librtems++$(LIBSUFFIX_VA)
47endif
48
49# debug flag;
50CFLAGS_DEBUG_V+=-Wno-unused
51CXXFLAGS_DEBUG_V+=
52
53CFLAGS_DEBUG_V+=-qrtems_debug
54CXXFLAGS_DEBUG_V+=-qrtems_debug
55
56# when debugging, optimize flag: typically empty
57# some compilers do allow optimization with their "-g"
58CFLAGS_OPTIMIZE_V=-g
59CXXFLAGS_OPTIMIZE_V=-g
60
61# profile flag; use gprof(1)
62CFLAGS_PROFILE_V=-pg
63CXXFLAGS_PROFILE_V=-pg
64
65ifndef AUTOMAKE
66# default is to optimize
67CFLAGS_OPTIMIZE  =$(CFLAGS_OPTIMIZE_V)
68CXXFLAGS_OPTIMIZE=$(CXXFLAGS_OPTIMIZE_V)
69endif
70
71ifndef AUTOMAKE
72CFLAGS   += $(CFLAGS_OPTIMIZE) $(CFLAGS_DEBUG) $(CFLAGS_PROFILE)
73CXXFLAGS += $(CXXFLAGS_OPTIMIZE) $(CXXFLAGS_DEBUG) $(CXXFLAGS_PROFILE)
74endif
75
76# List of library paths without -L
77LD_PATHS= $(PROJECT_RELEASE)/lib
78
79# libraries you want EVERYONE to link with
80#LD_LIBS=
81
82# ld flag to ensure pure-text
83#LDFLAGS_MUST_BE_PURE_V =
84
85# ld flag for [un]shared objects
86#LDFLAGS_STATIC_LIBRARIES_V =
87#LDFLAGS_SHARED_LIBRARIES_V =
88
89# ld flag for incomplete link
90LDFLAGS_INCOMPLETE = -r
91
92# Special linker options when building lib.so
93LDFLAGS_DYNAMIC_V = ??
94
95# Some dynamic linking systems want the preferred name recorded in the binary
96# ref: src/libxil/Makefile
97LDFLAGS_DYNAMIC_LIBNAME_V = -h $(DYNAMIC_VERSION_LIBNAME)
98
99# ld flags for profiling, debugging
100LDFLAGS_PROFILE_V =
101LDFLAGS_DEBUG_V = -qrtems_debug
102
103LDFLAGS=$(LDFLAGS_PROFILE) $(LDFLAGS_DEBUG) $(LD_PATHS:%=-L %)
104
105#
106# Stuff to clean and clobber for the compiler and its tools
107#
108
109CLEAN_CC = a.out *.o *.BAK
110CLOBBER_CC =
111
112#
113# Client compiler and support tools
114#
115
116# CPP command to write file to standard output
117CPP=$(CC) -E -w -Wp,-$$
118
119# egrep regexp to ignore symbol table entries in ar archives.
120# Only used to make sure we skip them when coalescing libraries.
121# skip __.SYMDEF and empty names (maybe bug in ranlib??).
122AR_SYMBOL_TABLE="HIGHLY-UNLIKELY-TO-CONFLICT"
123ARFLAGS=ruv
124
125#
126# How to compile stuff into ${ARCH} subdirectory
127#
128
129${ARCH}/%.o: %.c
130        ${COMPILE.c} $(AM_CPPFLAGS) $(AM_CFLAGS) -o $@ $<
131
132${ARCH}/%.o: %.cc
133        ${COMPILE.cc} $(AM_CPPFLAGS) $(AM_CXXFLAGS) -o $@ $<
134
135${ARCH}/%.o: %.cpp
136        ${COMPILE.cc} $(AM_CPPFLAGS) $(AM_CXXFLAGS) -o $@ $<
137
138${ARCH}/%.o: %.cxx
139        ${COMPILE.cc} $(AM_CPPFLAGS) $(AM_CXXFLAGS) -o $@ $<
140
141${ARCH}/%.o: %.C
142        ${COMPILE.cc} $(AM_CPPFLAGS) $(AM_CXXFLAGS) -o $@ $<
143
144${ARCH}/%.o: %.S
145        ${COMPILE.S} $(AM_CPPFLAGS) -DASM -o $@ $<
146
147# Make foo.rel from foo.o
148${ARCH}/%.rel: ${ARCH}/%.o
149        ${make-rel}
150
151# create $(ARCH)/pgm from pgm.sh
152${ARCH}/%: %.sh
153        $(RM) $@
154        $(CP) $< $@
155        $(CHMOD) +x $@
156
157# Dependency files for use by gmake
158# NOTE: we don't put them into $(ARCH)
159#       so that 'make clean' doesn't blow it away
160
161DEPEND=Depends-${ARCH}
162
163CLEAN_DEPEND=$(DEPEND).tmp
164CLOBBER_DEPEND=$(DEPEND)
165
166# We deliberately don't have anything depend on the
167# $(DEPEND) file; otherwise it will get rebuilt even
168# on 'make clean'
169#
170
171depend-am: $(C_FILES) $(CC_FILES) $(S_FILES)
172ifneq ($(words $(C_FILES) $(CC_FILES) $(S_FILES)), 0)
173#       Use gcc -M to generate dependencies
174#       Replace foo.o with $(ARCH)/foo.o
175#       Replace $(ARCH) value with string $(ARCH)
176#           so that it will for debug and profile cases
177        $(COMPILE.c) $(AM_CPPFLAGS) $(AM_CFLAGS) -M   $^    |  \
178        $(SED) -e 's?^\(.*\)\.o[ ]*:?$$(ARCH)/\1.o:?' \
179            -e 's?$(ARCH)/?$$(ARCH)/?'   >$(DEPEND).tmp
180        $(MV) $(DEPEND).tmp $(DEPEND)
181endif
182depend: depend-am
183
184# spell out all the LINK_FILE's, rather than using -lbsp, so
185#  that $(LINK_FILES) can be a dependency
186
187# Start file must be one of
188#    $(PROJECT_RELEASE)/lib/start$(LIB_VARIANT).o
189#    $(PROJECT_RELEASE)/lib/asmiface$(LIB_VARIANT).o
190# It defaults to start.o, but an app can override it.
191
192ifeq ($(START_BASE),)
193  START_FILE=
194else
195  START_FILE=$(PROJECT_RELEASE)/lib/$(START_BASE)$(LIB_VARIANT).o
196endif
197
198#
199# NOTE: a rule to link an rtems' application should look similar to this
200#       (cf. "make-exe" in make/custom/*.cfg):
201#
202# gcc28:
203# $(PGM): $(LINK_FILES)
204#       $(CC) $(CFLAGS) -o $@ $(LINK_OBJS) $(LINK_LIBS)
205#
206
207LINK_OBJS =\
208    $(CONSTRUCTOR) \
209    $(OBJS) \
210    $(MANAGERS_NOT_WANTED:%=$(PROJECT_RELEASE)/lib/no-%$(LIB_VARIANT).rel)
211
212LINK_FILES =\
213    $(START_FILE) \
214    $(CONSTRUCTOR) \
215    $(OBJS) \
216    $(MANAGERS_NOT_WANTED:%=$(PROJECT_RELEASE)/lib/no-%$(LIB_VARIANT).rel) \
217    $(PROJECT_RELEASE)/lib/librtemsbsp$(LIBSUFFIX_VA) \
218    $(PROJECT_RELEASE)/lib/librtemscpu$(LIBSUFFIX_VA)
219
220LINK_LIBS += $(LD_LIBS)   
221
222#
223# Allow user to override link commands (to build a prom image, perhaps)
224#
225ifndef LINKCMDS
226LINKCMDS=$(PROJECT_RELEASE)/lib/linkcmds
227endif
228
229define make-rel
230        $(LINK.c) $(CFLAGS) $(AM_CFLAGS) $(AM_LDFLAGS) \
231          -qnolinkcmds -nostdlib -Wl,-r $(XLDFLAGS) -o $@ $^
232endef
Note: See TracBrowser for help on using the repository browser.