source: rtems/make/compilers/gcc-target-default.cfg @ 45789f2

4.104.114.84.95
Last change on this file since 45789f2 was ccf2cfd, checked in by Joel Sherrill <joel.sherrill@…>, on Sep 13, 2002 at 1:39:52 PM

2002-09-13 Joel Sherrill <joel@…>

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