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

4.104.114.95
Last change on this file since cb4a77e was e59d23ad, checked in by Joel Sherrill <joel.sherrill@…>, on 09/09/08 at 16:30:35

2008-09-09 Joel Sherrill <joel.sherrill@…>

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