source: rtems/c/src/make/compilers/gcc-target-default.cfg @ 98100d2

4.104.114.84.95
Last change on this file since 98100d2 was 98100d2, checked in by Joel Sherrill <joel.sherrill@…>, on 06/27/98 at 17:09:47

Monstrous patch from Ralf Corsepius <corsepiu@…>. I have
made no attempt to divide the comments up and place them with just
the appropriate files. Here is an excerpt from Ralf's email:

Changes including comments on changes I made after cycling through
all the targets:

  • Added ranlib support. Now all targets use "ranlib" instead of "ar -s" to build an index for a library. If ranlib isn't detected during configuration, check if ar -s is working and try "ar -s" instead of
  • Removed $(XXX_FOR_TARGET) from make/target.cfg.in, use $(XXX) instead now.
  • gcc-target-default.cfg: LINK_XXXX-defines reworked to solve the -l problem under posix (cf gcc-target-default.cfg)
  • rtems-glom replaced by Makefile-rules inside of the wrapup/Makefile.in that has been using rtems-glom until now.
  • Removed CCC and friends in gcc-target-default.cfg, as they have been breaking CXX support.
  • Removed CONFIG.$(TARGET_ARCH).CC lines from several custom/*.cfg files, because this is now set in custom/default.cfg.
  • Added aclocal/ar-s.m4, check whether "ar -s" is working
  • Added aclocal/cygwin.m4 and aclocal/exeext.m4.
  • Reworked aclocal/canonicalize-tools.m4: Added ar -s check; fixes for problems when XXX_FOR_TARGET is given via environment variables (didn't work for gcc until now), adding cygwin check, improved autoconf-cache handling.
  • Removed -l from make rule dependencies. LINK_LIBS is now allowed to contain -L and -l. LINK_OBJS and LINK_FILES must not contain -L or -l. gcc28 make-exe rules now link using $(LINK_OBJS) $(LINK_LIBS) => Almost all custom/*.cfg are modified. This is very likely to break something because of typos or having missed to edit a file.

Open problems, known bugs, things I didn't do:

  • custom/p4000.cfg seems to be out of date and requires to be reviewed.

(JRS NOTE: It is subordinate p4650 and p4600 -- both of which build ok

after minor changes.)

  • custom/psim.cfg needs to be reviewed, I added some changes to it, I am insecure about.

(JRS NOTE: psim had a minor problem endif/endef swapped but runs fine.)

  • rtems-glom.in can now be removed.
  • gcc*.cfg files "make depend" rules don't honor language specific flags (e.g CXXFLAGS is ignored for *.cc) - Nothing to worry about now, but may cause problems for hosts/targets not using gcc or rtems-add-ons that use external packages.
  • AFAIS, the no_bsp BSP can't be build anymore, i.e. configure refused to configure for it whatever I tried.
  • The toplevel and toplevel+1 README files are quite out-dated
  • cygwin.m4 isn't of much use for rtems. In most cases (cf. aclocal/*.m4) it is worked around by directly using $host_os. I think I'll remove it soon after the next snapshot
  • Before release the cygwin patch needs to be tested under cygwin. I may have broken/missed something (esp. the sed-pattern to convert
    into / may be broken).
  • You should try to build/run the posix-BSP under solaris - I don't expect problems, but I am not 100% sure, esp. with regard to ranlib/ar -s.
  • You should consider to convert all make/compilers/*.cfg files into make/compilers/*.cfg.in files and let autoconf generate the *.cfg. This may help getting rid of some if/then/else statements and help hard-coding some defines into those files in future and shouldn't disturb now.
  • Not having installed libc.a/libm.a on a host may still break building rtems, esp. when using -disable-gcc28 as the gcc27-configuration scheme directly accesses libc.a and libm.a. The problem should not appear when using gcc28 because it references libc/libm only through -lc and -lm which may be static or dynamic (I didn't test this).
  • shgen is not yet included (I didn't yet have enough time to integrate it).
  • I know about a few more configure-probs (esp. cross-checking --enable-* flags).

+ warn/refuse to configure when --enable-libcdir and

--enable-gcc28 are given.

+ force --enable-libcdir when --disable-gcc28 is given

  • Replaced KSHELL with @KSH@ in some shell scripts generated by configure.in.
  • Added a dependency to aclocal/*.m4 in the toplevel Makefile => configure and aclocal.m4 will now be rebuild when any aclocal/*.m4 file is changed
  • Some changes to aclocal/gcc-pipe.m4 and aclocal/gcc-specs.m4
  • Replaced i3456?86-unknown-freebsd2.12? with i3456?86-*freebsd2.* in configure.in, as I suppose there might exist a variety of valid vendors (2nd field of the name-tripple)
  • Disabled override MAKEFLAGS in toplevel Makefile.in - Potential side-effects are not really clear to me.
  • In mvme162.cfg, $(LINK_LIBS) is missing in the CC line in gcc28's make-exe rule (yet another one I missed to edit). Just append $(LINK_LIBS) to the "CC" line, like I hopefully did to ALL other custom/*.cfg files.
  • the problem with mvme162lx.cfg is a follow-up problem of the mvme162.cfg-bug.
  • mvme162/console and idp/console had variables named Buffer which conflicted with similarly named variables in some tests.
  • Property mode set to 100644
File size: 7.9 KB
RevLine 
[bffb938]1#
[c2c9c7e]2#  Shared compiler for all GNU tools configurations
3#
4#  $Id$
[bffb938]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)
[6ee6abb]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
[bffb938]43# Ask gcc where it finds its own include files
[98100d2]44GCC_INCLUDE=$(shell $(CC) $(CPU_CFLAGS) -print-file-name=include $(GCCSED))
[bffb938]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)
[6ee6abb]54endif
[bffb938]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
[98100d2]75LIBC_LIBC=$(shell $(CC) $(CPU_CFLAGS) -print-file-name=libc.a $(GCCSED))
[bffb938]76endif
77
78ifndef LIBC_LIBM
[98100d2]79LIBC_LIBM=$(shell $(CC) $(CPU_CFLAGS) -print-file-name=libm.a $(GCCSED))
[bffb938]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
[98100d2]92# debug flag;
[ac61209b]93CFLAGS_DEBUG_V+=-Wno-unused
[bffb938]94
[a858910]95ifeq ($(RTEMS_USE_GCC272),no)
96CFLAGS_DEBUG_V+=-qrtems_debug
97endif
98
[bffb938]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
[5dd4212]156CPP=$(CC) -E -ansi -w -Wp,-$$
[bffb938]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#
[98100d2]173# NOTE: Obsolete, use $(RANLIB) instead, MKLIB may disappear soon
174MKLIB=$(RANLIB)
[bffb938]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
[6ee6abb]183COMPILE.cc=$(CXX) $(CFLAGS) $(CXXFLAGS) -fno-rtti $(XCFLAGS) -c
[bffb938]184
185${ARCH}/%.o: %.c
[e81ef51]186        ${COMPILE.c} -o $@ $<
[bffb938]187
188${ARCH}/%.o: %.cc
[6ee6abb]189        ${COMPILE.cc} -o $@ $<
[bffb938]190
191${ARCH}/%.o: %.S
[e81ef51]192        ${COMPILE.c} -DASM -o $@ $<
[bffb938]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}/%: ${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# 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
[6ee6abb]263ifndef LIBGCC
[98100d2]264LIBGCC = $(shell $(CC) $(CFLAGS) -print-libgcc-file-name $(GCCSED))
[6ee6abb]265endif
[bffb938]266
[98100d2]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 =\
[bffb938]282    $(CONSTRUCTOR) \
283    $(OBJS) \
284    $(MANAGERS_NOT_WANTED:%=$(PROJECT_RELEASE)/lib/no-%$(LIB_VARIANT).rel) \
285    $(PROJECT_RELEASE)/lib/libtest$(LIBSUFFIX_VA)
286
[98100d2]287LINK_FILES =\
[bffb938]288    $(START_FILE) \
[98100d2]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)   
[bffb938]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.