gcc.mak
来自「stl的源码」· MAK 代码 · 共 231 行
MAK
231 行
# -*- Makefile -*- Time-stamp: <08/06/12 16:03:31 ptr>## Copyright (c) 1997-1999, 2002, 2003, 2005-2007# Petr Ovtchenkov## Portion Copyright (c) 1999-2001# Parallel Graphics Ltd.## Licensed under the Academic Free License version 3.0#ifndef NOT_USE_NOSTDLIBifeq ($(CXX_VERSION_MAJOR),2)# i.e. gcc before 3.x.x: 2.95, etc.# gcc before 3.x don't had libsupc++.a and libgcc_s.so# exceptions and operators new are in libgcc.a# Unfortunatly gcc before 3.x has a buggy C++ language support outside stdc++, so definition of STDLIB below is commentedNOT_USE_NOSTDLIB := 1#STDLIBS := $(shell ${CXX} -print-file-name=libgcc.a) -lpthread -lc -lmendififeq ($(CXX_VERSION_MAJOR),3)# gcc before 3.3 (i.e. 3.0.x, 3.1.x, 3.2.x) has buggy libsupc++, so we should link with libstdc++ to avoid oneifeq ($(CXX_VERSION_MINOR),0)NOT_USE_NOSTDLIB := 1endififeq ($(CXX_VERSION_MINOR),1)NOT_USE_NOSTDLIB := 1endififeq ($(CXX_VERSION_MINOR),2)NOT_USE_NOSTDLIB := 1endifendifendififndef NOT_USE_NOSTDLIBifeq ($(OSNAME),linux)_USE_NOSTDLIB := 1endififeq ($(OSNAME),openbsd)_USE_NOSTDLIB := 1endififeq ($(OSNAME),freebsd)_USE_NOSTDLIB := 1endififeq ($(OSNAME),netbsd)_USE_NOSTDLIB := 1endififeq ($(OSNAME),sunos)_USE_NOSTDLIB := 1endififeq ($(OSNAME),darwin)_USE_NOSTDLIB := 1endififeq ($(OSNAME),cygming)_USE_NOSTDLIB := 1endifendififndef WITHOUT_STLPORTifeq (${STLPORT_LIB_DIR},)ifneq ($(OSNAME),cygming)release-shared: STLPORT_LIB = -lstlportrelease-static: STLPORT_LIB = -Wl,-Bstatic -lstlport -Wl,-Bdynamicdbg-shared: STLPORT_LIB = -lstlportgdbg-static: STLPORT_LIB = -Wl,-Bstatic -lstlportg -Wl,-Bdynamicstldbg-shared: STLPORT_LIB = -lstlportstlgstldbg-static: STLPORT_LIB = -Wl,-Bstatic -lstlportstlg -Wl,-BdynamicelseLIB_VERSION = ${LIBMAJOR}.${LIBMINOR}release-shared : STLPORT_LIB = -lstlport.${LIB_VERSION}dbg-shared : STLPORT_LIB = -lstlportg.${LIB_VERSION}stldbg-shared : STLPORT_LIB = -lstlportstlg.${LIB_VERSION}endifelse# STLPORT_LIB_DIR not emptyifneq ($(OSNAME),cygming)release-shared: STLPORT_LIB = -L${STLPORT_LIB_DIR} -lstlportrelease-static: STLPORT_LIB = -L${STLPORT_LIB_DIR} -Wl,-Bstatic -lstlport -Wl,-Bdynamicdbg-shared: STLPORT_LIB = -L${STLPORT_LIB_DIR} -lstlportgdbg-static: STLPORT_LIB = -L${STLPORT_LIB_DIR} -Wl,-Bstatic -lstlportg -Wl,-Bdynamicstldbg-shared: STLPORT_LIB = -L${STLPORT_LIB_DIR} -lstlportstlgstldbg-static: STLPORT_LIB = -L${STLPORT_LIB_DIR} -Wl,-Bstatic -lstlportstlg -Wl,-BdynamicelseLIB_VERSION = ${LIBMAJOR}.${LIBMINOR}release-shared : STLPORT_LIB = -L${BASE_INSTALL_DIR}/lib -lstlport.${LIB_VERSION}dbg-shared : STLPORT_LIB = -L${BASE_INSTALL_DIR}/lib -lstlportg.${LIB_VERSION}stldbg-shared : STLPORT_LIB = -L${BASE_INSTALL_DIR}/lib -lstlportstlg.${LIB_VERSION}endifendifendififdef _USE_NOSTDLIB# Check whether gcc builded with --disable-sharedifeq ($(shell ${CXX} ${CXXFLAGS} -print-file-name=libgcc_eh.a),libgcc_eh.a)# gcc builded with --disable-shared, (no library libgcc_eh.a); all exception support in libgcc.a_LGCC_EH :=_LGCC_S := -lgccelse# gcc builded with --enable-shared (default)ifdef USE_STATIC_LIBGCC# if force usage of static libgcc, then exceptions support should be taken from libgcc_eh_LGCC_EH := -lgcc_eh_LGCC_S := -lgccelse# otherwise, exceptions support is in libgcc_s.so_LGCC_EH :=ifneq ($(OSNAME),darwin)_LGCC_S := -lgcc_selseifdef GCC_APPLE_CCifeq ($(MACOSX_TEN_FIVE),true)_LGCC_S := -lgcc_s.10.5else_LGCC_S := -lgcc_s.10.4endifelse_LGCC_S := -lgcc_s# end of GCC_APPLE_CCendif# end of Darwinendif# end of !USE_STATIC_LIBGCCendif# end of present libgcc_eh.aendif# ifeq ($(CXX_VERSION_MAJOR),3)ifeq ($(OSNAME),linux)START_OBJ := $(shell for o in crt1.o crti.o crtbegin.o; do ${CXX} ${CXXFLAGS} -print-file-name=$$o; done)END_OBJ := $(shell for o in crtend.o crtn.o; do ${CXX} ${CXXFLAGS} -print-file-name=$$o; done)STDLIBS = ${STLPORT_LIB} ${_LGCC_S} -lpthread -lc -lmendififeq ($(OSNAME),openbsd)START_OBJ := $(shell for o in crt0.o crtbegin.o; do ${CXX} ${CXXFLAGS} -print-file-name=$$o; done)END_OBJ := $(shell for o in crtend.o; do ${CXX} ${CXXFLAGS} -print-file-name=$$o; done)STDLIBS = ${STLPORT_LIB} ${_LGCC_S} -lpthread -lc -lmendififeq ($(OSNAME),freebsd)# FreeBSD < 5.3 should use -lc_r, while FreeBSD >= 5.3 use -lpthreadPTHR := $(shell if [ ${OSREL_MAJOR} -gt 5 ] ; then echo "pthread" ; else if [ ${OSREL_MAJOR} -lt 5 ] ; then echo "c_r" ; else if [ ${OSREL_MINOR} -lt 3 ] ; then echo "c_r" ; else echo "pthread"; fi ; fi ; fi)START_OBJ := $(shell for o in crt1.o crti.o crtbegin.o; do ${CXX} ${CXXFLAGS} -print-file-name=$$o; done)END_OBJ := $(shell for o in crtend.o crtn.o; do ${CXX} ${CXXFLAGS} -print-file-name=$$o; done)STDLIBS = ${STLPORT_LIB} ${_LGCC_S} -l${PTHR} -lc -lmendififeq ($(OSNAME),netbsd)START_OBJ := $(shell for o in crt1.o crti.o crtbegin.o; do ${CXX} ${CXXFLAGS} -print-file-name=$$o; done)END_OBJ := $(shell for o in crtend.o crtn.o; do ${CXX} ${CXXFLAGS} -print-file-name=$$o; done)STDLIBS = ${STLPORT_LIB} ${_LGCC_S} -lpthread -lc -lmendififeq ($(OSNAME),sunos)START_OBJ := $(shell for o in crt1.o crti.o crtbegin.o; do ${CXX} ${CXXFLAGS} -print-file-name=$$o; done)END_OBJ := $(shell for o in crtend.o crtn.o; do ${CXX} ${CXXFLAGS} -print-file-name=$$o; done)STDLIBS = ${STLPORT_LIB} ${_LGCC_S} -lpthread -lc -lmendififeq ($(OSNAME),darwin)# sometimes crt3.o will required: it has __cxa_at_exit, but the same defined in libc.dyn# at least in Mac OS X 10.4.10 (8R2218)ifeq ($(CXX_VERSION_MAJOR),3)# i.e. gcc 3.3START_OBJ := $(shell for o in crt1.o crt2.o; do ${CXX} ${CXXFLAGS} -print-file-name=$$o; done)elseSTART_OBJ := -lcrt1.oendifEND_OBJ :=STDLIBS = ${STLPORT_LIB} ${_LGCC_S} -lpthread -lc -lm -lsupc++ ${_LGCC_EH}#LDFLAGS += -dynamicendififeq ($(OSNAME),cygming)LDFLAGS += -nodefaultlibsifndef USE_STATIC_LIBGCCifeq ($(shell ${CXX} ${CXXFLAGS} -print-file-name=libgcc_s.a),libgcc_s.a)_LGCC_S := -lgccelse_LGCC_S := -lgcc_sendifelse_LGCC_S := -lgccendififeq ($(OSREALNAME),mingw)STDLIBS = ${STLPORT_LIB} -lsupc++ ${_LGCC_S} -lmingw32 -lmingwex -lmsvcrt -lm -lmoldname -lcoldname -lkernel32elseLDFLAGS += -Wl,-enable-auto-importifneq (,$(findstring no-cygwin,$(EXTRA_CXXFLAGS)))STDLIBS = ${STLPORT_LIB} ${_LGCC_S} -lmingw32 -lmingwex -lmsvcrt -lm -lmoldname -lcoldname -lkernel32elseSTDLIBS = ${STLPORT_LIB} ${_LGCC_S} -lm -lc -lpthread -lkernel32endifendifelseLDFLAGS += -nostdlibendif# endif# _USE_NOSTDLIBelseifndef USE_STATIC_LIBGCCrelease-shared : LDFLAGS += -shared-libgccdbg-shared : LDFLAGS += -shared-libgccstldbg-shared : LDFLAGS += -shared-libgccendififndef WITHOUT_STLPORTSTDLIBS = ${STLPORT_LIB}elseSTDLIBS = endifendif# workaround for gcc 2.95.x bug:ifeq ($(CXX_VERSION_MAJOR),2)ifneq ($(OSNAME),cygming)OPT += -fPICendifendif
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?