source: rtems/make/compilers/gcc-no_bsp.cfg @ 0ab65474

4.104.114.84.95
Last change on this file since 0ab65474 was a110b68, checked in by Joel Sherrill <joel.sherrill@…>, on 02/18/99 at 17:55:49

Part of automake VI patch from Ralf Corsepius <corsepiu@…>:

2) rtems-rc-19990131-1.diff

Rework of compilers/*.cfg files (esp. gcc-target-default.cfg) to adapt
the flags/makefile variables to automake and make standards (cf.
make.info - implicit rules/variables).

This patch is rather risky and may probably break things, but is an
essential step towards automake.

FWIW: It also reverts the i386-ASMFLAGS/ASFLAGS-patch, which was wrong,
as I had to experience ;-.

  • Property mode set to 100644
File size: 7.2 KB
Line 
1#
2#  $Id$
3#
4# gcc 2.6.x compiler for a "native" nocpu/nobsp system
5# Compiler (and tools) configuration
6#
7
8# Prefix on the installed GNU tools
9#  Just use the native tools
10GNU_TOOLS_PREFIX=
11
12# Additional target names (other than debug, profile)
13TARGET_VARIANTS +=
14
15#
16# Pre-processor defines using the target options header file.
17#
18# Local tailoring (on the command line) can be done by setting XCFLAGS
19# or XCPPFLAGS -- neither of which are never set in the Makefile's
20#
21
22CPPFLAGS=$(CFLAGS) $(XCPPFLAGS) $(DEFINES)
23
24CPLUS_CPPFLAGS=$(CFLAGS) $(XCPPFLAGS) $(DEFINES)
25
26#  This section makes the target dependent options file.
27
28#  NDEBUG (C library)
29#     if defined asserts do not generate code.  This is commonly used
30#     as a command line option.
31#
32#  RTEMS_TEST_NO_PAUSE (RTEMS tests)
33#     do not pause between screens of output in the rtems tests
34#
35#  NO_TABLE_MOVE (SPARC PORT)
36#     do not have a second trap table -- use the BSP's
37#
38#  STACK_CHECKER_ON (RTEMS support code)
39#     If defined, stack bounds checking is enabled.
40#
41#  RTEMS_DEBUG (RTEMS)
42#     If defined, debug checks in RTEMS and support library code are enabled.
43
44define make-target-options
45        echo "/* #define NDEBUG 1 */ "                     >>$@
46        echo "#define RTEMS_TEST_NO_PAUSE 1"               >>$@
47        echo "/* #define STACK_CHECKER_ON  1 */"           >>$@
48        echo "/* #define RTEMS_DEBUG  1 */"                >>$@
49endef
50
51#
52# Local tailoring (on the command line) can be done by setting XCFLAGS
53# which is never set in the Makefile's
54#
55
56#
57# CFLAGS_OPTIMIZE_V, CFLAGS_DEBUG_V, CFLAGS_PROFILE_V are the values we
58# would want the corresponding macros to be set to.
59#
60# CFLAGS_OPTIMIZE, CFLAGS_DEBUG, CFLAGS_PROFILE are set in the leaf
61# Makefiles by the 'debug:' and 'profile:' targets to their _V values.
62#
63
64# default flags
65
66#
67#  This contains the compiler options necessary to select the CPU model
68#  and (hopefully) optimize for it.
69#
70CPU_CFLAGS =
71
72CFLAGS_DEFAULT = $(CPU_CFLAGS) -Wall -ansi -fasm
73
74# optimize flag: typically -0, could use -O4 or -fast
75# -O4 is ok for RTEMS
76CFLAGS_OPTIMIZE_V=-O4 -fomit-frame-pointer
77
78# debug flag; typically -g
79CFLAGS_DEBUG_V=-g -Wno-unused
80
81# when debugging, optimize flag: typically empty
82# some compilers do allow optimization with their "-g"
83CFLAGS_DEBUG_OPTIMIZE_V=
84
85# profile flag; use gprof(1)
86CFLAGS_PROFILE_V=-pg
87
88# default is to optimize
89CFLAGS_OPTIMIZE=$(CFLAGS_OPTIMIZE_V)
90
91# dynamic libraries
92CFLAGS_DYNAMIC_V=-fpic
93# ASFLAGS_DYNAMIC_V=
94
95CFLAGS=$(CFLAGS_DEFAULT) $(CFLAGS_OPTIMIZE) $(CFLAGS_DEBUG) $(CFLAGS_PROFILE) \
96       -I $(PROJECT_INCLUDE)
97
98# List of library paths without -L
99LD_PATHS= $(PROJECT_RELEASE)/lib
100
101# libraries you want EVERYONE to link with
102LD_LIBS=
103
104# ld flag to ensure pure-text
105LDFLAGS_MUST_BE_PURE_V =
106
107# ld flag for [un]shared objects
108LDFLAGS_STATIC_LIBRARIES_V =
109LDFLAGS_SHARED_LIBRARIES_V =
110
111# ld flag for incomplete link
112LDFLAGS_INCOMPLETE = -r
113
114# Special linker options when building lib.so
115LDFLAGS_DYNAMIC_V = ??
116
117# Some dynamic linking systems want the preferred name recorded in the binary
118# ref: src/libxil/Makefile
119LDFLAGS_DYNAMIC_LIBNAME_V = -h $(DYNAMIC_VERSION_LIBNAME)
120
121# ld flags for profiling, debugging
122LDFLAGS_PROFILE_V =
123LDFLAGS_DEBUG_V =
124
125LDFLAGS=$(LDFLAGS_PROFILE) $(LDFLAGS_DEBUG) $(LD_PATHS:%=-L %)
126
127#
128# Stuff to clean and clobber for the compiler and its tools
129#
130
131CLEAN_CC = a.out *.o *.BAK
132CLOBBER_CC =
133
134#
135# Client compiler and support tools
136#
137
138CC=gcc
139CXX=$(CC)
140CCC=$(CXX)
141
142# CPP command to write file to standard output
143CPP=$(CC) -E
144
145# flags set by cc when running cpp
146CPP_CC_FLAGS=-D__STDC__
147
148AS=as
149ASPP=ERROR_NO_ASPP
150
151ASFLAGS=
152
153
154# NOTE: should never use full path .. but there is no guarantee ld, etc
155#       will be in the same directory as gcc.. so hope they are in the path
156#       Don't do this on a real target!!!
157LD=ld
158NM=nm
159AR=ar
160# egrep regexp to ignore symbol table entries in ar archives.
161# Only used to make sure we skip them when coalescing libraries.
162# skip __.SYMDEF and empty names (maybe bug in ranlib??).
163AR_SYMBOL_TABLE="HIGHLY-UNLIKELY-TO-CONFLICT"
164ARFLAGS=ruv
165
166# NOTE: see comment on ld, nm, ar
167SIZE=size
168
169#
170# Command to convert a normal archive to one searchable by $(LD)
171# Not needed on SVR4
172#
173
174MKLIB=echo library is complete:
175
176#
177# How to compile stuff into ${ARCH} subdirectory
178#
179# NOTE: we override COMPILE.c
180#
181
182COMPILE.c=$(CC) $(CFLAGS) $(CPPFLAGS) $(XCFLAGS) -c
183
184${ARCH}/%.o: %.c
185        ${COMPILE.c} -o $@ $<
186
187${ARCH}/%.o: %.cc
188        ${COMPILE.c} -o $@ $<
189
190${ARCH}/%.o: %.S
191        ${COMPILE.c} -DASM -o $@ $<
192
193${ARCH}/%.o: %.s
194        $(CPP) $(CPPFLAGS) - <$*.s  >$(ARCH)/$*.i
195        $(AS) $(ASFLAGS) -o $@ $(ARCH)/$*.i
196#       $(RM) $(ARCH)/$*.i
197
198# Specify our own default rule for this to prevent having CFLAGS and
199#  CPPFLAGS being passed to linker
200${ARCH}/%: ${ARCH}/%.o
201        ${CC} ${LDFLAGS} -o $@ $@.o ${LD_LIBS}
202
203# Make foo.rel from foo.o
204${ARCH}/%.rel: ${ARCH}/%.o
205        ${LD} $(LDFLAGS_INCOMPLETE) -o $@ $^
206
207# create $(ARCH)/pgm from pgm.sh
208${ARCH}/%: %.sh
209        $(RM) $@
210        $(CP) $< $@
211        $(CHMOD) +x $@
212
213# Dependency files for use by gmake
214# NOTE: we don't put in $(TARGET_ARCH)
215#       so that 'make clean' doesn't blow it away
216
217DEPEND=Depends-$(TARGET_ARCH:o-%=%)
218
219CLEAN_DEPEND=$(DEPEND).tmp
220CLOBBER_DEPEND=$(DEPEND)
221
222# We deliberately don't have anything depend on the
223# $(DEPEND) file; otherwise it will get rebuilt even
224# on 'make clean'
225#
226
227depend: $(C_FILES) $(CC_FILES) $(S_FILES)
228ifneq ($(words $(C_FILES) $(CC_FILES) $(S_FILES)), 0)
229#       Use gcc -M to generate dependencies
230#       Replace foo.o with $(ARCH)/foo.o
231#       Replace $(ARCH) value with string $(ARCH)
232#           so that it will for debug and profile cases
233        $(COMPILE.c) -M   $^    |  \
234        $(SED) -e 's?^\(.*\)\.o[ ]*:?$$(ARCH)/\1.o:?' \
235            -e 's?$(ARCH)/?$$(ARCH)/?'   >$(DEPEND).tmp
236        $(MV) $(DEPEND).tmp $(DEPEND)
237endif
238
239
240# List (possibly empty) of required managers
241# We require:
242#    region  -- used by lib/libcsupport for malloc()
243#    ext     -- used by libc for libc reentrancy hooks
244
245MANAGERS_REQUIRED=region ext sem
246
247# Create a RTEMS executable based on MANAGERS which was set in
248#  app's Makefile
249
250MANAGERS_NOT_WANTED=$(filter-out $(MANAGERS), $(MANAGER_LIST))
251MANAGERS_NOT_WANTED:=$(filter-out $(MANAGERS_REQUIRED), $(MANAGERS_NOT_WANTED))
252
253# spell out all the LINK_FILE's, rather than using -lbsp, so
254#  that $(LINK_FILES) can be a dependency
255
256# Start file must be one of
257#    $(PROJECT_RELEASE)/lib/start$(LIB_VARIANT).o
258#    $(PROJECT_RELEASE)/lib/asmiface$(LIB_VARIANT).o
259# It defaults to start.o, but an app can override it.
260
261# Note:  Normally RTEMS provides a start file...
262START_FILE=
263
264CONSTRUCTOR=
265
266LIBGCC = $(shell $(CC) $(CFLAGS) -print-libgcc-file-name $(GCCSED))
267
268LINK_FILES= $(START_FILE) \
269    $(CONSTRUCTOR) \
270    $(OBJS) \
271    $(MANAGERS_NOT_WANTED:%=$(PROJECT_RELEASE)/lib/no-%$(LIB_VARIANT).rel) \
272    $(LD_LIBS) \
273    $(LIBC_EXTRA_LIBS)  \
274    $(PROJECT_RELEASE)/lib/libtest$(LIBSUFFIX_VA) \
275    $(PROJECT_RELEASE)/lib/librtemsall$(LIBSUFFIX_VA) \
276    $(LIBC_LIBM) $(LIBC_LIBC) $(LIBGCC)
277
278# Here is the rule to actually build a $(ARCH)/foo.exe
279# It also builds $(ARCH)/foo.sr and $(ARCH)/foo.nm
280# Usage ref: src/tests/sptest/sp1/Makefile
281
282# On Solaris at least you need to had /usr/ucblib/libucb.a
283
284define make-exe
285        $(CC) -o $(basename $@).exe $(LINK_FILES) -lc -lm
286        $(NM) -n $(basename $@).exe > $(basename $@).num
287        $(SIZE) $(basename $@).exe
288endef
289
290define make-rel
291        $(LD) $(LDFLAGS_INCOMPLETE) $(XLDFLAGS) -o $@ $(OBJS)
292endef
Note: See TracBrowser for help on using the repository browser.