SDKROOT ?= /
HOST_SDKROOT ?= /
+HOST_SPARSE_SDKROOT ?= /
+
+# SDKROOT may be passed as a shorthand like "iphoneos.internal". We
+# must resolve these to a full path and override SDKROOT.
+
+ifeq ($(SDKROOT_RESOLVED),)
+ifeq ($(SDKROOT),/)
+export SDKROOT_RESOLVED := /
+else
+export SDKROOT_RESOLVED := $(shell xcodebuild -sdk $(SDKROOT) -version Path | head -1)
+endif
+endif
+override SDKROOT = $(SDKROOT_RESOLVED)
ifeq ($(PLATFORM),)
export PLATFORM := $(shell xcodebuild -sdk $(SDKROOT) -version PlatformPath | head -1 | sed 's,^.*/\([^/]*\)\.platform$$,\1,')
endif
endif
+ifeq ($(PLATFORM),iPhoneOS)
+ DEVELOPER_DIR ?= $(shell xcode-select -print-path)
+ export HOST_SPARSE_SDKROOT := $(DEVELOPER_DIR)/SDKs/iPhoneHostSideTools.sparse.sdk
+endif
+
# CC/CXX get defined by make(1) by default, so we can't check them
# against the empty string to see if they haven't been set
ifeq ($(origin CC),default)
ifneq ($(findstring iPhone,$(PLATFORM)),)
- export CC := $(shell $(XCRUN) -sdk $(SDKROOT) -find gcc-4.2)
+ export CC := $(shell $(XCRUN) -sdk $(SDKROOT) -find clang)
else
- export CC := $(shell $(XCRUN) -sdk $(SDKROOT) -find cc)
+ export CC := $(shell $(XCRUN) -sdk $(SDKROOT) -find clang)
endif
endif
ifeq ($(origin CXX),default)
ifneq ($(findstring iPhone,$(PLATFORM)),)
- export CXX := $(shell $(XCRUN) -sdk $(SDKROOT) -find g++-4.2)
+ export CXX := $(shell $(XCRUN) -sdk $(SDKROOT) -find clang++)
else
- export CXX := $(shell $(XCRUN) -sdk $(SDKROOT) -find c++)
+ export CXX := $(shell $(XCRUN) -sdk $(SDKROOT) -find clang++)
endif
endif
ifeq ($(MIG),)
ifeq ($(MIGCC),)
export MIGCC := $(CC)
endif
-ifeq ($(RELPATH),)
- export RELPATH := $(shell $(XCRUN) -sdk $(SDKROOT) -find relpath)
-endif
ifeq ($(STRIP),)
export STRIP := $(shell $(XCRUN) -sdk $(SDKROOT) -find strip)
endif
ifeq ($(UNIFDEF),)
export UNIFDEF := $(shell $(XCRUN) -sdk $(SDKROOT) -find unifdef)
endif
-ifeq ($(DECOMMENT),)
- export DECOMMENT := $(shell $(XCRUN) -sdk $(SDKROOT) -find decomment)
-endif
ifeq ($(DSYMUTIL),)
export DSYMUTIL := $(shell $(XCRUN) -sdk $(SDKROOT) -find dsymutil)
endif
# Platform-specific tools
ifneq ($(findstring iPhone,$(PRODUCT)),)
+ifeq ($(EMBEDDED_DEVICE_MAP),)
+ export EMBEDDED_DEVICE_MAP := $(shell $(XCRUN) -sdk $(SDKROOT) -find embedded_device_map)
+endif
ifeq ($(IPHONEOS_OPTIMIZE),)
export IPHONEOS_OPTIMIZE := $(shell $(XCRUN) -sdk $(SDKROOT) -find iphoneos-optimize)
endif
# Scripts or tools we build ourselves
SEG_HACK := $(OBJROOT)/SETUP/setsegname/setsegname
KEXT_CREATE_SYMBOL_SET := $(OBJROOT)/SETUP/kextsymboltool/kextsymboltool
+DECOMMENT := $(OBJROOT)/SETUP/decomment/decomment
NEWVERS = $(SRCROOT)/config/newvers.pl
+MD := $(OBJROOT)/SETUP/md/md
# Standard BSD tools
-MD = /usr/bin/md
RM = /bin/rm -f
CP = /bin/cp
MV = /bin/mv
CAT = /bin/cat
MKDIR = /bin/mkdir -p
FIND = /usr/bin/find
+XARGS = /usr/bin/xargs
INSTALL = /usr/bin/install
TAR = /usr/bin/gnutar
BASENAME = /usr/bin/basename
# Platform-specific tools
ifeq (iPhoneOS,$(PLATFORM))
+ifeq ($(EMBEDDED_DEVICE_MAP),)
+ export EMBEDDED_DEVICE_MAP := $(shell $(XCRUN) -sdk $(SDKROOT) -find embedded_device_map || echo /usr/bin/true)
+endif
ifeq ($(IPHONEOS_OPTIMIZE),)
export IPHONEOS_OPTIMIZE := $(shell $(XCRUN) -sdk $(SDKROOT) -find iphoneos-optimize || echo /usr/bin/true)
endif
export HOST_CODESIGN := $(shell $(XCRUN) -sdk $(HOST_SDKROOT) -find codesign)
endif
-#
-# Command to build libkmod.a/libkmodc++.a, which are
-# linked into kext binaries, and should be built as if
-# they followed system-wide policies
-#
-ifeq ($(LIBKMOD_CC),)
- export LIBKMOD_CC := $(shell $(XCRUN) -sdk $(SDKROOT) -find cc)
-endif
-
# vim: set ft=make: