|
Packit |
857059 |
# BEGIN_ICS_COPYRIGHT8 ****************************************
|
|
Packit |
857059 |
#
|
|
Packit |
857059 |
# Copyright (c) 2015, Intel Corporation
|
|
Packit |
857059 |
#
|
|
Packit |
857059 |
# Redistribution and use in source and binary forms, with or without
|
|
Packit |
857059 |
# modification, are permitted provided that the following conditions are met:
|
|
Packit |
857059 |
#
|
|
Packit |
857059 |
# * Redistributions of source code must retain the above copyright notice,
|
|
Packit |
857059 |
# this list of conditions and the following disclaimer.
|
|
Packit |
857059 |
# * Redistributions in binary form must reproduce the above copyright
|
|
Packit |
857059 |
# notice, this list of conditions and the following disclaimer in the
|
|
Packit |
857059 |
# documentation and/or other materials provided with the distribution.
|
|
Packit |
857059 |
# * Neither the name of Intel Corporation nor the names of its contributors
|
|
Packit |
857059 |
# may be used to endorse or promote products derived from this software
|
|
Packit |
857059 |
# without specific prior written permission.
|
|
Packit |
857059 |
#
|
|
Packit |
857059 |
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
Packit |
857059 |
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
Packit |
857059 |
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
Packit |
857059 |
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
|
|
Packit |
857059 |
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
Packit |
857059 |
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
Packit |
857059 |
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
Packit |
857059 |
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
Packit |
857059 |
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
Packit |
857059 |
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
Packit |
857059 |
#
|
|
Packit |
857059 |
# END_ICS_COPYRIGHT8 ****************************************
|
|
Packit |
857059 |
# suffixes and commands to build targets for:
|
|
Packit |
857059 |
# BUILD_TARGET_OS=LINUX
|
|
Packit |
857059 |
# BUILD_TARGET_TOOLCHAIN=GNU
|
|
Packit |
857059 |
# BUILD_TARGET=EM64T
|
|
Packit |
857059 |
# Target specific defines for building LINUX target using GNU tools
|
|
Packit |
857059 |
|
|
Packit |
857059 |
SHLIB_VERSION ?= 0.0
|
|
Packit |
857059 |
LIB_PREFIX = $(BUILDDIR)/lib
|
|
Packit |
857059 |
SHLIB_SUFFIX = .so
|
|
Packit |
857059 |
SHLIB_VERSION_SUFFIX= .so.$(SHLIB_VERSION)
|
|
Packit |
857059 |
ARLIB_SUFFIX = .a
|
|
Packit |
857059 |
EXE_SUFFIX =
|
|
Packit |
857059 |
OBJ_SUFFIX = .o
|
|
Packit |
857059 |
ifdef BUILD_26
|
|
Packit |
857059 |
KOBJ_SUFFIX = .ko
|
|
Packit |
857059 |
else
|
|
Packit |
857059 |
KOBJ_SUFFIX = .o
|
|
Packit |
857059 |
endif
|
|
Packit |
857059 |
EXP_SUFFIX = .exp
|
|
Packit |
857059 |
RES_SUFFIX = .res
|
|
Packit |
857059 |
PRE_SUFFIX = .pre
|
|
Packit |
857059 |
|
|
Packit |
857059 |
# Paths:
|
|
Packit |
857059 |
# let compiler default inclusion of /usr/include, otherwise g++ builds broken
|
|
Packit |
857059 |
SYS_INCLUDE_DIRS =
|
|
Packit |
857059 |
SYS_LIB_DIRS =
|
|
Packit |
857059 |
|
|
Packit |
857059 |
CC = gcc
|
|
Packit |
857059 |
CCC = g++
|
|
Packit |
857059 |
LD = ld
|
|
Packit |
857059 |
LINT = lint
|
|
Packit |
857059 |
AR = ar
|
|
Packit |
857059 |
NM = nm
|
|
Packit |
857059 |
OBJCOPY = objcopy
|
|
Packit |
857059 |
|
|
Packit |
857059 |
include $(TL_DIR)/Makerules/Defs.GNU
|
|
Packit |
857059 |
|
|
Packit |
857059 |
# for GNU we set an soname on shared libraries
|
|
Packit |
857059 |
SHLIB_SONAME=$(notdir $(CMD_TARGETS_SHLIB))
|
|
Packit |
857059 |
|
|
Packit |
857059 |
# C/C++ compilation
|
|
Packit |
857059 |
# ----------------------------
|
|
Packit |
857059 |
# -fcheck-new does the opposite of what the manual implies.
|
|
Packit |
857059 |
# -fcheck-new DISABLES the run-time test of return value from new
|
|
Packit |
857059 |
CMACH = -pipe -DTARGET_CPU_FAMILY_X86 -Wall -D__X86_64__ -D__EM64T__ -DCPU_LE -m64 -fno-strict-aliasing
|
|
Packit |
857059 |
CCMACH = $(CMACH) -fcheck-new -Wno-ctor-dtor-privacy
|
|
Packit |
857059 |
CSYS = -DLINUX -Dlinux -D__LINUX__
|
|
Packit |
857059 |
CCSYS = $(CSYS)
|
|
Packit |
857059 |
CCLIBS =
|
|
Packit Service |
605bc7 |
release_CCOPT_Flags ?=-O2 -fno-strength-reduce
|
|
Packit |
857059 |
debug_CCOPT_Flags =
|
|
Packit Service |
605bc7 |
release_COPT_Flags ?=-O2 -fno-strength-reduce
|
|
Packit |
857059 |
0debug_COPT_Flags =
|
|
Packit |
857059 |
# Assemble the optimization flags based upon desired build configuration.
|
|
Packit |
857059 |
CCOPT = $($(strip $(BUILD_CONFIG))_CCOPT_Flags)
|
|
Packit |
857059 |
COPT = $($(strip $(BUILD_CONFIG))_COPT_Flags)
|
|
Packit |
857059 |
release_CCDEBUG_Flags =
|
|
Packit |
857059 |
release_CDEBUG_Flags =
|
|
Packit |
857059 |
debug_CCDEBUG_Flags =-g -DIB_DEBUG -DIB_TRACE $(CCPROJDEBUG) $(CCLOCALDEBUG)
|
|
Packit |
857059 |
debug_CDEBUG_Flags =-g -DIB_DEBUG -DIB_TRACE $(CPROJDEBUG) $(CLOCALDEBUG)
|
|
Packit |
857059 |
# Assemble the debug flags based upon desired build configuration.
|
|
Packit |
857059 |
CCDEBUG = $($(strip $(BUILD_CONFIG))_CCDEBUG_Flags)
|
|
Packit |
857059 |
CDEBUG = $($(strip $(BUILD_CONFIG))_CDEBUG_Flags)
|
|
Packit |
857059 |
|
|
Packit |
857059 |
# Kernel build settings
|
|
Packit |
857059 |
#---------------------------------------------
|
|
Packit |
857059 |
# use CKERNEL and KERNEL_INCLUDE_DIRS to augment CLOCAL, LOCAL_INCLUDE_DIRS when
|
|
Packit |
857059 |
# building a kernel module
|
|
Packit |
857059 |
|
|
Packit |
857059 |
# strict-aliasing - disables optimizations related to unions/casts
|
|
Packit |
857059 |
# no-common - will put globals uninitialized in .bss instead of common
|
|
Packit |
857059 |
# hence get link error if multiple declaration
|
|
Packit |
857059 |
# preferred-stack-boundary=2 -align stack to 2^2 byte boundary,
|
|
Packit |
857059 |
# possible performance penalty for 64 bit data
|
|
Packit |
857059 |
# TBD, what does kernel use
|
|
Packit |
857059 |
# -D_I386_PTRACE_H was a workaround for a ptrace.h header file inclusion issue
|
|
Packit |
857059 |
# identify where needed and just put in that one makefile
|
|
Packit |
857059 |
# -include picks up special flags for SMP and MODVERSIONS, this allows portable
|
|
Packit |
857059 |
# kernel modules to be built for multiple system types from a single running
|
|
Packit |
857059 |
# system
|
|
Packit |
857059 |
|
|
Packit |
857059 |
ifndef BUILD_26
|
|
Packit |
857059 |
|
|
Packit |
857059 |
CKERNEL=-D_KERNEL -D__KERNEL__ -DMODULE -DEXPORT_SYMTAB -mcmodel=kernel -Wno-trigraphs -mno-red-zone -fno-reorder-blocks -finline-limit=2000 -fno-strict-aliasing -fno-common -msoft-float
|
|
Packit |
857059 |
# omit frame pointer for simple functions
|
|
Packit |
857059 |
# take advantage of pentium pro instructions, default is i386 compatible code
|
|
Packit |
857059 |
|
|
Packit |
857059 |
ifeq "$(BUILD_CONFIG)" "release"
|
|
Packit |
857059 |
CKERNEL+= -fomit-frame-pointer -O2 -fno-strength-reduce
|
|
Packit |
857059 |
else
|
|
Packit |
857059 |
# due to extern inline virt_to_phys in io.h in kernel, we must use at least -O1
|
|
Packit |
857059 |
# COPT will follow CLOCAL in CFLAGS, so it can request a different level
|
|
Packit |
857059 |
# of optimization if needed
|
|
Packit |
857059 |
CKERNEL+= -O1
|
|
Packit |
857059 |
endif
|
|
Packit |
857059 |
|
|
Packit |
857059 |
ifeq "$(GCC_MAJOR_VERSION)" "3"
|
|
Packit |
857059 |
ifeq "$(GCC_MINOR_VERSION)" "3"
|
|
Packit |
857059 |
ifeq "$(BUILD_PLATFORM_OS_VENDOR)" "SuSE"
|
|
Packit |
857059 |
CKERNEL+=-fno-unit-at-a-time
|
|
Packit |
857059 |
endif
|
|
Packit |
857059 |
endif
|
|
Packit |
857059 |
endif
|
|
Packit |
857059 |
|
|
Packit |
857059 |
endif
|
|
Packit |
857059 |
CKERNEL+=-include $(TL_DIR)/Makerules/LINUX/$(BUILD_TARGET).$(BUILD_TARGET_OS_VENDOR).$(BUILD_TARGET_OS_VERSION).h
|
|
Packit |
857059 |
|
|
Packit |
857059 |
# Include directories for kernel
|
|
Packit |
857059 |
KERNELDIR=/lib/modules/$(BUILD_TARGET_OS_VERSION)/build
|
|
Packit |
857059 |
KERNEL_INCLUDE_DIRS=$(KERNELDIR)/include
|
|
Packit |
857059 |
|
|
Packit |
857059 |
# linking
|
|
Packit |
857059 |
# ----------------------------
|
|
Packit |
857059 |
LDMACH =
|
|
Packit |
857059 |
LDSYS =
|
|
Packit |
857059 |
MKSHLIB = $(CCC) $(CCDEBUG) $(COPT) -shared
|
|
Packit |
857059 |
ifeq "$(strip $(LIBFILES))" ""
|
|
Packit |
857059 |
MKARLIB = $(AR) crus$(space)
|
|
Packit |
857059 |
else
|
|
Packit |
857059 |
MKARLIB = $(MAKETOOLS_DIR)/mkarlib.sh $(AR) crus$(space)
|
|
Packit |
857059 |
endif
|
|
Packit |
857059 |
MKPARTIAL = $(LD) -r -o
|
|
Packit |
857059 |
MKMODULE = $(LD) -r -o
|
|
Packit |
857059 |
|
|
Packit |
857059 |
LDLIBSRCH += $(foreach lib,$(LD_LIB_DIRS),-Xlinker -rpath-link -Xlinker $(lib))
|
|
Packit |
857059 |
SYSLIBS = -lpthread
|
|
Packit |
857059 |
LDLIBS = -Xlinker --start-group $(foreach lib,$(LOCALLIBS) $(LOCALDEPLIBS) $(MODLIBS) $(MODDEPLIBS) $(PROJLIBS) $(PROJDEPLIBS),-l$(lib)) -Xlinker --end-group $(SYSLIBS)
|
|
Packit |
857059 |
|
|
Packit |
857059 |
# libraries for partial link of a kernel loadable module
|
|
Packit |
857059 |
KERNELLIBS =
|