diff options
author | Stefan Gartner <stefang@aon.at> | 2010-01-03 23:35:13 +0300 |
---|---|---|
committer | Stefan Gartner <stefang@aon.at> | 2010-01-03 23:35:13 +0300 |
commit | 1f33d574c2d18f0037f5e168dbd1a54d23dad6d7 (patch) | |
tree | f1e74363273795545fc9a07992838da273068b53 /source/nan_compile.mk | |
parent | c6e40798fbbd6996310630198261fec194a2109e (diff) |
OS X Makefiles:
* added some new variables (mostly the same as with scons):
- USE_COCOA: use Cocoa for ghost (defaults to true)
- MACOSX_ARCHITECTURE: can be ppc, ppc64, i386, x86_64. By default this is the host architecture
(ppc for PowerPC Macs, i386 for Intel Macs). In theory this allows to cross compile blender for
a different architecture, though cross compilation only works on Intel Macs, because makesdna
and makesrna are built for the target architecture.
For a 64 bit build, set MACOSX_ARCHITECTURE to x86_64 (Intel) or ppc64 (PowerPC).
- MACOSX_MIN_VERS: minimum OS X version to run blender on (10.4 for 32 bit builds, 10.5 for 64 bit builds)
- MACOSX_DEPLOYMENT_TARGET: needed by the linker to create an Application targeted for a specific
OS version (defaults to 10.4 for 32 bit builds, 10.5 for 64 bit builds)
- MACOSX_SDK: path to a specific SDK. currently not used
- USE_QTKIT: use QTKit instead of QuickTime (defaults to true for 64 bit builds, as using QTKit
is mandatory in that case))
* use the same compiler flags as scons
* default compiler now is gcc-4.0 when building for 10.4 and gcc-4.2 when building for 10.5
* extract $(LCGDIR)/release/python_$(MACOSX_ARCHITECTURE).zip to Application bundle. This might
break building on 10.4, to fix that, rename $(LCGDIR)/release/python.zip
When compiling blender, only MACOSX_ARCHITECTURE might be of interest, as it allows doing 64 bit
builds (or 32 bit PowerPC builds on Intel). All other variables are then set to reasonable defaults.
For current users of the Makefile system, this commit shouldn't change much.
Diffstat (limited to 'source/nan_compile.mk')
-rw-r--r-- | source/nan_compile.mk | 68 |
1 files changed, 56 insertions, 12 deletions
diff --git a/source/nan_compile.mk b/source/nan_compile.mk index 03f5a0d1cd6..3255f102ab7 100644 --- a/source/nan_compile.mk +++ b/source/nan_compile.mk @@ -24,7 +24,7 @@ # # The Original Code is: all of this file. # -# Contributor(s): GSR +# Contributor(s): GSR, Stefan Gartner # # ***** END GPL LICENSE BLOCK ***** # @@ -70,21 +70,48 @@ DBG_CCFLAGS += -g # OS dependent parts --------------------------------------------------- ifeq ($(OS),darwin) - CC ?= gcc + CC ?= gcc CCC ?= g++ - ifeq ($(CPU),powerpc) - CFLAGS += -pipe -fPIC -ffast-math -mcpu=7450 -mtune=G5 -funsigned-char -fno-strict-aliasing -Wno-long-double - CCFLAGS += -pipe -fPIC -funsigned-char -fno-strict-aliasing -Wno-long-double + ifeq ($(MACOSX_DEPLOYMENT_TARGET), 10.4) + CC = gcc-4.0 + CCC = g++-4.0 else - CFLAGS += -pipe -fPIC -ffast-math -march=pentium-m -funsigned-char -fno-strict-aliasing + ifeq ($(MACOSX_DEPLOYMENT_TARGET), 10.5) + CC = gcc-4.2 + CCC = g++-4.2 + endif + endif + ifeq ($(CPU),powerpc) + CFLAGS += -pipe -fPIC -ffast-math -mcpu=7450 -mtune=G5 -funsigned-char -fno-strict-aliasing CCFLAGS += -pipe -fPIC -funsigned-char -fno-strict-aliasing + else + CFLAGS += -pipe -fPIC -ffast-math -funsigned-char + CCFLAGS += -pipe -fPIC -funsigned-char endif -# REL_CFLAGS += -O -# REL_CCFLAGS += -O2 - CPPFLAGS += -D_THREAD_SAFE + + + CFLAGS += -arch $(MACOSX_ARCHITECTURE) #-isysroot $(MACOSX_SDK) -mmacosx-version-min=$(MACOSX_MIN_VERS) + CCFLAGS += -arch $(MACOSX_ARCHITECTURE) #-isysroot $(MACOSX_SDK) -mmacosx-version-min=$(MACOSX_MIN_VERS) + + ifeq ($(MACOSX_ARCHITECTURE), $(findstring $(MACOSX_ARCHITECTURE), "i386 x86_64")) + REL_CFLAGS += -O2 -ftree-vectorize -msse -msse2 -msse3 + REL_CCFLAGS += -O2 -ftree-vectorize -msse -msse2 -msse3 + endif + + ifeq ($(MACOSX_ARCHITECTURE), x86_64) + REL_CFLAGS += -mssse3 + REL_CCFLAGS += -mssse3 + endif + + CPPFLAGS += -D_THREAD_SAFE -fpascal-strings + ifeq ($(WITH_COCOA), true) CPPFLAGS += -DGHOST_COCOA endif + ifeq ($(USE_QTKIT), true) + CPPFLAGS += -DUSE_QTKIT + endif + NAN_DEPEND = true OPENGL_HEADERS = /System/Library/Frameworks/OpenGL.framework AR = ar @@ -324,6 +351,21 @@ $(DIR)/$(DEBUG_DIR)%.o: %.mm $(CC) -c $(CFLAGS) $(CPPFLAGS) $< -o $@ endif +$(DIR)/$(DEBUG_DIR)%.o: %.m + ifdef NAN_DEPEND + @set -e; $(CC) -M $(CPPFLAGS) $< 2>/dev/null \ + | sed 's@\($*\)\.o[ :]*@$(DIR)/$(DEBUG_DIR)\1.o : @g' \ + > $(DIR)/$(DEBUG_DIR)$*.d; \ + [ -s $(DIR)/$(DEBUG_DIR)$*.d ] || $(RM) $(DIR)/$(DEBUG_DIR)$*.d + endif + ifdef NAN_QUIET + @echo " -- $< -- " + @$(CC) -c $(CFLAGS) $(CPPFLAGS) $< -o $@ + else + $(CC) -c $(CFLAGS) $(CPPFLAGS) $< -o $@ + endif + + $(DIR)/$(DEBUG_DIR)%.res: %.rc ifeq ($(FREE_WINDOWS),true) windres $< -O coff -o $@ @@ -349,18 +391,20 @@ CCSRCS ?= $(wildcard *.cpp) JSRCS ?= $(wildcard *.java) ifdef NAN_DEPEND --include $(CSRCS:%.c=$(DIR)/$(DEBUG_DIR)%.d) $(CCSRCS:%.cpp=$(DIR)/$(DEBUG_DIR)%.d) $(OCSRCS:$.mm=$(DIR)/$(DEBUG_DIR)%.d) +-include $(CSRCS:%.c=$(DIR)/$(DEBUG_DIR)%.d) $(CCSRCS:%.cpp=$(DIR)/$(DEBUG_DIR)%.d) $(OCCSRCS:$.mm=$(DIR)/$(DEBUG_DIR)%.d) $(OCSRCS:$.m=$(DIR)/$(DEBUG_DIR)%.d) endif OBJS_AR := $(OBJS) OBJS_AR += $(CSRCS:%.c=%.o) OBJS_AR += $(CCSRCS:%.cpp=%.o) -OBJS_AR += $(OCSRCS:%.mm=%.o) +OBJS_AR += $(OCCSRCS:%.mm=%.o) +OBJS_AR += $(OCSRCS:%.m=%.o) OBJS_AR += $(WINRC:%.rc=%.res) OBJS += $(CSRCS:%.c=$(DIR)/$(DEBUG_DIR)%.o) OBJS += $(CCSRCS:%.cpp=$(DIR)/$(DEBUG_DIR)%.o) -OBJS += $(OCSRCS:%.mm=$(DIR)/$(DEBUG_DIR)%.o) +OBJS += $(OCCSRCS:%.mm=$(DIR)/$(DEBUG_DIR)%.o) +OBJS += $(OCSRCS:%.m=$(DIR)/$(DEBUG_DIR)%.o) OBJS += $(WINRC:%.rc=$(DIR)/$(DEBUG_DIR)%.res) JCLASS += $(JSRCS:%.java=$(DIR)/$(DEBUG_DIR)%.class) |