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

4.104.11
Last change on this file since 5e30d590 was 5e30d590, checked in by Joel Sherrill <joel.sherrill@…>, on Sep 18, 2008 at 5:34:06 PM

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

  • leaf.cfg, compilers/gcc-target-default.cfg, custom/default.cfg.in: Eliminate START_BASE and START_FILE.
  • Property mode set to 100644
File size: 4.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 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#
162# NOTE: a rule to link an rtems' application should look similar to this
163#       (cf. "make-exe" in make/custom/*.cfg):
164#
165# gcc28:
166# $(PGM): $(LINK_FILES)
167#       $(CC) $(CFLAGS) -o $@ $(LINK_OBJS) $(LINK_LIBS)
168#
169
170LINK_OBJS =\
171    $(CONSTRUCTOR) \
172    $(OBJS) \
173    $(MANAGERS_NOT_WANTED:%=$(PROJECT_RELEASE)/lib/no-%$(LIB_VARIANT).rel)
174
175LINK_FILES =\
176    $(CONSTRUCTOR) \
177    $(OBJS) \
178    $(MANAGERS_NOT_WANTED:%=$(PROJECT_RELEASE)/lib/no-%$(LIB_VARIANT).rel) \
179    $(PROJECT_RELEASE)/lib/librtemsbsp$(LIBSUFFIX_VA) \
180    $(PROJECT_RELEASE)/lib/librtemscpu$(LIBSUFFIX_VA)
181
182LINK_LIBS += $(LD_LIBS)   
183
184#
185# Allow user to override link commands (to build a prom image, perhaps)
186#
187ifndef LINKCMDS
188LINKCMDS=$(PROJECT_RELEASE)/lib/linkcmds
189endif
190
191define make-rel
192        $(LINK.c) $(CFLAGS) $(AM_CFLAGS) $(AM_LDFLAGS) \
193          -qnolinkcmds -nostdlib -Wl,-r $(XLDFLAGS) -o $@ $^
194endef
Note: See TracBrowser for help on using the repository browser.