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

4.104.114.84.95
Last change on this file since f4a8ee1 was f4a8ee1, checked in by Joel Sherrill <joel.sherrill@…>, on Mar 17, 1999 at 4:01:03 PM

Unlimited objects patch from Chris Johns <ccj@…>. Email follows:

First, the unlimited patch. I have compiled the unlmited patch for the
Linux posix BSP only and it seems to work cleanly. I would like a really
major application run on this change before commiting as the changes are
very core and significant. I am currently building all the tests to run.

I have no targets suitable to test on at the moment.

I have tested the patch for inline functions and macros.

Turning macros on has found some core bugs. I have fixed these but have
not run all the tests. Please review the patch for these changes. They
are:

1) The conditional compilation for MP support broke the core messages
code. You cannot embed a conditional macro in another macro. The Send
and Urgent Send calls are macros.

2) User extensions handler initialisation now has two parameters. I have
updated the macros to support the extra parameter.

The patch also contains the gcc-target-default.cfg fix required to build
the kernel. More of a by product than a fix for you.

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