From f9986731989e7cc3a504a288e68d3966adf1f8f7 Mon Sep 17 00:00:00 2001 From: root Date: Sat, 8 Oct 2022 14:08:10 +0800 Subject: [PATCH] Add loongarch makerulefile --- Makerules/Target.LINUX.GNU.loongarch64 | 107 +++++++++++++++++++++++++ 1 file changed, 107 insertions(+) create mode 100755 Makerules/Target.LINUX.GNU.loongarch64 diff --git a/Makerules/Target.LINUX.GNU.loongarch64 b/Makerules/Target.LINUX.GNU.loongarch64 new file mode 100755 index 0000000..d60c5d2 --- /dev/null +++ b/Makerules/Target.LINUX.GNU.loongarch64 @@ -0,0 +1,107 @@ +# BEGIN_ICS_COPYRIGHT8 **************************************** +# +# Copyright (c) 2015, Intel Corporation +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# +# * Redistributions of source code must retain the above copyright notice, +# this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# * Neither the name of Intel Corporation nor the names of its contributors +# may be used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# END_ICS_COPYRIGHT8 **************************************** +# suffixes and commands to build targets for: +# BUILD_TARGET_OS=LINUX +# BUILD_TARGET_TOOLCHAIN=GNU +# BUILD_TARGET=loongarch64 +# Target specific defines for building LINUX target using GNU tools + +SHLIB_VERSION ?= 0.0 +LIB_PREFIX = $(BUILDDIR)/lib +SHLIB_SUFFIX = .so +SHLIB_VERSION_SUFFIX= .so.$(SHLIB_VERSION) +ARLIB_SUFFIX = .a +EXE_SUFFIX = +OBJ_SUFFIX = .o +ifdef BUILD_26 +KOBJ_SUFFIX = .ko +else +KOBJ_SUFFIX = .o +endif +EXP_SUFFIX = .exp +RES_SUFFIX = .res +PRE_SUFFIX = .pre + +# Paths: +# let compiler default inclusion of /usr/include, otherwise g++ builds broken +SYS_INCLUDE_DIRS = +SYS_LIB_DIRS = + +#SBTOOLS_PATH = /usr/local/sbtools/x86-linux-rh7.2/mips-linux-2.3.1/bin + +CC = gcc +CCC = g++ +LD = ld +LINT = lint +AR = ar +NM = nm + +include $(TL_DIR)/Makerules/Defs.GNU + +# for GNU we set an soname on shared libraries +SHLIB_SONAME=$(notdir $(CMD_TARGETS_SHLIB)) + +# C/C++ compilation +# ---------------------------- +# -fcheck-new does the opposite of what the manual implies. +# -fcheck-new DISABLES the run-time test of return value from new +CMACH = -DTARGET_CPU_FAMILY_X86 -Wall -DCPU_BE -fno-strict-aliasing +CCMACH = $(CMACH) -fcheck-new -Wno-ctor-dtor-privacy +CSYS = +CCSYS = $(CSYS) +CCLIBS = +release_CCOPT_Flags ?=-O +debug_CCOPT_Flags = +# Assemble the optimization flags based upon desired build configuration. +CCOPT = $($(strip $(BUILD_CONFIG))_CCOPT_Flags) -DLINUX -Dlinux -D__LINUX__ +# for now assume C++ flags are valid on C compiler +COPT = $(CCOPT) +release_CCDEBUG_Flags = +release_CDEBUG_Flags = +debug_CCDEBUG_Flags =-g -DIB_DEBUG -DIB_TRACE $(CCPROJDEBUG) $(CCLOCALDEBUG) +debug_CDEBUG_Flags =-g -DIB_DEBUG -DIB_TRACE $(CPROJDEBUG) $(CLOCALDEBUG) +# Assemble the debug flags based upon desired build configuration. +CCDEBUG = $($(strip $(BUILD_CONFIG))_CCDEBUG_Flags) +CDEBUG = $($(strip $(BUILD_CONFIG))_CDEBUG_Flags) + +# linking +# ---------------------------- +LDMACH = +LDSYS = +MKSHLIB = $(CCC) $(CCDEBUG) $(COPT) -shared +ifeq "$(strip $(LIBFILES))" "" +MKARLIB = $(AR) crus$(space) +else +MKARLIB = $(MAKETOOLS_DIR)/mkarlib.sh $(AR) crus$(space) +endif +MKPARTIAL = $(LD) -r -o + +LDLIBSRCH += $(foreach lib,$(LD_LIB_DIRS),-Xlinker -rpath-link -Xlinker $(lib)) +SYSLIBS = -lpthread +LDLIBS = -Xlinker --start-group $(foreach lib,$(LOCALLIBS) $(LOCALDEPLIBS) $(MODLIBS) $(MODDEPLIBS) $(PROJLIBS) $(PROJDEPLIBS),-l$(lib)) -Xlinker --end-group $(SYSLIBS) -- 2.31.1