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

Last change on this file was f3f0370f, checked in by Sebastian Huber <sebastian.huber@…>, on Jul 19, 2019 at 11:09:43 AM

build: Alternative build system based on waf

Update #3818.

  • Property mode set to 100644
File size: 4.7 KB
Line 
1#
2#  Shared compiler for all GNU tools configurations
3#
4
5##
6# CFLAGS_OPTIMIZE_V, CFLAGS_DEBUG_V are the values we
7# would want the corresponding macros to be set to.
8#
9# CFLAGS_OPTIMIZE, CFLAGS_DEBUG are set in the leaf
10# Makefiles by the 'debug:' targets to their _V values.
11#
12
13# default flags
14# XCPPFLAGS, XCFLAGS, XCXXFLAGS, XASFLAGS
15# are used to add flags from the shell
16# cf. make.info ("Implicit rules/variables" for details)
17
18# NOTE: Should these go to CPPFLAGS ?
19CFLAGS_DEFAULT=-Wall
20
21# NOTE: CPU_CFLAGS should probably be renamed to CPU_CPPFLAGS
22# NOTE: CPU_DEFINES should probably be merged with CPU_CFLAGS
23CPPFLAGS += $(CPU_DEFINES) $(CPU_CFLAGS) $(DEFINES) $(XCPPFLAGS)
24CFLAGS   = $(CFLAGS_DEFAULT) $(XCFLAGS)
25CXXFLAGS = $(CFLAGS_DEFAULT) $(XCXXFLAGS)
26ASFLAGS  = $(CPU_ASFLAGS) $(XASFLAGS)
27
28# NOTE: GCCSPECS probably belongs to CPPFLAGS
29GCCSPECS_OPTIMIZE_V =
30GCCSPECS_DEBUG_V =
31
32GCCSPECS = -B$(PROJECT_RELEASE)/lib/ -specs bsp_specs -qrtems
33GCCSPECS += $(GCCSPECS_$(VARIANT_V)_V)
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 ?= -O0 -g
48CXXFLAGS_DEBUG_V ?= $(CFLAGS_DEBUG_V)
49
50# when debugging, optimize flag: typically empty
51# some compilers do allow optimization with their "-g"
52CFLAGS_OPTIMIZE_V ?= -O2 -g
53CXXFLAGS_OPTIMIZE_V ?= $(CFLAGS_OPTIMIZE_V)
54
55ifndef AUTOMAKE
56CPPFLAGS_$(VARIANT)=$(CPPFLAGS_$(VARIANT)_V)
57CFLAGS_$(VARIANT)  =$(CFLAGS_$(VARIANT)_V)
58CXXFLAGS_$(VARIANT)=$(CXXFLAGS_$(VARIANT)_V)
59endif
60
61ifndef AUTOMAKE
62CPPFLAGS += $(CPPFLAGS_OPTIMIZE) $(CPPFLAGS_DEBUG)
63CFLAGS   += $(CFLAGS_OPTIMIZE) $(CFLAGS_DEBUG)
64CXXFLAGS += $(CXXFLAGS_OPTIMIZE) $(CXXFLAGS_DEBUG)
65endif
66
67# List of library paths without -L
68LD_PATHS= $(PROJECT_RELEASE)/lib
69
70# ld flag for incomplete link
71LDFLAGS_INCOMPLETE = -r
72
73# LDFLAGS=$(LDFLAGS_DEBUG) $(LD_PATHS:%=-L%)
74LDFLAGS += $(LDFLAGS_DEBUG)
75
76#
77# Stuff to clean and clobber for the compiler and its tools
78#
79
80CLEAN_CC = a.out *.o *.BAK
81CLOBBER_CC =
82
83#
84# Client compiler and support tools
85#
86
87# CPP command to write file to standard output with warnings suppressed
88CPP=$(CC) -E -w
89
90# egrep regexp to ignore symbol table entries in ar archives.
91# Only used to make sure we skip them when coalescing libraries.
92# skip __.SYMDEF and empty names (maybe bug in ranlib??).
93AR_SYMBOL_TABLE="HIGHLY-UNLIKELY-TO-CONFLICT"
94ARFLAGS=ruv
95
96#
97# How to compile stuff into ${ARCH} subdirectory
98#
99
100${ARCH}/%.o: %.c
101        ${COMPILE.c} $(AM_CPPFLAGS) $(AM_CFLAGS) -o $@ $<
102
103${ARCH}/%.o: %.cc
104        ${COMPILE.cc} $(AM_CPPFLAGS) $(AM_CXXFLAGS) -o $@ $<
105
106${ARCH}/%.o: %.cpp
107        ${COMPILE.cc} $(AM_CPPFLAGS) $(AM_CXXFLAGS) -o $@ $<
108
109${ARCH}/%.o: %.cxx
110        ${COMPILE.cc} $(AM_CPPFLAGS) $(AM_CXXFLAGS) -o $@ $<
111
112${ARCH}/%.o: %.C
113        ${COMPILE.cc} $(AM_CPPFLAGS) $(AM_CXXFLAGS) -o $@ $<
114
115${ARCH}/%.o: %.S
116        ${COMPILE.S} $(AM_CPPFLAGS) -DASM -o $@ $<
117
118# Make foo.rel from foo.o
119${ARCH}/%.rel: ${ARCH}/%.o
120        ${make-rel}
121
122# create $(ARCH)/pgm from pgm.sh
123${ARCH}/%: %.sh
124        $(RM) $@
125        $(CP) $< $@
126        $(CHMOD) +x $@
127
128# Dependency files for use by gmake
129# NOTE: we don't put them into $(ARCH)
130#       so that 'make clean' doesn't blow it away
131
132DEPEND=Depends-${ARCH}
133
134CLEAN_DEPEND=$(DEPEND).tmp
135CLOBBER_DEPEND=$(DEPEND)
136
137# We deliberately don't have anything depend on the
138# $(DEPEND) file; otherwise it will get rebuilt even
139# on 'make clean'
140#
141
142depend-am: $(C_FILES) $(CC_FILES) $(S_FILES)
143ifneq ($(words $(C_FILES) $(CC_FILES) $(S_FILES)), 0)
144#       Use gcc -M to generate dependencies
145#       Replace foo.o with $(ARCH)/foo.o
146#       Replace $(ARCH) value with string $(ARCH)
147#           so that it will for debug cases
148        $(COMPILE.c) $(AM_CPPFLAGS) $(AM_CFLAGS) -M   $^    |  \
149        $(SED) -e 's?^\(.*\)\.o[ ]*:?$$(ARCH)/\1.o:?' \
150            -e 's?$(ARCH)/?$$(ARCH)/?'   >$(DEPEND).tmp
151        $(MV) $(DEPEND).tmp $(DEPEND)
152endif
153depend: depend-am
154
155# spell out all the LINK_FILE's, rather than using -lbsp, so
156#  that $(LINK_FILES) can be a dependency
157
158#
159# NOTE: a rule to link an rtems' application should look similar to this
160#       (cf. "make-exe" in make/custom/*.cfg):
161#
162# gcc28:
163# $(PGM): $(LINK_FILES)
164#       $(CC) $(CFLAGS) -o $@ $(LINK_OBJS) $(LINK_LIBS)
165#
166
167LINK_OBJS =\
168    $(CONSTRUCTOR) \
169    $(OBJS)
170
171LINK_FILES =\
172    $(CONSTRUCTOR) \
173    $(OBJS) \
174    $(PROJECT_RELEASE)/lib/librtemsbsp$(LIBSUFFIX_VA) \
175    $(PROJECT_RELEASE)/lib/librtemscpu$(LIBSUFFIX_VA)
176
177LINK_LIBS += $(LD_LIBS)   
178
179#
180# Allow user to override link commands (to build a prom image, perhaps)
181#
182ifndef LINKCMDS
183LINKCMDS=$(PROJECT_RELEASE)/lib/linkcmds
184endif
185
186define make-rel
187        $(LINK.c) $(CFLAGS) $(AM_CFLAGS) $(AM_LDFLAGS) \
188          -qnolinkcmds -nostdlib -Wl,-r $(XLDFLAGS) -o $@ $^
189endef
Note: See TracBrowser for help on using the repository browser.