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

4.104.114.84.95
Last change on this file since 6703f877 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
RevLine 
[bffb938]1#
[c2c9c7e]2#  Shared compiler for all GNU tools configurations
3#
4#  $Id$
[bffb938]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
[a110b68]16# XCPPFLAGS, XCFLAGS, XCXXFLAGS, XASFLAGS
17# are used to add flags from the shell
18# cf. make.info ("Implicit rules/variables" for details)
19
[4d20133]20# NOTE: Should these go to CPPFLAGS ?
[65e6b542]21CFLAGS_DEFAULT=-g -Wall
[4d20133]22
23# NOTE: CPU_CFLAGS should probably be renamed to CPU_CPPFLAGS
24# NOTE: CPU_DEFINES should probably be merged with CPU_CFLAGS
[9608320]25CPPFLAGS += $(CPU_DEFINES) $(CPU_CFLAGS) $(DEFINES) $(XCPPFLAGS)
[4d20133]26CFLAGS   = $(CFLAGS_DEFAULT) $(XCFLAGS)
27CXXFLAGS = $(CFLAGS_DEFAULT) $(XCXXFLAGS)
[a110b68]28ASFLAGS  = $(CPU_ASFLAGS) $(XASFLAGS)
[bffb938]29
30ifeq ($(RTEMS_USE_GCC272),yes)
[6ee6abb]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
[a110b68]38CPPFLAGS += \
[72f9937b]39  -I$(PROJECT_INCLUDE) \
[a110b68]40  $(RTEMS_LIBC_INCLUDES)
[6ee6abb]41else
42# Used for embedded bsps
[bffb938]43# Ask gcc where it finds its own include files
[98100d2]44GCC_INCLUDE=$(shell $(CC) $(CPU_CFLAGS) -print-file-name=include $(GCCSED))
[bffb938]45
[a110b68]46CPPFLAGS += -nostdinc \
[72f9937b]47  -I$(PROJECT_INCLUDE) \
[a110b68]48  -I$(GCC_INCLUDE) \
49  -I$(RTEMS_LIBC_DIR)/sys-include \
50  -I$(RTEMS_LIBC_DIR)/include
[6ee6abb]51endif
[bffb938]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
[4cc89bd]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
[72f9937b]71CPPFLAGS +=
[bffb938]72
73# default location of Standard C Library
74ifndef LIBC_LIBC
[98100d2]75LIBC_LIBC=$(shell $(CC) $(CPU_CFLAGS) -print-file-name=libc.a $(GCCSED))
[bffb938]76endif
77
78ifndef LIBC_LIBM
[98100d2]79LIBC_LIBM=$(shell $(CC) $(CPU_CFLAGS) -print-file-name=libm.a $(GCCSED))
[bffb938]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.
[d6c83529]85ifeq ($(HAS_CPLUSPLUS),yes)
[bffb938]86CPLUS_LD_LIBS += $(PROJECT_RELEASE)/lib/librtems++$(LIBSUFFIX_VA)
87endif
88
[98100d2]89# debug flag;
[ac61209b]90CFLAGS_DEBUG_V+=-Wno-unused
[8ef3818]91CXXFLAGS_DEBUG_V+=
[bffb938]92
[a858910]93ifeq ($(RTEMS_USE_GCC272),no)
94CFLAGS_DEBUG_V+=-qrtems_debug
[8ef3818]95CXXFLAGS_DEBUG_V+=-qrtems_debug
[a858910]96endif
97
[8ef3818]98# when debugging, optimize flag: typically empty
99# some compilers do allow optimization with their "-g"
[93f79c0f]100CFLAGS_OPTIMIZE_V=-g
101CXXFLAGS_OPTIMIZE_V=-g
[8ef3818]102
[bffb938]103# profile flag; use gprof(1)
104CFLAGS_PROFILE_V=-pg
[8ef3818]105CXXFLAGS_PROFILE_V=-pg
[bffb938]106
[df49c60]107ifndef AUTOMAKE
[bffb938]108# default is to optimize
[8ef3818]109CFLAGS_OPTIMIZE  =$(CFLAGS_OPTIMIZE_V)
110CXXFLAGS_OPTIMIZE=$(CXXFLAGS_OPTIMIZE_V)
[df49c60]111endif
[bffb938]112
[df49c60]113ifndef AUTOMAKE
[8ef3818]114CFLAGS   += $(CFLAGS_OPTIMIZE) $(CFLAGS_DEBUG) $(CFLAGS_PROFILE)
115CXXFLAGS += $(CXXFLAGS_OPTIMIZE) $(CXXFLAGS_DEBUG) $(CXXFLAGS_PROFILE)
[df49c60]116endif
[bffb938]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
[93f79c0f]159CPP=$(CC) -E -w -Wp,-$$
[bffb938]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
[9608320]172        ${COMPILE.c} $(AM_CPPFLAGS) $(AM_CFLAGS) -o $@ $<
[bffb938]173
174${ARCH}/%.o: %.cc
[9608320]175        ${COMPILE.cc} $(AM_CPPFLAGS) $(AM_CXXFLAGS) -o $@ $<
[bffb938]176
[07001360]177${ARCH}/%.o: %.cpp
[9608320]178        ${COMPILE.cc} $(AM_CPPFLAGS) $(AM_CXXFLAGS) -o $@ $<
[07001360]179
180${ARCH}/%.o: %.cxx
[9608320]181        ${COMPILE.cc} $(AM_CPPFLAGS) $(AM_CXXFLAGS) -o $@ $<
[07001360]182
183${ARCH}/%.o: %.C
[9608320]184        ${COMPILE.cc} $(AM_CPPFLAGS) $(AM_CXXFLAGS) -o $@ $<
[07001360]185
[0162910]186${ARCH}/%.o: %.S
[9608320]187        ${COMPILE.S} $(AM_CPPFLAGS) -DASM -o $@ $<
[4d20133]188
[bffb938]189# Make foo.rel from foo.o
190${ARCH}/%.rel: ${ARCH}/%.o
[df49c60]191        ${make-rel}
[bffb938]192
193# create $(ARCH)/pgm from pgm.sh
[5b8c1b7]194${ARCH}/%: %.sh
[bffb938]195        $(RM) $@
196        $(CP) $< $@
197        $(CHMOD) +x $@
198
199# Dependency files for use by gmake
[d6c83529]200# NOTE: we don't put them into $(ARCH)
[bffb938]201#       so that 'make clean' doesn't blow it away
202
[d6c83529]203DEPEND=Depends-${ARCH}
[bffb938]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
[9f4868c]213depend-am: $(C_FILES) $(CC_FILES) $(S_FILES)
[bffb938]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
[df49c60]219        $(COMPILE.c) $(AM_CPPFLAGS) $(AM_CFLAGS) -M   $^    |  \
[bffb938]220        $(SED) -e 's?^\(.*\)\.o[ ]*:?$$(ARCH)/\1.o:?' \
221            -e 's?$(ARCH)/?$$(ARCH)/?'   >$(DEPEND).tmp
222        $(MV) $(DEPEND).tmp $(DEPEND)
223endif
[9f4868c]224depend: depend-am
[bffb938]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
[6ee6abb]244ifndef LIBGCC
[98100d2]245LIBGCC = $(shell $(CC) $(CFLAGS) -print-libgcc-file-name $(GCCSED))
[6ee6abb]246endif
[bffb938]247
[98100d2]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) \
[30cde042]255#       --start-group $(LINK_LIBS) --end-group
[98100d2]256#
257# gcc28:
258# $(PGM): $(LINK_FILES)
[30cde042]259#       $(CC) $(CFLAGS) -o $@ $(LINK_OBJS) $(LINK_LIBS)
[98100d2]260#
261
262LINK_OBJS =\
[bffb938]263    $(CONSTRUCTOR) \
264    $(OBJS) \
[3a8915e]265    $(MANAGERS_NOT_WANTED:%=$(PROJECT_RELEASE)/lib/no-%$(LIB_VARIANT).rel)
[bffb938]266
[98100d2]267LINK_FILES =\
[bffb938]268    $(START_FILE) \
[98100d2]269    $(CONSTRUCTOR) \
270    $(OBJS) \
271    $(MANAGERS_NOT_WANTED:%=$(PROJECT_RELEASE)/lib/no-%$(LIB_VARIANT).rel) \
[6703f877]272    $(PROJECT_RELEASE)/lib/librtemsbsp$(LIBSUFFIX_VA) \
[88f60e26]273    $(PROJECT_RELEASE)/lib/librtemscpu$(LIBSUFFIX_VA)
[98100d2]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)   
[bffb938]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
[df49c60]295ifeq ($(RTEMS_USE_GCC272),yes)
[bffb938]296define make-rel
[9f4868c]297        $(LD) $(LDFLAGS_INCOMPLETE) $(XLDFLAGS) -o $@ $^
[bffb938]298endef
[df49c60]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.