|
Packit Service |
3470d1 |
# BEGIN_ICS_COPYRIGHT8 ****************************************
|
|
Packit Service |
3470d1 |
#
|
|
Packit Service |
3470d1 |
# Copyright (c) 2015, Intel Corporation
|
|
Packit Service |
3470d1 |
#
|
|
Packit Service |
3470d1 |
# Redistribution and use in source and binary forms, with or without
|
|
Packit Service |
3470d1 |
# modification, are permitted provided that the following conditions are met:
|
|
Packit Service |
3470d1 |
#
|
|
Packit Service |
3470d1 |
# * Redistributions of source code must retain the above copyright notice,
|
|
Packit Service |
3470d1 |
# this list of conditions and the following disclaimer.
|
|
Packit Service |
3470d1 |
# * Redistributions in binary form must reproduce the above copyright
|
|
Packit Service |
3470d1 |
# notice, this list of conditions and the following disclaimer in the
|
|
Packit Service |
3470d1 |
# documentation and/or other materials provided with the distribution.
|
|
Packit Service |
3470d1 |
# * Neither the name of Intel Corporation nor the names of its contributors
|
|
Packit Service |
3470d1 |
# may be used to endorse or promote products derived from this software
|
|
Packit Service |
3470d1 |
# without specific prior written permission.
|
|
Packit Service |
3470d1 |
#
|
|
Packit Service |
3470d1 |
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
Packit Service |
3470d1 |
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
Packit Service |
3470d1 |
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
Packit Service |
3470d1 |
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
|
|
Packit Service |
3470d1 |
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
Packit Service |
3470d1 |
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
Packit Service |
3470d1 |
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
Packit Service |
3470d1 |
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
Packit Service |
3470d1 |
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
Packit Service |
3470d1 |
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
Packit Service |
3470d1 |
#
|
|
Packit Service |
3470d1 |
# END_ICS_COPYRIGHT8 ****************************************
|
|
Packit Service |
3470d1 |
# Target specific defines for building PPC target using GNU tools
|
|
Packit Service |
3470d1 |
|
|
Packit Service |
3470d1 |
SHLIB_VERSION ?= 0.0
|
|
Packit Service |
3470d1 |
LIB_PREFIX = $(BUILDDIR)/lib
|
|
Packit Service |
3470d1 |
SHLIB_SUFFIX = .dylib
|
|
Packit Service |
3470d1 |
SHLIB_VERSION_SUFFIX= .$(SHLIB_VERSION).dylib
|
|
Packit Service |
3470d1 |
ARLIB_SUFFIX = .a
|
|
Packit Service |
3470d1 |
EXE_SUFFIX =
|
|
Packit Service |
3470d1 |
KEXT_SUFFIX = .kext
|
|
Packit Service |
3470d1 |
OBJ_SUFFIX = .o
|
|
Packit Service |
3470d1 |
EXP_SUFFIX = .exp
|
|
Packit Service |
3470d1 |
RES_SUFFIX = .res
|
|
Packit Service |
3470d1 |
PRE_SUFFIX = .pre
|
|
Packit Service |
3470d1 |
|
|
Packit Service |
3470d1 |
# Paths:
|
|
Packit Service |
3470d1 |
# let compiler default inclusion of /usr/include, otherwise g++ builds broken
|
|
Packit Service |
3470d1 |
SYS_INCLUDE_DIRS =
|
|
Packit Service |
3470d1 |
SYS_LIB_DIRS =
|
|
Packit Service |
3470d1 |
|
|
Packit Service |
3470d1 |
CC = /usr/bin/distcc /usr/bin/gcc-3.3
|
|
Packit Service |
3470d1 |
CCC = /usr/bin/distcc /usr/bin/gcc-3.3 -x c++
|
|
Packit Service |
3470d1 |
LD = ld
|
|
Packit Service |
3470d1 |
LINT = lint
|
|
Packit Service |
3470d1 |
AR = ar
|
|
Packit Service |
3470d1 |
NM = nm
|
|
Packit Service |
3470d1 |
OBJCOPY = objcopy
|
|
Packit Service |
3470d1 |
|
|
Packit Service |
3470d1 |
include $(TL_DIR)/Makerules/Defs.GNU
|
|
Packit Service |
3470d1 |
|
|
Packit Service |
3470d1 |
# for GNU we set an soname on shared libraries
|
|
Packit Service |
3470d1 |
# on MAC it must be a full pathname
|
|
Packit Service |
3470d1 |
# this is a bit of a HACK since we hardcode the pathname
|
|
Packit Service |
3470d1 |
SHLIB_SONAME=/usr/lib/$(notdir $(CMD_TARGETS_SHLIB))
|
|
Packit Service |
3470d1 |
|
|
Packit Service |
3470d1 |
# C/C++ compilation
|
|
Packit Service |
3470d1 |
# ----------------------------
|
|
Packit Service |
3470d1 |
# no-common - will put globals uninitialized in .bss instead of .common
|
|
Packit Service |
3470d1 |
# hence get link error if multiple declaration
|
|
Packit Service |
3470d1 |
# -fcheck-new does the opposite of what the manual implies.
|
|
Packit Service |
3470d1 |
# -fcheck-new DISABLES the run-time test of return value from new
|
|
Packit Service |
3470d1 |
# TBD - should the following only be for kernel:
|
|
Packit Service |
3470d1 |
# -fno-common
|
|
Packit Service |
3470d1 |
# TBD -mcpu=970
|
|
Packit Service |
3470d1 |
CMACH = -Wall -arch ppc -pipe -Wno-trigraphs -fasm-blocks -mtune=G5 -fmessage-length=0 -fpch-preprocess -fno-common -finline -fno-keep-inline-functions -force_cpusubtype_ALL -DCPU_BE -D__PPC__
|
|
Packit Service |
3470d1 |
CCMACH = $(CMACH) -fcheck-new -Wno-ctor-dtor-privacy -fno-rtti
|
|
Packit Service |
3470d1 |
CSYS = -D__DARWIN__ -DAPPLE -DNeXT
|
|
Packit Service |
3470d1 |
CCSYS = $(CSYS)
|
|
Packit Service |
3470d1 |
CCLIBS =
|
|
Packit Service |
3470d1 |
release_CCOPT_Flags =-O2 -fno-strength-reduce
|
|
Packit Service |
3470d1 |
debug_CCOPT_Flags = -O0
|
|
Packit Service |
3470d1 |
release_COPT_Flags =-O2 -fno-strength-reduce
|
|
Packit Service |
3470d1 |
debug_COPT_Flags = -O0
|
|
Packit Service |
3470d1 |
# Assemble the optimization flags based upon desired build configuration.
|
|
Packit Service |
3470d1 |
CCOPT = $($(strip $(BUILD_CONFIG))_CCOPT_Flags)
|
|
Packit Service |
3470d1 |
COPT = $($(strip $(BUILD_CONFIG))_COPT_Flags)
|
|
Packit Service |
3470d1 |
release_CCDEBUG_Flags =
|
|
Packit Service |
3470d1 |
release_CDEBUG_Flags =
|
|
Packit Service |
3470d1 |
debug_CCDEBUG_Flags =-g -DIB_DEBUG -D_DEBUG -DDEBUG -DIB_TRACE $(CCPROJDEBUG) $(CCLOCALDEBUG)
|
|
Packit Service |
3470d1 |
debug_CDEBUG_Flags =-g -DIB_DEBUG -D_DEBUG -DDEBUG -DIB_TRACE $(CPROJDEBUG) $(CLOCALDEBUG)
|
|
Packit Service |
3470d1 |
# Assemble the debug flags based upon desired build configuration.
|
|
Packit Service |
3470d1 |
CCDEBUG = $($(strip $(BUILD_CONFIG))_CCDEBUG_Flags)
|
|
Packit Service |
3470d1 |
CDEBUG = $($(strip $(BUILD_CONFIG))_CDEBUG_Flags)
|
|
Packit Service |
3470d1 |
|
|
Packit Service |
3470d1 |
# Kernel build settings
|
|
Packit Service |
3470d1 |
#---------------------------------------------
|
|
Packit Service |
3470d1 |
# use CKERNEL and KERNEL_INCLUDE_DIRS to augment CLOCAL, LOCAL_INCLUDE_DIRS when
|
|
Packit Service |
3470d1 |
# building a kernel module
|
|
Packit Service |
3470d1 |
|
|
Packit Service |
3470d1 |
# TBD -fno-strict-aliasing - disables optimizations related to unions/casts
|
|
Packit Service |
3470d1 |
# -include picks up special kernel version specific flags, this allows portable
|
|
Packit Service |
3470d1 |
# kernel modules to be built for multiple system types from a single running
|
|
Packit Service |
3470d1 |
# system
|
|
Packit Service |
3470d1 |
# TBD keep -g on release builds to aid stack backtraces
|
|
Packit Service |
3470d1 |
CKERNELOPTS = -fno-exceptions -msoft-float -mlong-branch -fno-builtin -nostdinc -DKERNEL -DKERNEL_PRIVATE -DDRIVER_PRIVATE -D__KERNEL__ -D_KERNEL -static -include $(TL_DIR)/Makerules/DARWIN/$(BUILD_TARGET).$(BUILD_TARGET_OS_VENDOR).$(BUILD_TARGET_OS_VERSION).h
|
|
Packit Service |
3470d1 |
# omit frame pointer for simple functions
|
|
Packit Service |
3470d1 |
ifeq "$(BUILD_CONFIG)" "release"
|
|
Packit Service |
3470d1 |
#CKERNELOPTS+= -Os -fomit-frame-pointer
|
|
Packit Service |
3470d1 |
CKERNELOPTS+= -O2 -fomit-frame-pointer
|
|
Packit Service |
3470d1 |
else
|
|
Packit Service |
3470d1 |
CKERNELOPTS+= -O1
|
|
Packit Service |
3470d1 |
endif
|
|
Packit Service |
3470d1 |
CKERNEL = -x c++ -fapple-kext $(CKERNELOPTS)
|
|
Packit Service |
3470d1 |
|
|
Packit Service |
3470d1 |
# Include directories for kernel
|
|
Packit Service |
3470d1 |
KERNELDIR=/System/Library/Frameworks/Kernel.framework
|
|
Packit Service |
3470d1 |
KERNEL_INCLUDE_DIRS=$(KERNELDIR)/Headers $(KERNELDIR)/Headers/bsd $(KERNELDIR)/PrivateHeaders /usr/include/g++-3/ke /usr/include/g++-3
|
|
Packit Service |
3470d1 |
|
|
Packit Service |
3470d1 |
# linking
|
|
Packit Service |
3470d1 |
# ----------------------------
|
|
Packit Service |
3470d1 |
LDMACH = -arch ppc
|
|
Packit Service |
3470d1 |
LDSYS =
|
|
Packit Service |
3470d1 |
#MKSHLIB = $(CCC) $(CCDEBUG) $(COPT) -shared
|
|
Packit Service |
3470d1 |
#MKSHLIB = $(LD) -dylib
|
|
Packit Service |
3470d1 |
MKSHLIB = $(CC) -dynamiclib -Wl,-prebind_allow_overlap -Wl,-single_module -compatibility_version 1 -current_version 1
|
|
Packit Service |
3470d1 |
#MKSHLIB = /usr/bin/libtool -dynamic -prebind -compatibility_version 1 -current_version 1
|
|
Packit Service |
3470d1 |
#MKSHLIB = /usr/bin/libtool -dynamic
|
|
Packit Service |
3470d1 |
ifeq "$(strip $(LIBFILES))" ""
|
|
Packit Service |
3470d1 |
MKARLIB = $(AR) crus$(space)
|
|
Packit Service |
3470d1 |
else
|
|
Packit Service |
3470d1 |
MKARLIB = $(MAKETOOLS_DIR)/mkarlib.sh $(AR) crus$(space)
|
|
Packit Service |
3470d1 |
endif
|
|
Packit Service |
3470d1 |
MKPARTIAL = $(LD) -r -o
|
|
Packit Service |
3470d1 |
#MKMODULE = /usr/bin/g++-3.3 -arch ppc -static -nostdlib -r -lkmodc++ -lkmod -lcc_kext -o
|
|
Packit Service |
3470d1 |
MKMODULE = /usr/bin/g++-3.3 -o
|
|
Packit Service |
3470d1 |
|
|
Packit Service |
3470d1 |
KERNELOPTS = -arch ppc -static -nostdlib -r -lkmodc++ -lkmod -lcc_kext
|
|
Packit Service |
3470d1 |
|
|
Packit Service |
3470d1 |
SYSLIBS = -lpthread -lstdc++
|
|
Packit Service |
3470d1 |
#LDLIBS = -Xlinker --start-group $(foreach lib,$(LOCALLIBS) $(LOCALDEPLIBS) $(MODLIBS) $(MODDEPLIBS) $(PROJLIBS) $(PROJDEPLIBS),-l$(lib)) -Xlinker --end-group $(SYSLIBS)
|
|
Packit Service |
3470d1 |
LDLIBS = $(foreach lib,$(LOCALLIBS) $(LOCALDEPLIBS) $(MODLIBS) $(MODDEPLIBS) $(PROJLIBS) $(PROJDEPLIBS),-l$(lib)) $(SYSLIBS)
|
|
Packit Service |
3470d1 |
# libraries for partial link of a kernel loadable module
|
|
Packit Service |
3470d1 |
#KERNELLIBS = -static -r -Xlinker --start-group -nostdlib -lkmodc++ -lkmod -lcc_kext $(foreach lib,$(LOCALLIBS) $(LOCALDEPLIBS) $(MODLIBS) $(MODDEPLIBS) $(PROJLIBS) $(PROJDEPLIBS),-l$(lib)) -Xlinker --end-group
|
|
Packit Service |
3470d1 |
KERNELLIBS = $(KERNELOPTS)
|
|
Packit Service |
3470d1 |
|
|
Packit Service |
3470d1 |
# KEXT creation
|
|
Packit Service |
3470d1 |
ifeq "$(BUILD_PLATFORM_OS_VENDOR_VERSION)" "10.3"
|
|
Packit Service |
3470d1 |
PBXCP = "/Developer/Tools/pbxcp"
|
|
Packit Service |
3470d1 |
else
|
|
Packit Service |
3470d1 |
PBXCP = "/System/Library/PrivateFrameworks/DevToolsCore.framework/Resources/pbxcp"
|
|
Packit Service |
3470d1 |
endif
|