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

4.104.114.84.95
Last change on this file since 8ef3818 was 8ef3818, checked in by Joel Sherrill <joel.sherrill@…>, on 06/12/00 at 19:57:02

Patch from John Cotton <john.cotton@…>, Charles-Antoine Gauthier
<charles.gauthier@…>, and Darlene A. Stewart
<Darlene.Stewart@…> to add support for a number of very
significant things:

+ BSPs for many variations on the Motorola MBX8xx board series
+ Cache Manager including initial support for m68040

and PowerPC

+ Rework of mpc8xx libcpu code so all mpc8xx CPUs now use

same code base.

+ Rework of eth_comm BSP to utiltize above.

John reports this works on the 821 and 860

  • Property mode set to 100644
File size: 7.6 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 -ansi -fasm
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_DEBUG_OPTIMIZE_V=-g
101CXXFLAGS_DEBUG_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
113# dynamic libraries
114#CFLAGS_DYNAMIC_V=-fpic
115#ASFLAGS_DYNAMIC_V=
116
117ifndef AUTOMAKE
118CFLAGS   += $(CFLAGS_OPTIMIZE) $(CFLAGS_DEBUG) $(CFLAGS_PROFILE)
119CXXFLAGS += $(CXXFLAGS_OPTIMIZE) $(CXXFLAGS_DEBUG) $(CXXFLAGS_PROFILE)
120endif
121
122# List of library paths without -L
123LD_PATHS= $(PROJECT_RELEASE)/lib
124
125# libraries you want EVERYONE to link with
126#LD_LIBS=
127
128# ld flag to ensure pure-text
129#LDFLAGS_MUST_BE_PURE_V =
130
131# ld flag for [un]shared objects
132#LDFLAGS_STATIC_LIBRARIES_V =
133#LDFLAGS_SHARED_LIBRARIES_V =
134
135# ld flag for incomplete link
136LDFLAGS_INCOMPLETE = -r
137
138# Special linker options when building lib.so
139LDFLAGS_DYNAMIC_V = ??
140
141# Some dynamic linking systems want the preferred name recorded in the binary
142# ref: src/libxil/Makefile
143LDFLAGS_DYNAMIC_LIBNAME_V = -h $(DYNAMIC_VERSION_LIBNAME)
144
145# ld flags for profiling, debugging
146LDFLAGS_PROFILE_V =
147LDFLAGS_DEBUG_V =
148
149LDFLAGS=$(LDFLAGS_PROFILE) $(LDFLAGS_DEBUG) $(LD_PATHS:%=-L %)
150
151#
152# Stuff to clean and clobber for the compiler and its tools
153#
154
155CLEAN_CC = a.out *.o *.BAK
156CLOBBER_CC =
157
158#
159# Client compiler and support tools
160#
161
162# CPP command to write file to standard output
163CPP=$(CC) -E -ansi -w -Wp,-$$
164
165# flags set by cc when running cpp
166# NOTE: CPP_CC_FLAGS does not seem to be used anywhere
167# CPP_CC_FLAGS=-D__STDC__
168
169# egrep regexp to ignore symbol table entries in ar archives.
170# Only used to make sure we skip them when coalescing libraries.
171# skip __.SYMDEF and empty names (maybe bug in ranlib??).
172AR_SYMBOL_TABLE="HIGHLY-UNLIKELY-TO-CONFLICT"
173ARFLAGS=ruv
174
175#
176# How to compile stuff into ${ARCH} subdirectory
177#
178
179${ARCH}/%.o: %.c
180        ${COMPILE.c} $(AM_CPPFLAGS) $(AM_CFLAGS) -o $@ $<
181
182${ARCH}/%.o: %.cc
183        ${COMPILE.cc} $(AM_CPPFLAGS) $(AM_CXXFLAGS) -o $@ $<
184
185${ARCH}/%.o: %.cpp
186        ${COMPILE.cc} $(AM_CPPFLAGS) $(AM_CXXFLAGS) -o $@ $<
187
188${ARCH}/%.o: %.cxx
189        ${COMPILE.cc} $(AM_CPPFLAGS) $(AM_CXXFLAGS) -o $@ $<
190
191${ARCH}/%.o: %.C
192        ${COMPILE.cc} $(AM_CPPFLAGS) $(AM_CXXFLAGS) -o $@ $<
193
194${ARCH}/%.o: %.S
195        ${COMPILE.S} $(AM_CPPFLAGS) -DASM -o $@ $<
196
197# Make foo.rel from foo.o
198${ARCH}/%.rel: ${ARCH}/%.o
199        ${make-rel}
200
201# create $(ARCH)/pgm from pgm.sh
202${ARCH}/%: %.sh
203        $(RM) $@
204        $(CP) $< $@
205        $(CHMOD) +x $@
206
207# Dependency files for use by gmake
208# NOTE: we don't put them into $(ARCH)
209#       so that 'make clean' doesn't blow it away
210
211DEPEND=Depends-${ARCH}
212
213CLEAN_DEPEND=$(DEPEND).tmp
214CLOBBER_DEPEND=$(DEPEND)
215
216# We deliberately don't have anything depend on the
217# $(DEPEND) file; otherwise it will get rebuilt even
218# on 'make clean'
219#
220
221depend-am: $(C_FILES) $(CC_FILES) $(S_FILES)
222ifneq ($(words $(C_FILES) $(CC_FILES) $(S_FILES)), 0)
223#       Use gcc -M to generate dependencies
224#       Replace foo.o with $(ARCH)/foo.o
225#       Replace $(ARCH) value with string $(ARCH)
226#           so that it will for debug and profile cases
227        $(COMPILE.c) $(AM_CPPFLAGS) $(AM_CFLAGS) -M   $^    |  \
228        $(SED) -e 's?^\(.*\)\.o[ ]*:?$$(ARCH)/\1.o:?' \
229            -e 's?$(ARCH)/?$$(ARCH)/?'   >$(DEPEND).tmp
230        $(MV) $(DEPEND).tmp $(DEPEND)
231endif
232depend: depend-am
233
234# spell out all the LINK_FILE's, rather than using -lbsp, so
235#  that $(LINK_FILES) can be a dependency
236
237# Start file must be one of
238#    $(PROJECT_RELEASE)/lib/start$(LIB_VARIANT).o
239#    $(PROJECT_RELEASE)/lib/asmiface$(LIB_VARIANT).o
240# It defaults to start.o, but an app can override it.
241
242ifeq ($(START_BASE),)
243  START_FILE=
244else
245  START_FILE=$(PROJECT_RELEASE)/lib/$(START_BASE)$(LIB_VARIANT).o
246endif
247
248CONSTRUCTOR=
249
250LIBC_LOW=
251
252ifndef LIBGCC
253LIBGCC = $(shell $(CC) $(CFLAGS) -print-libgcc-file-name $(GCCSED))
254endif
255
256#
257# NOTE: a rule to link an rtems' application should look similar to this
258#       (cf. "make-exe" in make/custom/*.cfg):
259#
260# gcc27:
261# $(PGM): $(LINK_FILES)
262#       $(LD) $(LDFLAGS) -o $@ $(LINK_OBJS) \
263#       --start-group $(LINK_LIBS) --end-group
264#
265# gcc28:
266# $(PGM): $(LINK_FILES)
267#       $(CC) $(CFLAGS) -o $@ $(LINK_OBJS) $(LINK_LIBS)
268#
269
270LINK_OBJS =\
271    $(CONSTRUCTOR) \
272    $(OBJS) \
273    $(MANAGERS_NOT_WANTED:%=$(PROJECT_RELEASE)/lib/no-%$(LIB_VARIANT).rel)
274
275LINK_FILES =\
276    $(START_FILE) \
277    $(CONSTRUCTOR) \
278    $(OBJS) \
279    $(MANAGERS_NOT_WANTED:%=$(PROJECT_RELEASE)/lib/no-%$(LIB_VARIANT).rel) \
280    $(PROJECT_RELEASE)/lib/librtemsall$(LIBSUFFIX_VA)
281
282ifeq ($(RTEMS_USE_GCC272),yes)
283LINK_LIBS = $(PROJECT_RELEASE)/lib/librtemsall$(LIBSUFFIX_VA)
284ifeq ($(RTEMS_CROSS_TARGET),yes)
285# NOTE: add libc and libgcc only for embedded targets
286#       LIBC_LIBM should not be needed by rtems itself.
287# FIXME: If a BSP requires libm, its make/custom/*.cfg file should add
288#        LIBC_LIBM to LINK_LIBS (untested)
289LINK_LIBS += $(LIBC_LIBC) $(LIBGCC)
290endif
291endif
292
293LINK_LIBS += $(LD_LIBS)   
294
295#
296# Allow user to override link commands (to build a prom image, perhaps)
297#
298ifndef LINKCMDS
299LINKCMDS=$(PROJECT_RELEASE)/lib/linkcmds
300endif
301
302ifeq ($(RTEMS_USE_GCC272),yes)
303define make-rel
304        $(LD) $(LDFLAGS_INCOMPLETE) $(XLDFLAGS) -o $@ $^
305endef
306else
307define make-rel
308        $(LINK.c) $(AM_CFLAGS) $(AM_LDFLAGS) \
309          -qnolinkcmds -nostdlib -Wl,-r $(XLDFLAGS) -o $@ $^
310endef
311endif
Note: See TracBrowser for help on using the repository browser.