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

4.104.114.84.95
Last change on this file since 9456087 was 9456087, checked in by Joel Sherrill <joel.sherrill@…>, on 06/09/98 at 14:21:21

Added rule for .cxx and .cpp per suggestion from Geoffroy Montel
<g_montel@…>.

  • Property mode set to 100644
File size: 7.2 KB
Line 
1#
2#  Shared compiler for all GNU tools configurations
3#
4#  $Id$
5#
6
7# names for C++ compilers.
8CXX=$(CC)
9CCC=$(CXX)
10
11CPPFLAGS=$(CFLAGS) $(XCPPFLAGS)
12
13CPLUS_CPPFLAGS=$(CFLAGS) $(XCPPFLAGS)
14
15##
16# CFLAGS_OPTIMIZE_V, CFLAGS_DEBUG_V, CFLAGS_PROFILE_V are the values we
17# would want the corresponding macros to be set to.
18#
19# CFLAGS_OPTIMIZE, CFLAGS_DEBUG, CFLAGS_PROFILE are set in the leaf
20# Makefiles by the 'debug:' and 'profile:' targets to their _V values.
21#
22
23# default flags
24
25# We only include the header files for KA9Q if it is enabled.
26INCLUDE_KA9Q_yes_V = -I$(PROJECT_INCLUDE)/ka9q
27INCLUDE_KA9Q = $(INCLUDE_KA9Q_$(HAS_KA9Q)_V)
28
29ifeq ($(RTEMS_USE_GCC272),yes)
30ifeq ($(RTEMS_CROSS_TARGET),no)
31
32ifdef RTEMS_LIBC_DIR
33RTEMS_LIBC_INCLUDES := -I$(RTEMS_LIBC_DIR)/include
34endif
35
36# Used for posix bsps
37CFLAGS_DEFAULT = $(CPU_DEFINES) $(CPU_CFLAGS) -Wall -ansi -fasm -g \
38  -I$(PROJECT_INCLUDE) \
39  $(INCLUDE_KA9Q) \
40  $(RTEMS_LIBC_INCLUDES) $(DEFINES)
41
42ASMFLAGS=$(CPU_DEFINES) $(CPU_CFLAGS) -g \
43  -I$(PROJECT_INCLUDE) \
44  $(RTEMS_LIBC_INCLUDES) $(DEFINES)
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)
49
50CFLAGS_DEFAULT = $(CPU_DEFINES) $(CPU_CFLAGS) -Wall -ansi -fasm -g \
51  -nostdinc -I$(PROJECT_INCLUDE) \
52  $(INCLUDE_KA9Q) \
53  -I$(RTEMS_LIBC_DIR)/include -I$(GCC_INCLUDE) $(DEFINES)
54
55ASMFLAGS=$(CPU_DEFINES) $(CPU_CFLAGS) -g \
56  -nostdinc -I$(PROJECT_INCLUDE) \
57  -I$(RTEMS_LIBC_DIR)/include -I$(GCC_INCLUDE) $(DEFINES)
58endif
59
60# default location of Standard C Library
61ifndef LIBC_LIBC
62LIBC_LIBC=$(RTEMS_LIBC_DIR)/lib/libc.a
63endif
64
65ifndef LIBC_LIBM
66LIBC_LIBM=$(RTEMS_LIBC_DIR)/lib/libm.a
67endif
68
69else
70CFLAGS_DEFAULT = $(CPU_DEFINES) $(CPU_CFLAGS) -Wall -ansi -fasm -g \
71        -B$(PROJECT_RELEASE)/lib/ -specs bsp_specs -qrtems \
72        $(INCLUDE_KA9Q) $(DEFINES)
73
74ASMFLAGS=$(CPU_DEFINES) $(CPU_CFLAGS) -g -I$(srcdir) \
75        -B$(PROJECT_RELEASE)/lib/ -specs bsp_specs -qrtems $(DEFINES)
76
77# default location of Standard C Library
78ifndef LIBC_LIBC
79LIBC_LIBC=$(shell $(CC) $(CPU_CFLAGS) -print-file-name=libc.a)
80endif
81
82ifndef LIBC_LIBM
83LIBC_LIBM=$(shell $(CC) $(CPU_CFLAGS) -print-file-name=libm.a)
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)
90HAS_CPLUSPLUS=yes
91CPLUS_LD_LIBS += $(PROJECT_RELEASE)/lib/librtems++$(LIBSUFFIX_VA)
92else
93HAS_CPLUSPLUS=no
94endif
95
96# debug flag; typically
97CFLAGS_DEBUG_V+=-Wno-unused
98
99ifeq ($(RTEMS_USE_GCC272),no)
100CFLAGS_DEBUG_V+=-qrtems_debug
101endif
102
103# when debugging, optimize flag: typically empty
104# some compilers do allow optimization with their "-g"
105#CFLAGS_DEBUG_OPTIMIZE_V=
106
107# profile flag; use gprof(1)
108CFLAGS_PROFILE_V=-pg
109
110# default is to optimize
111CFLAGS_OPTIMIZE=$(CFLAGS_OPTIMIZE_V)
112
113# dynamic libraries
114CFLAGS_DYNAMIC_V=-fpic
115#ASFLAGS_DYNAMIC_V=
116
117CFLAGS=$(CFLAGS_DEFAULT) $(CFLAGS_OPTIMIZE) $(CFLAGS_DEBUG) $(CFLAGS_PROFILE)
118
119# List of library paths without -L
120LD_PATHS= $(PROJECT_RELEASE)/lib
121
122# libraries you want EVERYONE to link with
123#LD_LIBS=
124
125# ld flag to ensure pure-text
126#LDFLAGS_MUST_BE_PURE_V =
127
128# ld flag for [un]shared objects
129#LDFLAGS_STATIC_LIBRARIES_V =
130#LDFLAGS_SHARED_LIBRARIES_V =
131
132# ld flag for incomplete link
133LDFLAGS_INCOMPLETE = -r
134
135# Special linker options when building lib.so
136LDFLAGS_DYNAMIC_V = ??
137
138# Some dynamic linking systems want the preferred name recorded in the binary
139# ref: src/libxil/Makefile
140LDFLAGS_DYNAMIC_LIBNAME_V = -h $(DYNAMIC_VERSION_LIBNAME)
141
142# ld flags for profiling, debugging
143LDFLAGS_PROFILE_V =
144LDFLAGS_DEBUG_V =
145
146LDFLAGS=$(LDFLAGS_PROFILE) $(LDFLAGS_DEBUG) $(LD_PATHS:%=-L %)
147
148#
149# Stuff to clean and clobber for the compiler and its tools
150#
151
152CLEAN_CC = a.out *.o *.BAK
153CLOBBER_CC =
154
155#
156# Client compiler and support tools
157#
158
159# CPP command to write file to standard output
160CPP=$(CC) -E -ansi -w -Wp,-$$
161
162# flags set by cc when running cpp
163CPP_CC_FLAGS=-D__STDC__
164
165ASFLAGS=
166ASM4FLAGS := -I $(PROJECT_INCLUDE)
167
168# egrep regexp to ignore symbol table entries in ar archives.
169# Only used to make sure we skip them when coalescing libraries.
170# skip __.SYMDEF and empty names (maybe bug in ranlib??).
171AR_SYMBOL_TABLE="HIGHLY-UNLIKELY-TO-CONFLICT"
172ARFLAGS=ruv
173
174#
175# Command to convert a normal archive to one searchable by $(LD)
176# Not needed on SVR4
177#
178
179MKLIB=echo library is complete:
180
181#
182# How to compile stuff into ${ARCH} subdirectory
183#
184# NOTE: we override COMPILE.c
185#
186
187COMPILE.c=$(CC) $(CFLAGS) $(XCFLAGS) -c
188COMPILE.cc=$(CXX) $(CFLAGS) $(CXXFLAGS) -fno-rtti $(XCFLAGS) -c
189
190${ARCH}/%.o: %.c
191        ${COMPILE.c} -o $@ $<
192
193${ARCH}/%.o: %.cc
194        ${COMPILE.cc} -o $@ $<
195
196${ARCH}/%.o: %.cpp
197        ${COMPILE.cc} -o $@ $<
198
199${ARCH}/%.o: %.cxx
200        ${COMPILE.cc} -o $@ $<
201
202${ARCH}/%.o: %.S
203        ${COMPILE.c} -DASM -o $@ $<
204
205# strip out C++ style comments.
206${ARCH}/%.o: %.s
207        sed -e 's/\/\/.*$$//' < $< | \
208            $(CPP) $(ASMFLAGS) -I. -I$(srcdir) -DASM - >$(ARCH)/$*.i
209        $(AS) $(ASFLAGS) -o $@ $(ARCH)/$*.i
210
211#       $(CPP) $(CPPFLAGS) -DASM - < $<  >$(ARCH)/$*.i
212#       $(AS) $(ASFLAGS) -o $@ $(ARCH)/$*.i
213#       $(RM) $(ARCH)/$*.i
214
215# Specify our own default rule for this to prevent having CFLAGS and
216#  CPPFLAGS being passed to linker
217${ARCH}/%: ${ARCH}/%.o
218        ${CC} ${LDFLAGS} -o $@ $@.o ${LD_LIBS}
219
220# Make foo.rel from foo.o
221${ARCH}/%.rel: ${ARCH}/%.o
222        ${LD} $(LDFLAGS_INCOMPLETE) -o $@ $^
223
224# create $(ARCH)/pgm from pgm.sh
225${ARCH}/%: %.sh
226        $(RM) $@
227        $(CP) $< $@
228        $(CHMOD) +x $@
229
230# Dependency files for use by gmake
231# NOTE: we don't put in $(TARGET_ARCH)
232#       so that 'make clean' doesn't blow it away
233
234DEPEND=Depends-$(TARGET_ARCH:o-%=%)
235
236CLEAN_DEPEND=$(DEPEND).tmp
237CLOBBER_DEPEND=$(DEPEND)
238
239# We deliberately don't have anything depend on the
240# $(DEPEND) file; otherwise it will get rebuilt even
241# on 'make clean'
242#
243
244depend: $(C_FILES) $(CC_FILES) $(S_FILES)
245ifneq ($(words $(C_FILES) $(CC_FILES) $(S_FILES)), 0)
246#       Use gcc -M to generate dependencies
247#       Replace foo.o with $(ARCH)/foo.o
248#       Replace $(ARCH) value with string $(ARCH)
249#           so that it will for debug and profile cases
250        $(COMPILE.c) -M   $^    |  \
251        $(SED) -e 's?^\(.*\)\.o[ ]*:?$$(ARCH)/\1.o:?' \
252            -e 's?$(ARCH)/?$$(ARCH)/?'   >$(DEPEND).tmp
253        $(MV) $(DEPEND).tmp $(DEPEND)
254endif
255
256# spell out all the LINK_FILE's, rather than using -lbsp, so
257#  that $(LINK_FILES) can be a dependency
258
259# Start file must be one of
260#    $(PROJECT_RELEASE)/lib/start$(LIB_VARIANT).o
261#    $(PROJECT_RELEASE)/lib/asmiface$(LIB_VARIANT).o
262# It defaults to start.o, but an app can override it.
263
264ifeq ($(START_BASE),)
265  START_FILE=
266else
267  START_FILE=$(PROJECT_RELEASE)/lib/$(START_BASE)$(LIB_VARIANT).o
268endif
269
270CONSTRUCTOR=
271
272LIBC_LOW=
273
274ifndef LIBGCC
275LIBGCC = $(shell $(CC) $(CFLAGS) -print-libgcc-file-name)
276endif
277
278LINK_OBJS=\
279    $(CONSTRUCTOR) \
280    $(OBJS) \
281    $(MANAGERS_NOT_WANTED:%=$(PROJECT_RELEASE)/lib/no-%$(LIB_VARIANT).rel) \
282    $(LD_LIBS) \
283    $(PROJECT_RELEASE)/lib/libtest$(LIBSUFFIX_VA)
284
285LINK_LIBS=\
286    $(LD_LIBS) \
287    $(LIBC_EXTRA_LIBS)  \
288    $(PROJECT_RELEASE)/lib/librtemsall$(LIBSUFFIX_VA) \
289    $(LIBC_LIBM) $(LIBC_LIBC) $(LIBGCC)
290
291LINK_FILES=\
292    $(START_FILE) \
293    $(LINK_OBJS) \
294    $(LINK_LIBS)
295
296#
297# Allow user to override link commands (to build a prom image, perhaps)
298#
299ifndef LINKCMDS
300LINKCMDS=$(PROJECT_RELEASE)/lib/linkcmds
301endif
302
303
304define make-rel
305        $(LD) $(LDFLAGS_INCOMPLETE) $(XLDFLAGS) -o $@ $(OBJS)
306endef
Note: See TracBrowser for help on using the repository browser.