📄 makefile
字号:
# Makefile - makefile for target/src/cplus/libstdcxx## modification history# --------------------# 01f,23sep98,sn Compile cstrio.o with -fno-implicit-templates# Added INST_OBJS to LOCAL_CLEAN# Removed source files from LOCAL_CLEAN# 01e,09sep98,sn Generalized to grab source files correctly on windows# 01d,01sep98,sn Generalized $(TGT_DIR)/lib/$(LIBNAME) to work on x86-win32# hosts too.# 01c,05may98,sn expanded list of LIBIO_FILES to include the "stdio-like"# environment needed by the dejagnu test-suite.# moved the EXTRA_DEFINEs out of this Makefile and into the# source code.# 01b,27mar98,sn removed obsolete cfront stuff # 01a,05jan98,sn wrote to pull C++ standard libs out of the GNU source tree# # DESCRIPTION# This file contains the makefile rules for building the C++ standard library## We compile the entire iostreams library with -fno-exceptions. Certain# other parts of the C++ standard library (strings + STL instantiation file) # must be compiled with exceptions on. This is done explicitly below.## We don't want to mandate -fno-exceptions globally so# we need to invoke ourselves with the appropriate ADDED_C++FLAGS.# We can't just override ADDED_C++FLAGS because that# would break the whole point of having ADDED_C++FLAGS in the# first place. Instead, if ADDED_C++FLAGS doesn't contain# our exception flag, $(EH_FLAG), then we reinvoke ourselves# with the exception flag + the original flags.EH_FLAG=-fno-exceptionsifeq (,$(findstring $(EH_FLAG),$(ADDED_C++FLAGS)))# Now this is the default targetno-exceptions: $(MAKE) CPU=$(CPU) TOOL=$(TOOL) \ ADDED_C++FLAGS="$(EH_FLAG) $(ADDED_C++FLAGS)"endif# Notice that our starting point is a list of source files that need# to be generated. We use this below to make sure depend.$CPU$TOOL# is only built AFTER this directory is populated with source files.# TODO: Trim/expand this list where necessary# These files comprise iostreamsLIBIO_FILES= PlotFile.cpp \SFile.cpp \builtinbuf.cpp \cleanup.c \editbuf.cpp \filebuf.cpp \filedoalloc.c \fileops.c \floatconv.c \fstream.cpp \genops.c \indstream.cpp \ioassign.cpp \ioextend.cpp \iofclose.c \iofeof.c \ioferror.c \iofgetpos.c \iofread.c \iofscanf.c \iofsetpos.c \iogetc.c \iogetdelim.c \iogetline.c \ioignore.c \iomanip.cpp \iopadn.c \ioprims.c \ioprintf.c \ioputc.c \ioseekoff.c \ioseekpos.c \iostream.cpp \iostrerror.c \ioungetc.c \iovfprintf.c \iovfscanf.c \isgetline.cpp \isgetsb.cpp \isscan.cpp \osform.cpp \outfloat.c \parsestream.cpp \peekc.c \sbform.cpp \sbgetline.cpp \sbscan.cpp \stdiostream.cpp \stdstrbufs.cpp \stdstreams.cpp \stream.cpp \streambuf.cpp \strops.c \strstream.cpp \iofflush.c \iofflush_u.c \iofgets.c \iofopen.c \iofprintf.c \iofputs.c \ioftell.c \iofwrite.c \iogets.c \ioputs.c \ioscanf.c \iosetbuffer.c \iosetvbuf.c \iosprintf.c \iosscanf.c \iovsprintf.c \iovsscanf.c# These are pulled in as part of the C++ runtime.LIBSTDC++_FILES=cstringi.cpp \stdexcepti.cpp \cstdlibi.cpp \cmathi.cpp \stlinst.cppINST_FILES=cinst.cpp \sinst.cppINST_OBJS=fcomplex.o fcomio.o cstrmain.o cstrio.o dcomplex.o dcomio.o ldcomplex.o ldcomio.oSRC_FILES=$(LIBIO_FILES) $(LIBSTDC++_FILES)OBJS_TMP=$(SRC_FILES:.cpp=.o)OBJS=$(OBJS_TMP:.c=.o) $(INST_OBJS)NODEPENDOBJS=$(INST_FILES)GNU_SOURCE= $(WIND_BASE)/host/src/gnu.cpp# We need to explicitly mention objects whose names are# not simply derived from the corresponding source file name.LOCAL_CLEAN=$(foreach file, $(INST_OBJS), $(LIBDIR)/$(file))# Rules to generate the sources# We mark the generated source files as .PRECIOUS so that we can build# for multiple CPUs without having to recreate the source files# each time. .PRECIOUS : %.cpp.PRECIOUS : %.c# grab_source copies a source file from the GNU tree, prepending# a comment, a symbol definition (used for forced linking of# the module during a vxWorks build) and the ubiquitous #include "vxWorks.h" ifeq ($(WIND_HOST_TYPE),x86-win32) CAT=type SEMI=; QUOTE=" AST=* POUND=\#else CAT=cat SEMI=";" QUOTE="\"" AST="*" POUND="\#"endifdefine grab_source@ echo Generating $@ ... && \echo /$(AST) This has been copied from the gnu source tree $(AST)/ > $@ && \echo /$(AST) Make all changes there, not here! $(AST)/ >> $@ && \echo $(POUND)ifdef __cplusplus >> $@ && \echo extern $(QUOTE)C$(QUOTE) { >> $@ && \echo $(POUND)endif >> $@ && \echo $(POUND)ifndef _N_ >> $@ && \echo char __$*_o = 0$(SEMI) >> $@ && \echo $(POUND)else >> $@ && \echo char _N_ = 0$(SEMI) >> $@ && \echo $(POUND)endif >> $@ && \echo $(POUND)ifdef __cplusplus >> $@ && \echo } >> $@ && \echo $(POUND)endif >> $@ && \echo $(POUND)include $(QUOTE)vxWorks.h$(QUOTE) >> $@ && \$(CAT) $(subst /,$(DIRCHAR),$<) >> $@endef# These rules let us grab our source files from the GNU tree.%.cpp : $(GNU_SOURCE)/libio/%.cc $(grab_source)%.cpp : $(GNU_SOURCE)/libstdc++/%.cc $(grab_source)%.cpp : $(GNU_SOURCE)/libiberty/%.cc $(grab_source)%.c : $(GNU_SOURCE)/libio/%.c $(grab_source)%.c : $(GNU_SOURCE)/libstdc++/%.c $(grab_source)%.c : $(GNU_SOURCE)/libiberty/%.c $(grab_source)# This portion of the Makefile contains definitions and rules# to build the objects.TGT_DIR=$(WIND_BASE)/targetLIBNAME=lib$(CPU)$(TOOL)vx.aLIBDIRNAME=obj$(CPU)$(TOOL)vxinclude $(TGT_DIR)/h/make/rules.library# Don't generate the depend file until we've grabbed the sourcesdepend.$(CPU)$(TOOL) : $(SRC_FILES) $(INST_FILES)# rules.library only looks in the current directory for# source files when it determines the objects we can build.# In our case the source files are derived from the GNU source tree# so we assume that one way or another we can always build all the objects.# Source code customers should make sure to install the directories# specified in $(GNU_SOURCE).LIBOBJS = $(foreach file, $(OBJS), $(LIBDIR)/$(file))# Repeat the work of rules.library with the correct object listobjs : $(LIBOBJS)$(subst /,$(DIRCHAR),$(TGT_DIR)/lib/$(LIBNAME)) : $(LIBOBJS)# The $(INST_FILES) require special rules. # The definitions of COMFUNCS, COMIO, STRFUNCS and STRIO come from# the Makefile in # $(GNU_SOURCE)/$WIND_HOST_TYPE/$CANONICAL_TARGET/$CANONICAL_TARGET/libstdc++C++FLAGS_NOANSI=$(filter-out -ansi -pedantic, $(C++FLAGS))COMFUNCS = MAIN ADDCC ADDCF ADDFC SUBCC SUBCF SUBFC MULCC MULCF MULFC DIVCC \ DIVCF DIVFC PLUS MINUS EQCC EQCF EQFC NECC NECF NEFC ABS ARG POLAR \ CONJ NORM COS COSH EXP LOG POWCC POWCF POWCI POWFC SIN SINH SQRTCOMIO = EXTRACT INSERTCOMFUNCS_DEFS=$(foreach def,$(COMFUNCS),-D$(def))COMIO_DEFS=$(foreach def,$(COMIO),-D$(def))$(LIBDIR)/fcomplex.o $(LIBDIR)/fcomio.o $(LIBDIR)/dcomplex.o $(LIBDIR)/dcomio.o $(LIBDIR)/ldcomplex.o $(LIBDIR)/ldcomio.o : cinst.cpp$(LIBDIR)/fcomplex.o : $(CC) $(C++FLAGS_NOANSI) -DF $(COMFUNCS_DEFS) \ -D_N_=__fcomplex_o -c -o $@ cinst.cpp$(LIBDIR)/fcomio.o : $(CC) $(C++FLAGS_NOANSI) -DF $(COMIO_DEFS) \ -D_N_=__fcomio_o -c -o $@ cinst.cpp$(LIBDIR)/dcomplex.o : $(CC) $(C++FLAGS_NOANSI) -DD $(COMFUNCS_DEFS) \ -D_N_=__dcomplex_o -c -o $@ cinst.cpp$(LIBDIR)/dcomio.o : $(CC) $(C++FLAGS_NOANSI) -DD $(COMIO_DEFS) \ -D_N_=__dcomio_o -c -o $@ cinst.cpp$(LIBDIR)/ldcomplex.o : $(CC) $(C++FLAGS_NOANSI) -DLD $(COMFUNCS_DEFS) \ -D_N_=__ldcomplex_o -c -o $@ cinst.cpp$(LIBDIR)/ldcomio.o : $(CC) $(C++FLAGS_NOANSI) -DLD $(COMIO_DEFS) \ -D_N_=__ldcomio_o -c -o $@ cinst.cppSTRFUNCS = REP MAIN TRAITS ADDSS ADDPS ADDCS ADDSP ADDSC \ EQSS EQPS EQSP NESS NEPS NESP LTSS LTPS LTSP GTSS GTPS GTSP \ LESS LEPS LESP GESS GEPS GESPSTRIO = EXTRACT INSERT GETLINESTRFUNCS_DEFS=$(foreach def,$(STRFUNCS),-D$(def))STRIO_DEFS=$(foreach def,$(STRIO),-D$(def))$(LIBDIR)/cstrmain.o $(LIBDIR)/cstrio.o : sinst.cpp$(LIBDIR)/sinst.o : @# Dummy target# Certain files must be compiled with -fexceptions$(LIBDIR)/cstrmain.o : $(CC) $(C++FLAGS) -fexceptions -DC $(STRFUNCS_DEFS) \ -D_N_=__cstrmain_o -c -o $@ sinst.cpp# We compile cstrio.o with -fno-implicit-templates because# this is the only way we could come up with to# ensure that all and only the string i/o functions# are instantiated in this module. $(LIBDIR)/cstrio.o : $(CC) $(C++FLAGS) -fno-implicit-templates -fexceptions -DC $(STRIO_DEFS) \ -D_N_=__cstrio_o -c -o $@ sinst.cpp$(LIBDIR)/stdexcepti.o : $(CC) $(C++FLAGS) -fexceptions -c -o $@ stdexcepti.cpp$(LIBDIR)/stlinst.o : $(CC) $(C++FLAGS) -fexceptions -c -o $@ stlinst.cpp
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -