📄 makefile
字号:
# Makefile - makefile for target/src/fs/libgcc## modification history# --------------------# 01a,23mar99,yp derived from 01o target/src/cplus/libgcc/Makefile# # DESCRIPTION# This file contains the makefile rules for grabbing what we# need from "libgcc.a" #*/# TODO: Make DOS Happy, lrn: added some objs, may need others.TGT_DIR=$(WIND_BASE)/targetLIBNAME=lib$(CPU)$(TOOL)vx.aLIBDIRNAME=obj$(CPU)$(TOOL)vxOBJS_INT64 =\_ashldi3.o \_ashrdi3.o \_divdi3.o \_muldi3.o \_moddi3.o \_cmpdi2.oifneq ($(CPU),SIMNT) OBJS=$(OBJS_BASIC) $(OBJS_INT64)else OBJS=$(OBJS_BASIC) $(OBJS_INT64) \frame.oendifinclude $(TGT_DIR)/h/make/rules.library# The choice of which libgcc.a to use depends on CANONICAL_TARGET# (defined below) and the compile flags used.# Eventually the derivation of CANONICAL_TARGET should be moved# to make.$CPU$TOOL where the definition is fixed by the context, # but for now we do it here.# The basic idea is to generate a subdirectory based on a subset# of the compile flags (listed in MULTILIB_FILTER, defined below)# In most cases the subdirectory and its corresponding flag have the # same name. There are a few exceptions in the case of msoft-float # which is why we define MULTILIB_SFDIR. There are also# a class of flags whose corresponding subdirectory does# not contain the leading "m". These are dealt with one# by one after the comment "# Some flags need to have the leading "m" removed".# These flags should be listed without the leading "m" in MULTILIB_FILTER.# For some CPUs msoft-float is implied. We use MULTILIB_SFMATCHES# to catch these.# The source for MULTILIB information is# $WIND_BASE/host/src/gnu/$WIND_HOST_TYPE/$CANONICAL_TARGET/gcc/Makefile# (generated when you build the compiler)MULTILIB_SFDIR=msoft-floatMULTILIB_SFMATCHES=CYGNUS_VER=cygnus-2.7.2-960126ifeq ($(strip $(VX_CPU_FAMILY)),386) CANONICAL_TARGET=i386-wrs-vxworks MULTILIB_FILTER=endififeq ($(strip $(VX_CPU_FAMILY)),960) CANONICAL_TARGET=i960-wrs-vxworks5.3 MULTILIB_FILTER=msoft-float MULTILIB_SFDIR=float MULTILIB_SFMATCHES=mkbendififeq ($(strip $(VX_CPU_FAMILY)),68k) CANONICAL_TARGET=m68k-wrs-vxworks MULTILIB_FILTER=m68000 msoft-floatendififeq ($(strip $(VX_CPU_FAMILY)),mips) CANONICAL_TARGET=mips-wrs-vxworks MULTILIB_FILTER=mips3 msingle-float msoft-floatendififeq ($(strip $(VX_CPU_FAMILY)),PPC) CANONICAL_TARGET=powerpc-wrs-vxworks MULTILIB_FILTER=msoft-float MULTILIB_SFDIR=soft-float MULTILIB_SFMATCHES=mcpu=860 mcpu=403endififeq ($(strip $(VX_CPU_FAMILY)),simso) CANONICAL_TARGET=sparc-sun-solaris2.5.1 MULTILIB_FILTER=endififeq ($(strip $(VX_CPU_FAMILY)),sparc) CANONICAL_TARGET=sparc-wrs-vxworks MULTILIB_FILTER=msoft-float mv8 MULTILIB_SFDIR=softendififeq ($(strip $(VX_CPU_FAMILY)),arm) CYGNUS_VER=2.7.9-970819 CANONICAL_TARGET=arm-wrs-vxworks MULTILIB_FILTER=thumbendif ifeq ($(strip $(subst simhppa,hppa,$(VX_CPU_FAMILY))),hppa) CANONICAL_TARGET=hppa1.1-wrs-vxworks MULTILIB_FILTER=endififeq ($(strip $(VX_CPU_FAMILY)),SIMNT) CYGNUS_VER=egcs-2.90.29 CANONICAL_TARGET=i386-pc-mingw32 MULTILIB_FILTER=endif# Strip of leading -'s from CFLAGSMULTIFLAGS1=$(patsubst -%,%,$(CFLAGS))# Some flags go by more than one nameMULTIFLAGS2=$(MULTIFLAGS1:mc68000=m68000)# Some flags need to have the leading "m" removed.# The last iteration should result in a variable named MULTIFLAGSMULTIFLAGS3=$(subst mthumb, thumb, $(MULTIFLAGS2))MULTIFLAGS=$(subst mv8, v8, $(MULTIFLAGS3))# Only select the options listed in MULTILIB_FILTERMULTILIB_DIR1=$(strip $(filter $(MULTILIB_FILTER),$(MULTIFLAGS)))# Does another flag imply msoft-float?ifeq ($(filter $(MULTILIB_SFMATCHES),$(MULTIFLAGS)),) MULTILIB_EXTRA=else MULTILIB_EXTRA=$(MULTILIB_SFDIR)endif# Replace msoft-float by the corresponding directory nameMULTILIB_DIR2=$(subst msoft-float,$(MULTILIB_SFDIR),$(MULTILIB_DIR1))# See GNU Toolkit 2.7/8.1 for an explanation of this roundabout# way of doing things ...empty=space=$(empty) $(empty)# Mash the remaining flags into a directory name. Notice that# we rely on a particular ordering of the flags in CFLAGS for this# to work.MULTILIB_DIR=$(subst $(space),/,$(strip $(MULTILIB_DIR2)$(space)$(MULTILIB_EXTRA)))# If there are no flags left we end up with a single /ifeq ($(MULTILIB_DIR),/) MULTILIB_DIR=endif LIBGCC= $(WIND_BASE)/host/$(WIND_HOST_TYPE)/lib/gcc-lib/$(CANONICAL_TARGET)/$(CYGNUS_VER)/$(MULTILIB_DIR)/libgcc.a# iostreams long double support requires pulling in some extra floating# point libraries in some cases: long term this should probably be# done elsewhere ...EXTRA_OBJS=ifeq ($(strip $(VX_CPU_FAMILY)),68k) EXTRA_OBJS=xfgnulib.oendif# rules.library only looks in the current directory for# source files when it determines the objects we can build.# In our case the objects have already been built in the# GNU build tree (in libgcc.a) and we just want to pull them out. LIBOBJS = $(foreach file, $(OBJS) $(EXTRA_OBJS), $(LIBDIR)/$(file))# On windows there needs to be a target called $(file)_clean for each file# in $(LIBOBJS).ifeq ($(WIND_HOST_TYPE),x86-win32)clean: $(foreach file,$(subst /,$(DIRCHAR),$(LIBOBJS) $(LOCAL_CLEAN)),$(file)_clean)$(foreach file,$(subst /,$(DIRCHAR),$(LIBOBJS) $(LOCAL_CLEAN)),$(file)_clean): $(RM) $(subst _clean,,$@)endif# Repeat the work of rules.library with the correct object listobjs : $(LIBOBJS) Makefile$(subst /,$(DIRCHAR),$(TGT_DIR)/lib/$(LIBNAME)) : $(LIBOBJS)ifeq ($(WIND_HOST_TYPE),x86-win32) SEMI=;else SEMI=";"endifWRAPPER=$(LIBDIR)/_tmp_wrapper.cTMP_OBJ=$(LIBDIR)/_tmp_obj.o$(LIBOBJS) : $(LIBGCC) Makefile @echo Wrapping $@ ...# This just adds a symbol __object_o to object.o. We chose# to use a one-line C fragment rather than using the linker# to directly add a symbol because this way we don't have# to worry about whether or not the compiler prepends an underscore. echo char __$(notdir $*)_o = 0$(SEMI) > $(WRAPPER)ifeq ($(WIND_HOST_TYPE),x86-win32) (cd $(LIBDIR) & $(AR) -x $(LIBGCC) $(notdir $@))else (cd $(LIBDIR) ; $(AR) -x $(LIBGCC) $(notdir $@))endif $(CC) -c $(CFLAGS) $(WRAPPER) -o $(TMP_OBJ) $(LD) $(LD_PARTIAL_FLAGS) -r $(TMP_OBJ) $@ -o $@_tmp $(CP) $(subst /,$(DIRCHAR),$@_tmp) $(subst /,$(DIRCHAR),$@) $(RM) $(WRAPPER) $(TMP_OBJ) $@_tmp
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -