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

4.104.114.84.95
Last change on this file since 3a8915e was 3a8915e, checked in by Joel Sherrill <joel.sherrill@…>, on Aug 6, 1999 at 5:55:25 PM

Patch rtems-rc-19990709-6-diff from Ralf Corsepius <corsepiu@…>
applied. This modified many Makefiles and custom files and makes many more
settings (network, multiprocessing, etc) gnerated by autoconf.

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