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

4.104.114.84.95
Last change on this file since a5cb673 was a5cb673, checked in by Joel Sherrill <joel.sherrill@…>, on 04/06/98 at 16:26:53

Reordered CFLAGS definition so CFLAGS_DEFAULT is before
CFLAGS_$(TARGET_VARIANTS). This makes sure that -Wall appears
before any individual warnings are disabled during "debug" builds.

  • Property mode set to 100644
File size: 7.5 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#  STACK_CHECKER_REPORT_USAGE (RTEMS support code)
42#     If this and STACK_CHECKER_ON are defined, then a report on stack usage
43#     per task is printed when the program exits.
44#
45#  RTEMS_DEBUG (RTEMS)
46#     If defined, debug checks in RTEMS and support library code are enabled.
47
48define make-target-options
49        echo "/* #define NDEBUG 1 */ "                     >>$@
50        echo "#define RTEMS_TEST_NO_PAUSE 1"               >>$@
51        echo "/* #define STACK_CHECKER_ON  1 */"           >>$@
52        echo "/* #define STACK_CHECKER_REPORT_USAGE  1 */" >>$@
53        echo "/* #define RTEMS_DEBUG  1 */"                >>$@
54endef
55
56#
57# Local tailoring (on the command line) can be done by setting XCFLAGS
58# which is never set in the Makefile's
59#
60
61#
62# CFLAGS_OPTIMIZE_V, CFLAGS_DEBUG_V, CFLAGS_PROFILE_V are the values we
63# would want the corresponding macros to be set to.
64#
65# CFLAGS_OPTIMIZE, CFLAGS_DEBUG, CFLAGS_PROFILE are set in the leaf
66# Makefiles by the 'debug:' and 'profile:' targets to their _V values.
67#
68
69# default flags
70
71#
72#  This contains the compiler options necessary to select the CPU model
73#  and (hopefully) optimize for it.
74#
75CPU_CFLAGS =
76
77CFLAGS_DEFAULT = $(CPU_CFLAGS) -Wall -ansi -fasm
78
79# optimize flag: typically -0, could use -O4 or -fast
80# -O4 is ok for RTEMS
81CFLAGS_OPTIMIZE_V=-O4 -fomit-frame-pointer
82
83# debug flag; typically -g
84CFLAGS_DEBUG_V=-g -Wno-unused
85
86# when debugging, optimize flag: typically empty
87# some compilers do allow optimization with their "-g"
88CFLAGS_DEBUG_OPTIMIZE_V=
89
90# profile flag; use gprof(1)
91CFLAGS_PROFILE_V=-pg
92
93# default is to optimize
94CFLAGS_OPTIMIZE=$(CFLAGS_OPTIMIZE_V)
95
96# dynamic libraries
97CFLAGS_DYNAMIC_V=-fpic
98ASFLAGS_DYNAMIC_V=
99
100CFLAGS=$(CFLAGS_DEFAULT) $(CFLAGS_OPTIMIZE) $(CFLAGS_DEBUG) $(CFLAGS_PROFILE) \
101       -I $(PROJECT_INCLUDE)
102
103# List of library paths without -L
104LD_PATHS= $(PROJECT_RELEASE)/lib
105
106# libraries you want EVERYONE to link with
107LD_LIBS=
108
109# ld flag to ensure pure-text
110LDFLAGS_MUST_BE_PURE_V =
111
112# ld flag for [un]shared objects
113LDFLAGS_STATIC_LIBRARIES_V =
114LDFLAGS_SHARED_LIBRARIES_V =
115
116# ld flag for incomplete link
117LDFLAGS_INCOMPLETE = -r
118
119# Special linker options when building lib.so
120LDFLAGS_DYNAMIC_V = ??
121
122# Some dynamic linking systems want the preferred name recorded in the binary
123# ref: src/libxil/Makefile
124LDFLAGS_DYNAMIC_LIBNAME_V = -h $(DYNAMIC_VERSION_LIBNAME)
125
126# ld flags for profiling, debugging
127LDFLAGS_PROFILE_V =
128LDFLAGS_DEBUG_V =
129
130LDFLAGS=$(LDFLAGS_PROFILE) $(LDFLAGS_DEBUG) $(LD_PATHS:%=-L %)
131
132#
133# Stuff to clean and clobber for the compiler and its tools
134#
135
136CLEAN_CC = a.out *.o *.BAK
137CLOBBER_CC =
138
139#
140# Client compiler and support tools
141#
142
143CC=gcc
144CXX=$(CC)
145CCC=$(CXX)
146
147# CPP command to write file to standard output
148CPP=$(CC) -E
149
150# flags set by cc when running cpp
151CPP_CC_FLAGS=-D__STDC__
152
153AS=as
154ASPP=ERROR_NO_ASPP
155
156ASFLAGS=
157ASM4FLAGS := -I $(PROJECT_INCLUDE)
158
159
160# NOTE: should never use full path .. but there is no guarantee ld, etc
161#       will be in the same directory as gcc.. so hope they are in the path
162#       Don't do this on a real target!!!
163LD=ld
164NM=nm
165AR=ar
166# egrep regexp to ignore symbol table entries in ar archives.
167# Only used to make sure we skip them when coalescing libraries.
168# skip __.SYMDEF and empty names (maybe bug in ranlib??).
169AR_SYMBOL_TABLE="HIGHLY-UNLIKELY-TO-CONFLICT"
170ARFLAGS=ruv
171
172# NOTE: see comment on ld, nm, ar
173SIZE=size
174
175#
176# Command to convert a normal archive to one searchable by $(LD)
177# Not needed on SVR4
178#
179
180MKLIB=echo library is complete:
181
182#
183# How to compile stuff into ${ARCH} subdirectory
184#
185# NOTE: we override COMPILE.c
186#
187
188COMPILE.c=$(CC) $(CFLAGS) $(CPPFLAGS) $(XCFLAGS) -c
189
190${ARCH}/%.o: %.c
191        ${COMPILE.c} -o $@ $<
192
193${ARCH}/%.o: %.cc
194        ${COMPILE.c} -o $@ $<
195
196${ARCH}/%.o: %.S
197        ${COMPILE.c} -DASM -o $@ $<
198
199${ARCH}/%.o: %.s
200        $(CPP) $(CPPFLAGS) - <$*.s  >$(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}/%: ${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}/%: %.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
246# List (possibly empty) of required managers
247# We require:
248#    region  -- used by lib/libcsupport for malloc()
249#    ext     -- used by libc for libc reentrancy hooks
250
251MANAGERS_REQUIRED=region ext sem
252
253# Create a RTEMS executable based on MANAGERS which was set in
254#  app's Makefile
255
256MANAGERS_NOT_WANTED=$(filter-out $(MANAGERS), $(MANAGER_LIST))
257MANAGERS_NOT_WANTED:=$(filter-out $(MANAGERS_REQUIRED), $(MANAGERS_NOT_WANTED))
258
259# spell out all the LINK_FILE's, rather than using -lbsp, so
260#  that $(LINK_FILES) can be a dependency
261
262# Start file must be one of
263#    $(PROJECT_RELEASE)/lib/start$(LIB_VARIANT).o
264#    $(PROJECT_RELEASE)/lib/asmiface$(LIB_VARIANT).o
265# It defaults to start.o, but an app can override it.
266
267# Note:  Normally RTEMS provides a start file...
268START_FILE=
269
270CONSTRUCTOR=
271
272LIBGCC = $(shell $(CC) $(CFLAGS) -print-libgcc-file-name)
273
274LINK_FILES= $(START_FILE) \
275    $(CONSTRUCTOR) \
276    $(OBJS) \
277    $(MANAGERS_NOT_WANTED:%=$(PROJECT_RELEASE)/lib/no-%$(LIB_VARIANT).rel) \
278    $(LD_LIBS) \
279    $(LIBC_EXTRA_LIBS)  \
280    $(PROJECT_RELEASE)/lib/libtest$(LIBSUFFIX_VA) \
281    $(PROJECT_RELEASE)/lib/librtemsall$(LIBSUFFIX_VA) \
282    $(LIBC_LIBM) $(LIBC_LIBC) $(LIBGCC)
283
284# Here is the rule to actually build a $(ARCH)/foo.exe
285# It also builds $(ARCH)/foo.sr and $(ARCH)/foo.nm
286# Usage ref: src/tests/sptest/sp1/Makefile
287
288# On Solaris at least you need to had /usr/ucblib/libucb.a
289
290define make-exe
291        $(CC) -o $(basename $@).exe $(LINK_FILES) -lc -lm
292        $(NM) -n $(basename $@).exe > $(basename $@).num
293        $(SIZE) $(basename $@).exe
294endef
295
296define make-rel
297        $(LD) $(LDFLAGS_INCOMPLETE) $(XLDFLAGS) -o $@ $(OBJS)
298endef
Note: See TracBrowser for help on using the repository browser.