Warning, /make/compilers/gcc-target-default.cfg is written in an unsupported language. File is not indexed.
0001 #
0002 # Shared compiler for all GNU tools configurations
0003 #
0004
0005 ##
0006 # CFLAGS_OPTIMIZE_V, CFLAGS_DEBUG_V are the values we
0007 # would want the corresponding macros to be set to.
0008 #
0009 # CFLAGS_OPTIMIZE, CFLAGS_DEBUG are set in the leaf
0010 # Makefiles by the 'debug:' targets to their _V values.
0011 #
0012
0013 # default flags
0014 # XCPPFLAGS, XCFLAGS, XCXXFLAGS, XASFLAGS
0015 # are used to add flags from the shell
0016 # cf. make.info ("Implicit rules/variables" for details)
0017
0018 # NOTE: Should these go to CPPFLAGS ?
0019 CFLAGS_DEFAULT=-Wall
0020
0021 # NOTE: CPU_CFLAGS should probably be renamed to CPU_CPPFLAGS
0022 # NOTE: CPU_DEFINES should probably be merged with CPU_CFLAGS
0023 CPPFLAGS += $(CPU_DEFINES) $(CPU_CFLAGS) $(DEFINES) $(XCPPFLAGS)
0024 CFLAGS = $(CFLAGS_DEFAULT) $(XCFLAGS)
0025 CXXFLAGS = $(CFLAGS_DEFAULT) $(XCXXFLAGS)
0026 ASFLAGS = $(CPU_ASFLAGS) $(XASFLAGS)
0027
0028 # NOTE: GCCSPECS probably belongs to CPPFLAGS
0029 GCCSPECS_OPTIMIZE_V =
0030 GCCSPECS_DEBUG_V =
0031
0032 GCCSPECS = $(GCCSPECS_$(VARIANT_V)_V)
0033
0034 CC += $(GCCSPECS)
0035 CXX += $(GCCSPECS)
0036
0037 CPPFLAGS +=
0038
0039 # Define this to yes if C++ is included in the development environment.
0040 # This requires that at least the GNU C++ compiler and libg++ be installed.
0041 ifeq ($(HAS_CPLUSPLUS),yes)
0042 CPLUS_LD_LIBS += $(PROJECT_RELEASE)/lib/librtems++$(LIBSUFFIX_VA)
0043 endif
0044
0045 # debug flag;
0046 CFLAGS_DEBUG_V ?= -O0 -g
0047 CXXFLAGS_DEBUG_V ?= $(CFLAGS_DEBUG_V)
0048
0049 # when debugging, optimize flag: typically empty
0050 # some compilers do allow optimization with their "-g"
0051 CFLAGS_OPTIMIZE_V ?= -O2 -g
0052 CXXFLAGS_OPTIMIZE_V ?= $(CFLAGS_OPTIMIZE_V)
0053
0054 ifndef AUTOMAKE
0055 CPPFLAGS_$(VARIANT)=$(CPPFLAGS_$(VARIANT)_V)
0056 CFLAGS_$(VARIANT) =$(CFLAGS_$(VARIANT)_V)
0057 CXXFLAGS_$(VARIANT)=$(CXXFLAGS_$(VARIANT)_V)
0058 endif
0059
0060 ifndef AUTOMAKE
0061 CPPFLAGS += $(CPPFLAGS_OPTIMIZE) $(CPPFLAGS_DEBUG)
0062 CFLAGS += $(CFLAGS_OPTIMIZE) $(CFLAGS_DEBUG)
0063 CXXFLAGS += $(CXXFLAGS_OPTIMIZE) $(CXXFLAGS_DEBUG)
0064 endif
0065
0066 # List of library paths without -L
0067 LD_PATHS= $(PROJECT_RELEASE)/lib
0068
0069 # ld flag for incomplete link
0070 LDFLAGS_INCOMPLETE = -r
0071
0072 # LDFLAGS=$(LDFLAGS_DEBUG) $(LD_PATHS:%=-L%)
0073 LDFLAGS += $(LDFLAGS_DEBUG)
0074
0075 #
0076 # Stuff to clean and clobber for the compiler and its tools
0077 #
0078
0079 CLEAN_CC = a.out *.o *.BAK
0080 CLOBBER_CC =
0081
0082 #
0083 # Client compiler and support tools
0084 #
0085
0086 # CPP command to write file to standard output with warnings suppressed
0087 CPP=$(CC) -E -w
0088
0089 # egrep regexp to ignore symbol table entries in ar archives.
0090 # Only used to make sure we skip them when coalescing libraries.
0091 # skip __.SYMDEF and empty names (maybe bug in ranlib??).
0092 AR_SYMBOL_TABLE="HIGHLY-UNLIKELY-TO-CONFLICT"
0093 ARFLAGS=ruv
0094
0095 #
0096 # How to compile stuff into ${ARCH} subdirectory
0097 #
0098
0099 ${ARCH}/%.o: %.c
0100 ${COMPILE.c} $(AM_CPPFLAGS) $(AM_CFLAGS) -o $@ $<
0101
0102 ${ARCH}/%.o: %.cc
0103 ${COMPILE.cc} $(AM_CPPFLAGS) $(AM_CXXFLAGS) -o $@ $<
0104
0105 ${ARCH}/%.o: %.cpp
0106 ${COMPILE.cc} $(AM_CPPFLAGS) $(AM_CXXFLAGS) -o $@ $<
0107
0108 ${ARCH}/%.o: %.cxx
0109 ${COMPILE.cc} $(AM_CPPFLAGS) $(AM_CXXFLAGS) -o $@ $<
0110
0111 ${ARCH}/%.o: %.C
0112 ${COMPILE.cc} $(AM_CPPFLAGS) $(AM_CXXFLAGS) -o $@ $<
0113
0114 ${ARCH}/%.o: %.S
0115 ${COMPILE.S} $(AM_CPPFLAGS) -DASM -o $@ $<
0116
0117 # Make foo.rel from foo.o
0118 ${ARCH}/%.rel: ${ARCH}/%.o
0119 ${make-rel}
0120
0121 # create $(ARCH)/pgm from pgm.sh
0122 ${ARCH}/%: %.sh
0123 $(RM) $@
0124 $(CP) $< $@
0125 $(CHMOD) +x $@
0126
0127 # Dependency files for use by gmake
0128 # NOTE: we don't put them into $(ARCH)
0129 # so that 'make clean' doesn't blow it away
0130
0131 DEPEND=Depends-${ARCH}
0132
0133 CLEAN_DEPEND=$(DEPEND).tmp
0134 CLOBBER_DEPEND=$(DEPEND)
0135
0136 # We deliberately don't have anything depend on the
0137 # $(DEPEND) file; otherwise it will get rebuilt even
0138 # on 'make clean'
0139 #
0140
0141 depend-am: $(C_FILES) $(CC_FILES) $(S_FILES)
0142 ifneq ($(words $(C_FILES) $(CC_FILES) $(S_FILES)), 0)
0143 # Use gcc -M to generate dependencies
0144 # Replace foo.o with $(ARCH)/foo.o
0145 # Replace $(ARCH) value with string $(ARCH)
0146 # so that it will for debug cases
0147 $(COMPILE.c) $(AM_CPPFLAGS) $(AM_CFLAGS) -M $^ | \
0148 $(SED) -e 's?^\(.*\)\.o[ ]*:?$$(ARCH)/\1.o:?' \
0149 -e 's?$(ARCH)/?$$(ARCH)/?' >$(DEPEND).tmp
0150 $(MV) $(DEPEND).tmp $(DEPEND)
0151 endif
0152 depend: depend-am
0153
0154 # spell out all the LINK_FILE's, rather than using -lbsp, so
0155 # that $(LINK_FILES) can be a dependency
0156
0157 #
0158 # NOTE: a rule to link an rtems' application should look similar to this
0159 # (cf. "make-exe" in make/custom/*.cfg):
0160 #
0161 # gcc28:
0162 # $(PGM): $(LINK_FILES)
0163 # $(CC) $(CFLAGS) -o $@ $(LINK_OBJS) $(LINK_LIBS)
0164 #
0165
0166 LINK_OBJS =\
0167 $(CONSTRUCTOR) \
0168 $(OBJS)
0169
0170 LINK_FILES =\
0171 $(CONSTRUCTOR) \
0172 $(OBJS) \
0173 $(PROJECT_RELEASE)/lib/librtemsbsp$(LIBSUFFIX_VA) \
0174 $(PROJECT_RELEASE)/lib/librtemscpu$(LIBSUFFIX_VA)
0175
0176 LINK_LIBS += $(LD_LIBS)
0177
0178 #
0179 # Allow user to override link commands (to build a prom image, perhaps)
0180 #
0181 ifndef LINKCMDS
0182 LINKCMDS=$(PROJECT_RELEASE)/lib/linkcmds
0183 endif
0184
0185 define make-rel
0186 $(LINK.c) $(CFLAGS) $(AM_CFLAGS) $(AM_LDFLAGS) \
0187 -qnolinkcmds -nostdlib -Wl,-r $(XLDFLAGS) -o $@ $^
0188 endef