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

4.104.114.84.95
Last change on this file since 6ee6abb was 6ee6abb, checked in by Joel Sherrill <joel.sherrill@…>, on May 18, 1998 at 4:38:38 PM

Added C++ rule.

Added CROSS_TARGET conditionals so unix port can share this file.

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