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

4.104.114.84.95
Last change on this file since c8f05db was 6703f877, checked in by Joel Sherrill <joel.sherrill@…>, on 01/22/02 at 17:35:22

2002-01-21 Ralf Corsepius <corsepiu@…>

  • compilers/gcc-target-default.cfg: Add missing \. Reported by Ilya Alexeev <ilya@…>.
  • Property mode set to 100644
File size: 7.5 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
30ifeq ($(RTEMS_USE_GCC272),yes)
31ifeq ($(RTEMS_CROSS_TARGET),no)
32
33ifdef RTEMS_LIBC_DIR
34RTEMS_LIBC_INCLUDES := -I$(RTEMS_LIBC_DIR)/include
35endif
36
37# Used for posix bsps
38CPPFLAGS += \
39  -I$(PROJECT_INCLUDE) \
40  $(RTEMS_LIBC_INCLUDES)
41else
42# Used for embedded bsps
43# Ask gcc where it finds its own include files
44GCC_INCLUDE=$(shell $(CC) $(CPU_CFLAGS) -print-file-name=include $(GCCSED))
45
46CPPFLAGS += -nostdinc \
47  -I$(PROJECT_INCLUDE) \
48  -I$(GCC_INCLUDE) \
49  -I$(RTEMS_LIBC_DIR)/sys-include \
50  -I$(RTEMS_LIBC_DIR)/include
51endif
52
53# default location of Standard C Library
54ifndef LIBC_LIBC
55LIBC_LIBC=$(RTEMS_LIBC_DIR)/lib/libc.a
56endif
57
58ifndef LIBC_LIBM
59LIBC_LIBM=$(RTEMS_LIBC_DIR)/lib/libm.a
60endif
61
62else
63# NOTE: GCCSPECS probably belongs to CPPFLAGS
64# Unfortunately, many custom/*.cfg files do not pass CPPFLAGS
65# to their gcc-2.8 make-exe rules
66GCCSPECS = -B$(PROJECT_RELEASE)/lib/ -specs bsp_specs -qrtems
67 
68CC  += $(GCCSPECS)
69CXX += $(GCCSPECS)
70
71CPPFLAGS +=
72
73# default location of Standard C Library
74ifndef LIBC_LIBC
75LIBC_LIBC=$(shell $(CC) $(CPU_CFLAGS) -print-file-name=libc.a $(GCCSED))
76endif
77
78ifndef LIBC_LIBM
79LIBC_LIBM=$(shell $(CC) $(CPU_CFLAGS) -print-file-name=libm.a $(GCCSED))
80endif
81endif
82
83# Define this to yes if C++ is included in the development environment.
84# This requires that at least the GNU C++ compiler and libg++ be installed.
85ifeq ($(HAS_CPLUSPLUS),yes)
86CPLUS_LD_LIBS += $(PROJECT_RELEASE)/lib/librtems++$(LIBSUFFIX_VA)
87endif
88
89# debug flag;
90CFLAGS_DEBUG_V+=-Wno-unused
91CXXFLAGS_DEBUG_V+=
92
93ifeq ($(RTEMS_USE_GCC272),no)
94CFLAGS_DEBUG_V+=-qrtems_debug
95CXXFLAGS_DEBUG_V+=-qrtems_debug
96endif
97
98# when debugging, optimize flag: typically empty
99# some compilers do allow optimization with their "-g"
100CFLAGS_OPTIMIZE_V=-g
101CXXFLAGS_OPTIMIZE_V=-g
102
103# profile flag; use gprof(1)
104CFLAGS_PROFILE_V=-pg
105CXXFLAGS_PROFILE_V=-pg
106
107ifndef AUTOMAKE
108# default is to optimize
109CFLAGS_OPTIMIZE  =$(CFLAGS_OPTIMIZE_V)
110CXXFLAGS_OPTIMIZE=$(CXXFLAGS_OPTIMIZE_V)
111endif
112
113ifndef AUTOMAKE
114CFLAGS   += $(CFLAGS_OPTIMIZE) $(CFLAGS_DEBUG) $(CFLAGS_PROFILE)
115CXXFLAGS += $(CXXFLAGS_OPTIMIZE) $(CXXFLAGS_DEBUG) $(CXXFLAGS_PROFILE)
116endif
117
118# List of library paths without -L
119LD_PATHS= $(PROJECT_RELEASE)/lib
120
121# libraries you want EVERYONE to link with
122#LD_LIBS=
123
124# ld flag to ensure pure-text
125#LDFLAGS_MUST_BE_PURE_V =
126
127# ld flag for [un]shared objects
128#LDFLAGS_STATIC_LIBRARIES_V =
129#LDFLAGS_SHARED_LIBRARIES_V =
130
131# ld flag for incomplete link
132LDFLAGS_INCOMPLETE = -r
133
134# Special linker options when building lib.so
135LDFLAGS_DYNAMIC_V = ??
136
137# Some dynamic linking systems want the preferred name recorded in the binary
138# ref: src/libxil/Makefile
139LDFLAGS_DYNAMIC_LIBNAME_V = -h $(DYNAMIC_VERSION_LIBNAME)
140
141# ld flags for profiling, debugging
142LDFLAGS_PROFILE_V =
143LDFLAGS_DEBUG_V =
144
145LDFLAGS=$(LDFLAGS_PROFILE) $(LDFLAGS_DEBUG) $(LD_PATHS:%=-L %)
146
147#
148# Stuff to clean and clobber for the compiler and its tools
149#
150
151CLEAN_CC = a.out *.o *.BAK
152CLOBBER_CC =
153
154#
155# Client compiler and support tools
156#
157
158# CPP command to write file to standard output
159CPP=$(CC) -E -w -Wp,-$$
160
161# egrep regexp to ignore symbol table entries in ar archives.
162# Only used to make sure we skip them when coalescing libraries.
163# skip __.SYMDEF and empty names (maybe bug in ranlib??).
164AR_SYMBOL_TABLE="HIGHLY-UNLIKELY-TO-CONFLICT"
165ARFLAGS=ruv
166
167#
168# How to compile stuff into ${ARCH} subdirectory
169#
170
171${ARCH}/%.o: %.c
172        ${COMPILE.c} $(AM_CPPFLAGS) $(AM_CFLAGS) -o $@ $<
173
174${ARCH}/%.o: %.cc
175        ${COMPILE.cc} $(AM_CPPFLAGS) $(AM_CXXFLAGS) -o $@ $<
176
177${ARCH}/%.o: %.cpp
178        ${COMPILE.cc} $(AM_CPPFLAGS) $(AM_CXXFLAGS) -o $@ $<
179
180${ARCH}/%.o: %.cxx
181        ${COMPILE.cc} $(AM_CPPFLAGS) $(AM_CXXFLAGS) -o $@ $<
182
183${ARCH}/%.o: %.C
184        ${COMPILE.cc} $(AM_CPPFLAGS) $(AM_CXXFLAGS) -o $@ $<
185
186${ARCH}/%.o: %.S
187        ${COMPILE.S} $(AM_CPPFLAGS) -DASM -o $@ $<
188
189# Make foo.rel from foo.o
190${ARCH}/%.rel: ${ARCH}/%.o
191        ${make-rel}
192
193# create $(ARCH)/pgm from pgm.sh
194${ARCH}/%: %.sh
195        $(RM) $@
196        $(CP) $< $@
197        $(CHMOD) +x $@
198
199# Dependency files for use by gmake
200# NOTE: we don't put them into $(ARCH)
201#       so that 'make clean' doesn't blow it away
202
203DEPEND=Depends-${ARCH}
204
205CLEAN_DEPEND=$(DEPEND).tmp
206CLOBBER_DEPEND=$(DEPEND)
207
208# We deliberately don't have anything depend on the
209# $(DEPEND) file; otherwise it will get rebuilt even
210# on 'make clean'
211#
212
213depend-am: $(C_FILES) $(CC_FILES) $(S_FILES)
214ifneq ($(words $(C_FILES) $(CC_FILES) $(S_FILES)), 0)
215#       Use gcc -M to generate dependencies
216#       Replace foo.o with $(ARCH)/foo.o
217#       Replace $(ARCH) value with string $(ARCH)
218#           so that it will for debug and profile cases
219        $(COMPILE.c) $(AM_CPPFLAGS) $(AM_CFLAGS) -M   $^    |  \
220        $(SED) -e 's?^\(.*\)\.o[ ]*:?$$(ARCH)/\1.o:?' \
221            -e 's?$(ARCH)/?$$(ARCH)/?'   >$(DEPEND).tmp
222        $(MV) $(DEPEND).tmp $(DEPEND)
223endif
224depend: depend-am
225
226# spell out all the LINK_FILE's, rather than using -lbsp, so
227#  that $(LINK_FILES) can be a dependency
228
229# Start file must be one of
230#    $(PROJECT_RELEASE)/lib/start$(LIB_VARIANT).o
231#    $(PROJECT_RELEASE)/lib/asmiface$(LIB_VARIANT).o
232# It defaults to start.o, but an app can override it.
233
234ifeq ($(START_BASE),)
235  START_FILE=
236else
237  START_FILE=$(PROJECT_RELEASE)/lib/$(START_BASE)$(LIB_VARIANT).o
238endif
239
240CONSTRUCTOR=
241
242LIBC_LOW=
243
244ifndef LIBGCC
245LIBGCC = $(shell $(CC) $(CFLAGS) -print-libgcc-file-name $(GCCSED))
246endif
247
248#
249# NOTE: a rule to link an rtems' application should look similar to this
250#       (cf. "make-exe" in make/custom/*.cfg):
251#
252# gcc27:
253# $(PGM): $(LINK_FILES)
254#       $(LD) $(LDFLAGS) -o $@ $(LINK_OBJS) \
255#       --start-group $(LINK_LIBS) --end-group
256#
257# gcc28:
258# $(PGM): $(LINK_FILES)
259#       $(CC) $(CFLAGS) -o $@ $(LINK_OBJS) $(LINK_LIBS)
260#
261
262LINK_OBJS =\
263    $(CONSTRUCTOR) \
264    $(OBJS) \
265    $(MANAGERS_NOT_WANTED:%=$(PROJECT_RELEASE)/lib/no-%$(LIB_VARIANT).rel)
266
267LINK_FILES =\
268    $(START_FILE) \
269    $(CONSTRUCTOR) \
270    $(OBJS) \
271    $(MANAGERS_NOT_WANTED:%=$(PROJECT_RELEASE)/lib/no-%$(LIB_VARIANT).rel) \
272    $(PROJECT_RELEASE)/lib/librtemsbsp$(LIBSUFFIX_VA) \
273    $(PROJECT_RELEASE)/lib/librtemscpu$(LIBSUFFIX_VA)
274
275ifeq ($(RTEMS_USE_GCC272),yes)
276LINK_LIBS = $(PROJECT_RELEASE)/lib/librtemsall$(LIBSUFFIX_VA)
277ifeq ($(RTEMS_CROSS_TARGET),yes)
278# NOTE: add libc and libgcc only for embedded targets
279#       LIBC_LIBM should not be needed by rtems itself.
280# FIXME: If a BSP requires libm, its make/custom/*.cfg file should add
281#        LIBC_LIBM to LINK_LIBS (untested)
282LINK_LIBS += $(LIBC_LIBC) $(LIBGCC)
283endif
284endif
285
286LINK_LIBS += $(LD_LIBS)   
287
288#
289# Allow user to override link commands (to build a prom image, perhaps)
290#
291ifndef LINKCMDS
292LINKCMDS=$(PROJECT_RELEASE)/lib/linkcmds
293endif
294
295ifeq ($(RTEMS_USE_GCC272),yes)
296define make-rel
297        $(LD) $(LDFLAGS_INCOMPLETE) $(XLDFLAGS) -o $@ $^
298endef
299else
300define make-rel
301        $(LINK.c) $(AM_CFLAGS) $(AM_LDFLAGS) \
302          -qnolinkcmds -nostdlib -Wl,-r $(XLDFLAGS) -o $@ $^
303endef
304endif
Note: See TracBrowser for help on using the repository browser.