source: rtems/make/compilers/gcc-target-default.cfg @ 581c3117

4.104.114.84.95
Last change on this file since 581c3117 was c2646c8, checked in by Joel Sherrill <joel.sherrill@…>, on 11/18/02 at 00:42:53

2002-11-17 Joel Sherrill <joel@…>

  • leaf.cfg, main.cfg, compilers/gcc-target-default.cfg: Make build variants work for user applications post install.
  • Property mode set to 100644
File size: 5.8 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
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# NOTE: GCCSPECS probably belongs to CPPFLAGS
31# Unfortunately, many custom/*.cfg files do not pass CPPFLAGS
32# to their gcc-2.8 make-exe rules
33GCCSPECS = -B$(PROJECT_RELEASE)/lib/ -specs bsp_specs -qrtems
34 
35CC  += $(GCCSPECS)
36CXX += $(GCCSPECS)
37
38CPPFLAGS +=
39
40# Define this to yes if C++ is included in the development environment.
41# This requires that at least the GNU C++ compiler and libg++ be installed.
42ifeq ($(HAS_CPLUSPLUS),yes)
43CPLUS_LD_LIBS += $(PROJECT_RELEASE)/lib/librtems++$(LIBSUFFIX_VA)
44endif
45
46# debug flag;
47CFLAGS_DEBUG_V+=-Wno-unused
48CXXFLAGS_DEBUG_V+=
49
50CFLAGS_DEBUG_V+=-qrtems_debug
51CXXFLAGS_DEBUG_V+=-qrtems_debug
52
53# when debugging, optimize flag: typically empty
54# some compilers do allow optimization with their "-g"
55CFLAGS_OPTIMIZE_V+=-g
56CXXFLAGS_OPTIMIZE_V+=-g
57
58# profile flag; use gprof(1)
59CFLAGS_PROFILE_V+=-pg
60CXXFLAGS_PROFILE_V+=-pg
61
62ifndef AUTOMAKE
63CFLAGS_$(VARIANT)  =$(CFLAGS_$(VARIANT)_V)
64CXXFLAGS_$(VARIANT)=$(CXXFLAGS_$(VARIANT)_V)
65endif
66
67ifndef AUTOMAKE
68CFLAGS   += $(CFLAGS_OPTIMIZE) $(CFLAGS_DEBUG) $(CFLAGS_PROFILE)
69CXXFLAGS += $(CXXFLAGS_OPTIMIZE) $(CXXFLAGS_DEBUG) $(CXXFLAGS_PROFILE)
70endif
71
72# List of library paths without -L
73LD_PATHS= $(PROJECT_RELEASE)/lib
74
75# libraries you want EVERYONE to link with
76#LD_LIBS=
77
78# ld flag to ensure pure-text
79#LDFLAGS_MUST_BE_PURE_V =
80
81# ld flag for [un]shared objects
82#LDFLAGS_STATIC_LIBRARIES_V =
83#LDFLAGS_SHARED_LIBRARIES_V =
84
85# ld flag for incomplete link
86LDFLAGS_INCOMPLETE = -r
87
88# Special linker options when building lib.so
89LDFLAGS_DYNAMIC_V = ??
90
91# Some dynamic linking systems want the preferred name recorded in the binary
92# ref: src/libxil/Makefile
93LDFLAGS_DYNAMIC_LIBNAME_V = -h $(DYNAMIC_VERSION_LIBNAME)
94
95# ld flags for profiling, debugging
96LDFLAGS_PROFILE_V =
97LDFLAGS_DEBUG_V = -qrtems_debug
98
99LDFLAGS=$(LDFLAGS_PROFILE) $(LDFLAGS_DEBUG) $(LD_PATHS:%=-L %)
100
101#
102# Stuff to clean and clobber for the compiler and its tools
103#
104
105CLEAN_CC = a.out *.o *.BAK
106CLOBBER_CC =
107
108#
109# Client compiler and support tools
110#
111
112# CPP command to write file to standard output
113CPP=$(CC) -E -w -Wp,-$$
114
115# egrep regexp to ignore symbol table entries in ar archives.
116# Only used to make sure we skip them when coalescing libraries.
117# skip __.SYMDEF and empty names (maybe bug in ranlib??).
118AR_SYMBOL_TABLE="HIGHLY-UNLIKELY-TO-CONFLICT"
119ARFLAGS=ruv
120
121#
122# How to compile stuff into ${ARCH} subdirectory
123#
124
125${ARCH}/%.o: %.c
126        ${COMPILE.c} $(AM_CPPFLAGS) $(AM_CFLAGS) -o $@ $<
127
128${ARCH}/%.o: %.cc
129        ${COMPILE.cc} $(AM_CPPFLAGS) $(AM_CXXFLAGS) -o $@ $<
130
131${ARCH}/%.o: %.cpp
132        ${COMPILE.cc} $(AM_CPPFLAGS) $(AM_CXXFLAGS) -o $@ $<
133
134${ARCH}/%.o: %.cxx
135        ${COMPILE.cc} $(AM_CPPFLAGS) $(AM_CXXFLAGS) -o $@ $<
136
137${ARCH}/%.o: %.C
138        ${COMPILE.cc} $(AM_CPPFLAGS) $(AM_CXXFLAGS) -o $@ $<
139
140${ARCH}/%.o: %.S
141        ${COMPILE.S} $(AM_CPPFLAGS) -DASM -o $@ $<
142
143# Make foo.rel from foo.o
144${ARCH}/%.rel: ${ARCH}/%.o
145        ${make-rel}
146
147# create $(ARCH)/pgm from pgm.sh
148${ARCH}/%: %.sh
149        $(RM) $@
150        $(CP) $< $@
151        $(CHMOD) +x $@
152
153# Dependency files for use by gmake
154# NOTE: we don't put them into $(ARCH)
155#       so that 'make clean' doesn't blow it away
156
157DEPEND=Depends-${ARCH}
158
159CLEAN_DEPEND=$(DEPEND).tmp
160CLOBBER_DEPEND=$(DEPEND)
161
162# We deliberately don't have anything depend on the
163# $(DEPEND) file; otherwise it will get rebuilt even
164# on 'make clean'
165#
166
167depend-am: $(C_FILES) $(CC_FILES) $(S_FILES)
168ifneq ($(words $(C_FILES) $(CC_FILES) $(S_FILES)), 0)
169#       Use gcc -M to generate dependencies
170#       Replace foo.o with $(ARCH)/foo.o
171#       Replace $(ARCH) value with string $(ARCH)
172#           so that it will for debug and profile cases
173        $(COMPILE.c) $(AM_CPPFLAGS) $(AM_CFLAGS) -M   $^    |  \
174        $(SED) -e 's?^\(.*\)\.o[ ]*:?$$(ARCH)/\1.o:?' \
175            -e 's?$(ARCH)/?$$(ARCH)/?'   >$(DEPEND).tmp
176        $(MV) $(DEPEND).tmp $(DEPEND)
177endif
178depend: depend-am
179
180# spell out all the LINK_FILE's, rather than using -lbsp, so
181#  that $(LINK_FILES) can be a dependency
182
183# Start file must be one of
184#    $(PROJECT_RELEASE)/lib/start$(LIB_VARIANT).o
185#    $(PROJECT_RELEASE)/lib/asmiface$(LIB_VARIANT).o
186# It defaults to start.o, but an app can override it.
187
188ifeq ($(START_BASE),)
189  START_FILE=
190else
191  START_FILE=$(PROJECT_RELEASE)/lib/$(START_BASE)$(LIB_VARIANT).o
192endif
193
194#
195# NOTE: a rule to link an rtems' application should look similar to this
196#       (cf. "make-exe" in make/custom/*.cfg):
197#
198# gcc28:
199# $(PGM): $(LINK_FILES)
200#       $(CC) $(CFLAGS) -o $@ $(LINK_OBJS) $(LINK_LIBS)
201#
202
203LINK_OBJS =\
204    $(CONSTRUCTOR) \
205    $(OBJS) \
206    $(MANAGERS_NOT_WANTED:%=$(PROJECT_RELEASE)/lib/no-%$(LIB_VARIANT).rel)
207
208LINK_FILES =\
209    $(START_FILE) \
210    $(CONSTRUCTOR) \
211    $(OBJS) \
212    $(MANAGERS_NOT_WANTED:%=$(PROJECT_RELEASE)/lib/no-%$(LIB_VARIANT).rel) \
213    $(PROJECT_RELEASE)/lib/librtemsbsp$(LIBSUFFIX_VA) \
214    $(PROJECT_RELEASE)/lib/librtemscpu$(LIBSUFFIX_VA)
215
216LINK_LIBS += $(LD_LIBS)   
217
218#
219# Allow user to override link commands (to build a prom image, perhaps)
220#
221ifndef LINKCMDS
222LINKCMDS=$(PROJECT_RELEASE)/lib/linkcmds
223endif
224
225define make-rel
226        $(LINK.c) $(CFLAGS) $(AM_CFLAGS) $(AM_LDFLAGS) \
227          -qnolinkcmds -nostdlib -Wl,-r $(XLDFLAGS) -o $@ $^
228endef
Note: See TracBrowser for help on using the repository browser.