📄 gcc.mak
字号:
# -*- makefile -*- Time-stamp: <07/12/11 10:17:43 ptr># Oh, the commented below work for gmake 3.78.1 and above,# but phrase without tag not work for it. Since gmake 3.79 # tag with assignment fail, but work assignment for all tags# (really that more correct).ifneq ($(OSNAME), cygming)ifneq ($(OSNAME), windows)OPT += -fPICendifendififndef 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 STDLIBS 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 := 1endifendififdef _USE_NOSTDLIBNOSTDLIB :=# ifeq ($(CXX_VERSION_MAJOR),3)# 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 :=_LGCC_S := -lgcc_sendifendif# Include whole language support archive (libsupc++.a) into libstlport:# all C++ issues are in libstlport now.ifeq ($(OSNAME),linux)START_OBJ := $(shell for o in crt{i,beginS}.o; do ${CXX} ${CXXFLAGS} -print-file-name=$$o; done)#START_A_OBJ := $(shell for o in crt{i,beginT}.o; do ${CXX} -print-file-name=$$o; done)END_OBJ := $(shell for o in crt{endS,n}.o; do ${CXX} ${CXXFLAGS} -print-file-name=$$o; done)STDLIBS := -Wl,--whole-archive -lsupc++ ${_LGCC_EH} -Wl,--no-whole-archive ${_LGCC_S} -lpthread -lc -lmendififeq ($(OSNAME),openbsd)START_OBJ := $(shell for o in crtbeginS.o; do ${CXX} ${CXXFLAGS} -print-file-name=$$o; done)END_OBJ := $(shell for o in crtendS.o; do ${CXX} ${CXXFLAGS} -print-file-name=$$o; done)STDLIBS := -Wl,--whole-archive -lsupc++ ${_LGCC_EH} -Wl,--no-whole-archive ${_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 crti.o crtbeginS.o; do ${CXX} ${CXXFLAGS} -print-file-name=$$o; done)END_OBJ := $(shell for o in crtendS.o crtn.o; do ${CXX} ${CXXFLAGS} -print-file-name=$$o; done)STDLIBS := -Wl,--whole-archive -lsupc++ ${_LGCC_EH} -Wl,--no-whole-archive ${_LGCC_S} -l${PTHR} -lc -lmendififeq ($(OSNAME),netbsd)START_OBJ := $(shell for o in crt{i,beginS}.o; do ${CXX} ${CXXFLAGS} -print-file-name=$$o; done)END_OBJ := $(shell for o in crt{endS,n}.o; do ${CXX} ${CXXFLAGS} -print-file-name=$$o; done)STDLIBS := -Wl,--whole-archive -lsupc++ ${_LGCC_EH} -Wl,--no-whole-archive ${_LGCC_S} -lpthread -lc -lmendififeq ($(OSNAME),sunos)START_OBJ := $(shell for o in 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 := -Wl,-zallextract -lsupc++ ${_LGCC_EH} -Wl,-zdefaultextract ${_LGCC_S} -lpthread -lc -lmendififeq ($(OSNAME),darwin)START_OBJ := END_OBJ := ifdef GCC_APPLE_CCSTDLIBS := -lgcc -lc -lm -all_load -lsupc++elseLDFLAGS += -single_moduleSTDLIBS := ${_LGCC_S} -lc -lm -all_load -lsupc++ ${_LGCC_EH}endifendif#END_A_OBJ := $(shell for o in crtn.o; do ${CXX} -print-file-name=$$o; done)NOSTDLIB := -nostdlib# endifendififeq ($(OSNAME),hp-ux)dbg-shared: LDFLAGS += -shared -Wl,-C20 -Wl,-dynamic -Wl,+h$(SO_NAME_DBGxx) ${LDSEARCH}stldbg-shared: LDFLAGS += -shared -Wl,-C20 -Wl,-dynamic -Wl,+h$(SO_NAME_STLDBGxx) ${LDSEARCH}release-shared: LDFLAGS += -shared -Wl,-C20 -Wl,-dynamic -Wl,+h$(SO_NAMExx) ${LDSEARCH}endififeq ($(OSNAME),sunos)dbg-shared: LDFLAGS += -shared -Wl,-h$(SO_NAME_DBGxx) ${NOSTDLIB} ${LDSEARCH}stldbg-shared: LDFLAGS += -shared -Wl,-h$(SO_NAME_STLDBGxx) ${NOSTDLIB} ${LDSEARCH}release-shared: LDFLAGS += -shared -Wl,-h$(SO_NAMExx) ${NOSTDLIB} ${LDSEARCH}dbg-static: LDFLAGS += ${LDSEARCH}stldbg-static: LDFLAGS += ${LDSEARCH}release-static: LDFLAGS += ${LDSEARCH}endififeq ($(OSNAME),linux)dbg-shared: LDFLAGS += -shared -Wl,-h$(SO_NAME_DBGxx) ${NOSTDLIB} ${LDSEARCH}stldbg-shared: LDFLAGS += -shared -Wl,-h$(SO_NAME_STLDBGxx) ${NOSTDLIB} ${LDSEARCH}release-shared: LDFLAGS += -shared -Wl,-h$(SO_NAMExx) ${NOSTDLIB} ${LDSEARCH}dbg-static: LDFLAGS += ${LDSEARCH}stldbg-static: LDFLAGS += ${LDSEARCH}release-static: LDFLAGS += ${LDSEARCH}endififeq ($(OSNAME),cygming)dbg-shared: LDFLAGS += -shared -Wl,--out-implib=${LIB_NAME_OUT_DBG},--enable-auto-image-basestldbg-shared: LDFLAGS += -shared -Wl,--out-implib=${LIB_NAME_OUT_STLDBG},--enable-auto-image-baserelease-shared: LDFLAGS += -shared -Wl,--out-implib=${LIB_NAME_OUT},--enable-auto-image-basedbg-static: LDFLAGS += -static ${LDSEARCH}stldbg-static: LDFLAGS += -static ${LDSEARCH}release-static: LDFLAGS += -static ${LDSEARCH}endififeq ($(OSNAME),windows)dbg-shared: LDFLAGS += -shared -Wl,--out-implib=${LIB_NAME_OUT_DBG},--enable-auto-image-basestldbg-shared: LDFLAGS += -shared -Wl,--out-implib=${LIB_NAME_OUT_STLDBG},--enable-auto-image-baserelease-shared: LDFLAGS += -shared -Wl,--out-implib=${LIB_NAME_OUT},--enable-auto-image-basedbg-static: LDFLAGS += -static ${LDSEARCH}stldbg-static: LDFLAGS += -static ${LDSEARCH}release-static: LDFLAGS += -static ${LDSEARCH}endififeq ($(OSNAME),freebsd)dbg-shared: LDFLAGS += -shared -Wl,-h$(SO_NAME_DBGxx) ${NOSTDLIB} ${LDSEARCH}stldbg-shared: LDFLAGS += -shared -Wl,-h$(SO_NAME_STLDBGxx) ${NOSTDLIB} ${LDSEARCH}release-shared: LDFLAGS += -shared -Wl,-h$(SO_NAMExx) ${NOSTDLIB} ${LDSEARCH}dbg-static: LDFLAGS += ${LDSEARCH}stldbg-static: LDFLAGS += ${LDSEARCH}release-static: LDFLAGS += ${LDSEARCH}endififeq ($(OSNAME),darwin)CURRENT_VERSION := ${MAJOR}.${MINOR}.${PATCH}COMPATIBILITY_VERSION := $(CURRENT_VERSION)dbg-shared: LDFLAGS += -dynamic -dynamiclib -compatibility_version $(COMPATIBILITY_VERSION) -current_version $(CURRENT_VERSION) -install_name $(SO_NAME_DBGxx) ${LDSEARCH} ${NOSTDLIB}stldbg-shared: LDFLAGS += -dynamic -dynamiclib -compatibility_version $(COMPATIBILITY_VERSION) -current_version $(CURRENT_VERSION) -install_name $(SO_NAME_STLDBGxx) ${LDSEARCH} ${NOSTDLIB}release-shared: LDFLAGS += -dynamic -dynamiclib -compatibility_version $(COMPATIBILITY_VERSION) -current_version $(CURRENT_VERSION) -install_name $(SO_NAMExx) ${LDSEARCH} ${NOSTDLIB}dbg-static: LDFLAGS += -staticlib ${LDSEARCH}stldbg-static: LDFLAGS += -staticlib ${LDSEARCH}release-static: LDFLAGS += -staticlib ${LDSEARCH}endififeq ($(OSNAME),openbsd)dbg-shared: LDFLAGS += -shared -Wl,-soname -Wl,$(SO_NAME_DBGxx) ${NOSTDLIB} ${LDSEARCH}stldbg-shared: LDFLAGS += -shared -Wl,-soname -Wl,$(SO_NAME_STLDBGxx) ${NOSTDLIB} ${LDSEARCH}release-shared: LDFLAGS += -shared -Wl,-soname -Wl,$(SO_NAMExx) ${NOSTDLIB} ${LDSEARCH}dbg-static: LDFLAGS += ${LDSEARCH}stldbg-static: LDFLAGS += ${LDSEARCH}release-static: LDFLAGS += ${LDSEARCH}endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -