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

4.104.114.84.9
Last change on this file since cc8a388a was cc8a388a, checked in by Joel Sherrill <joel.sherrill@…>, on Jul 10, 1998 at 2:13:59 PM

Patch from Ralf Corsepius <corsepiu@…>. Comments:

It seems that rules for %{EXEEXT} don't exist in gcc-target-default.cfg

No, gcc-target-default.cfg is used to compile executables for the target
only, not for the host.

EXEEXT may only be used for programs to be run on the host.

What should I add please?

This was a bug in my initial configuration patch to rtems-980616. A
correction to this patch I had sent to Joel at 26.06.98 doesn't seem to
have made it into the snapshot.

Please find attached the patch I had sent to Joel, hopefully this patch
fixes this problem.

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