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

4.104.114.84.95
Last change on this file since d6c83529 was d6c83529, checked in by Joel Sherrill <joel.sherrill@…>, on 11/16/99 at 15:48:11

Patch rtems-rc-19991105-1.diff.gz from Ralf Corsepius
<corsepiu@…> which does the following:

This is the configuration cleanup patch:

Main changes:

  • TARGET_ARCH removed
  • target.cfg.in moved to c/make/target.cfg.in (Only configured once for all BSPs of a target)
  • BARE_XXX variables appended to bsp.cfg.in
  • autogen renamed to bootstrap
  • removed stray variables from make/custom/*.cfg

To apply:

cd <source-tree>
rm c/src/make/target.cfg.in
cp autogen bootstrap
mkdir c/make
cp make/target.cfg.in c/make/target.cfg.in
rm make/target.cfg.in
rm autogen
patch -p1 < rtems-rc-19991105-1.diff

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