OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [trunk/] [rtos/] [rtems/] [make/] [compilers/] [gcc-target-default.cfg] - Blame information for rev 562

Go to most recent revision | Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.