Blame Makerules/Target.DARWIN.GNU.PPC

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
# Target specific defines for building PPC target using GNU tools
Packit 857059
Packit 857059
SHLIB_VERSION		?= 0.0
Packit 857059
LIB_PREFIX			= $(BUILDDIR)/lib
Packit 857059
SHLIB_SUFFIX		= .dylib
Packit 857059
SHLIB_VERSION_SUFFIX= .$(SHLIB_VERSION).dylib
Packit 857059
ARLIB_SUFFIX		= .a
Packit 857059
EXE_SUFFIX			= 
Packit 857059
KEXT_SUFFIX			= .kext
Packit 857059
OBJ_SUFFIX			= .o
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			= /usr/bin/distcc /usr/bin/gcc-3.3
Packit 857059
CCC			= /usr/bin/distcc /usr/bin/gcc-3.3 -x c++
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
# on MAC it must be a full pathname
Packit 857059
# this is a bit of a HACK since we hardcode the pathname
Packit 857059
SHLIB_SONAME=/usr/lib/$(notdir $(CMD_TARGETS_SHLIB))
Packit 857059
Packit 857059
# C/C++ compilation
Packit 857059
# ----------------------------
Packit 857059
# no-common - will put globals uninitialized in .bss instead of .common
Packit 857059
# 		hence get link error if multiple declaration
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
# TBD - should the following only be for kernel:
Packit 857059
#	-fno-common
Packit 857059
# TBD -mcpu=970
Packit 857059
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 857059
CCMACH		= $(CMACH) -fcheck-new -Wno-ctor-dtor-privacy -fno-rtti
Packit 857059
CSYS		= -D__DARWIN__ -DAPPLE -DNeXT
Packit 857059
CCSYS		= $(CSYS)
Packit 857059
CCLIBS		=
Packit 857059
release_CCOPT_Flags	=-O2 -fno-strength-reduce
Packit 857059
debug_CCOPT_Flags	= -O0
Packit 857059
release_COPT_Flags	=-O2 -fno-strength-reduce
Packit 857059
debug_COPT_Flags	= -O0
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 -D_DEBUG -DDEBUG -DIB_TRACE $(CCPROJDEBUG) $(CCLOCALDEBUG) 
Packit 857059
debug_CDEBUG_Flags	=-g -DIB_DEBUG -D_DEBUG -DDEBUG -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
# TBD -fno-strict-aliasing - disables optimizations related to unions/casts
Packit 857059
# -include picks up special kernel version specific flags, this allows portable
Packit 857059
# kernel modules to be built for multiple system types from a single running
Packit 857059
# system
Packit 857059
# TBD keep -g on release builds to aid stack backtraces
Packit 857059
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 857059
# omit frame pointer for simple functions
Packit 857059
ifeq "$(BUILD_CONFIG)" "release"
Packit 857059
#CKERNELOPTS+= -Os -fomit-frame-pointer
Packit 857059
CKERNELOPTS+= -O2 -fomit-frame-pointer
Packit 857059
else
Packit 857059
CKERNELOPTS+= -O1
Packit 857059
endif
Packit 857059
CKERNEL = -x c++ -fapple-kext $(CKERNELOPTS)
Packit 857059
Packit 857059
# Include directories for kernel
Packit 857059
KERNELDIR=/System/Library/Frameworks/Kernel.framework
Packit 857059
KERNEL_INCLUDE_DIRS=$(KERNELDIR)/Headers $(KERNELDIR)/Headers/bsd $(KERNELDIR)/PrivateHeaders /usr/include/g++-3/ke /usr/include/g++-3
Packit 857059
Packit 857059
# linking
Packit 857059
# ----------------------------
Packit 857059
LDMACH		= -arch ppc
Packit 857059
LDSYS		=
Packit 857059
#MKSHLIB		= $(CCC) $(CCDEBUG) $(COPT) -shared
Packit 857059
#MKSHLIB		= $(LD) -dylib
Packit 857059
MKSHLIB		= $(CC) -dynamiclib -Wl,-prebind_allow_overlap -Wl,-single_module -compatibility_version 1 -current_version 1
Packit 857059
#MKSHLIB		= /usr/bin/libtool -dynamic -prebind -compatibility_version 1 -current_version 1
Packit 857059
#MKSHLIB		= /usr/bin/libtool -dynamic
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	= /usr/bin/g++-3.3 -arch ppc -static -nostdlib -r -lkmodc++ -lkmod -lcc_kext -o
Packit 857059
MKMODULE	= /usr/bin/g++-3.3 -o
Packit 857059
Packit 857059
KERNELOPTS	= -arch ppc -static -nostdlib -r -lkmodc++ -lkmod -lcc_kext
Packit 857059
Packit 857059
SYSLIBS		= -lpthread -lstdc++
Packit 857059
#LDLIBS		= -Xlinker --start-group $(foreach lib,$(LOCALLIBS) $(LOCALDEPLIBS) $(MODLIBS) $(MODDEPLIBS) $(PROJLIBS) $(PROJDEPLIBS),-l$(lib)) -Xlinker --end-group $(SYSLIBS)
Packit 857059
LDLIBS		= $(foreach lib,$(LOCALLIBS) $(LOCALDEPLIBS) $(MODLIBS) $(MODDEPLIBS) $(PROJLIBS) $(PROJDEPLIBS),-l$(lib)) $(SYSLIBS)
Packit 857059
# libraries for partial link of a kernel loadable module
Packit 857059
#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 857059
KERNELLIBS		= $(KERNELOPTS)
Packit 857059
Packit 857059
# KEXT creation
Packit 857059
ifeq "$(BUILD_PLATFORM_OS_VENDOR_VERSION)" "10.3"
Packit 857059
PBXCP = "/Developer/Tools/pbxcp"
Packit 857059
else
Packit 857059
PBXCP = "/System/Library/PrivateFrameworks/DevToolsCore.framework/Resources/pbxcp"
Packit 857059
endif