Skip to content

Commit

Permalink
updating Makefile/nuke for Xcode 4.3.2 directory organization.
Browse files Browse the repository at this point in the history
  • Loading branch information
timburks committed Jun 4, 2012
1 parent 1cd270e commit 8226890
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 15 deletions.
9 changes: 5 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ SYSTEM = $(shell uname)

PREFIX ?= /usr/local

DEVROOT =
TOOLCHAIN = /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain
SDKROOT = /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer

ifeq ($(shell test -e /usr/lib/libffi.dylib && echo yes), yes)
# Use the libffi that ships with OS X.
Expand All @@ -20,8 +21,8 @@ else
FFI_INCLUDE = -I./libffi/include
endif

ifeq ($(shell test -e $(DEVROOT)/SDKs/MacOSX10.7.sdk && echo yes), yes)
LION_CFLAGS = -isysroot $(DEVROOT)/SDKs/MacOSX10.7.sdk
ifeq ($(shell test -e $(SDKROOT)/SDKs/MacOSX10.7.sdk && echo yes), yes)
LION_CFLAGS = -isysroot $(SDKROOT)/SDKs/MacOSX10.7.sdk
else
LION_CFLAGS =
endif
Expand Down Expand Up @@ -50,7 +51,7 @@ ifeq ($(SYSTEM), Darwin)
# as of around 10.7.3, clang becomes part of OS X
CC = /usr/bin/clang
ifneq ($(shell test -e $(CC) && echo yes), yes)
CC = $(DEVROOT)/usr/bin/clang
CC = $(TOOLCHAIN)/usr/bin/clang
endif
CFLAGS += -DMACOSX -DDARWIN $(LION_CFLAGS)
else
Expand Down
28 changes: 17 additions & 11 deletions tools/nuke
Original file line number Diff line number Diff line change
Expand Up @@ -283,24 +283,30 @@
(unless momc (NSException raise:@"NukeError" format:@"Can't find momc (data model compiler)."))
momc)

(set SDKROOT "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer")
(set TOOLCHAIN "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain")

(function select-compiler ()
(ifDarwin
;; clang built-in to 10.7.3
(set clang "/usr/bin/clang")
(if (not (NSFileManager fileExistsNamed:clang))
;; use xcode-select to get from e.g. /Developer or Xcode.app
(set DEVROOT (NSString stringWithShellCommand:"xcode-select -print-path"))
(set clang "#{DEVROOT}/usr/bin/clang")
(if (not (NSFileManager fileExistsNamed:clang))
(set clang nil))))
;; default to gcc
(if (clang) clang (else "gcc")))
(ifDarwin
;; clang built-in to 10.7.3
(set clang "/usr/bin/clang")
(if (not (NSFileManager fileExistsNamed:clang))
;; use xcode-select to get from e.g. /Developer or Xcode.app
(set DEVROOT (NSString stringWithShellCommand:"xcode-select -print-path"))
(set clang "#{DEVROOT}/usr/bin/clang")
(if (not (NSFileManager fileExistsNamed:clang))
(set clang "#{TOOLCHAIN}/usr/bin/clang")
(if (not (NSFileManager fileExistsNamed:clang))
(set clang nil)))))
;; default to gcc
(if clang clang (else "gcc")))

;; use this to create all the compilation tasks for the files in the @c_files and @m_files collections
(macro compilation-tasks ()
`(progn
(unless @cc (set @cc (select-compiler)))
(unless @cflags (set @cflags "-g"))
(set @cflags (+ @cflags " -isysroot #{SDKROOT}/SDKs/MacOSX10.7.sdk"))
(unless @mflags (set @mflags "-fobjc-exceptions"))
(unless @includes (set @includes ""))
(ifDarwin
Expand Down

0 comments on commit 8226890

Please sign in to comment.