Rev 2296 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed
## unix-style build of universal R.app## it relies on Xcode to create the bundle and compiles the binary itself# using Apple's and FSF gcc. it works only on Intel Macs and only if you# have FSF gcc installed in /usr/local/gcc4.0# this is a temporary hack until the compiler situation is sorted out.## additional variables that influence the build:# STYLE - defined the Xcode configuration to use when building R.app# it has no effect on the binary itself - use xxFLAGS as usual# for that# ARCH - defines the architecture to build for, but doesn't automatically# add the -arch parameter aas it's not always supported# default is the native architecture# OBJCC/OBJCFLAGS - special compiler/flags for Obj-C files (default is to# use OBJCC=$CC and OBJCFLAGS='')## targets:# R.$(ARCH) - binary for $(ARCH)# R - universal binary for R (calls make for i386 and ppc)# R.app - universal R.app bundle (uses Xcode and R target)# clean - as usual## get the native architecture (override on the command line)ifeq ($(ARCH),)ARCH:=$(shell arch)endif# sourcesSRC_H = $(wildcard *.h AMPrefs/*.h PrefPanes/*.h Quartz/*.h REngine/*.h Tools/*.h)SRC_M = $(wildcard *.m AMPrefs/*.m PrefPanes/*.m Quartz/*.m REngine/*.m Tools/*.m)SRC_C = $(wildcard Quartz/*.c REngine/*.c) Tools/Authorization.cSRC = $(SRC_M) $(SRC_C) $(SRC_H)OBJ_M = $(SRC_M:%.m=%.$(ARCH).o)OBJ_C = $(SRC_C:%.c=%.$(ARCH).o)OBJ = $(OBJ_M) $(OBJ_C)# cc->gcc and add corresponding flags when on ix86ifeq ($(CC),cc)CC=gccendififeq ($(OBJCC),)OBJCC=$(CC)endif# add tuning flags if we're on i386 - this is crucial, because the# stack pointer bug in gcc is still there if not tunedifeq ($(ARCH),i386)CFLAGS+=-msse3 -march=pentium-m -mtune=prescott -O3endifCPPFLAGS+=-I. -I/Library/Frameworks/R.framework/Headers -I/Library/Frameworks/R.framework/PrivateHeadersCFLAGS+=-gOBJCFLAGS+=-fobjc-exceptionsLIBS+=-framework R -framework Cocoa -framework Security -framework ExceptionHandling -framework WebKit -framework AppKitifeq ($(STYLE),)STYLE:=Deploymentendifall: R.appR.app: R sush build/$(STYLE)/R.apprm -rf R.appcp -r build/$(STYLE)/R.app .cp R R.app/Contents/MacOS/Rcp sush R.app/Contents/Resources/sushbuild/$(STYLE)/R.app: .svn/entriesrm -rf build/$(STYLE)mkdir -p build/$(STYLE)xcodebuild -configuration $(STYLE) BUILD_DIR=`pwd`/buildtouch build/$(STYLE)/R.appR.$(ARCH): $(OBJ)$(CC) -o $@ $^ $(LDFLAGS) $(LIBS)R: $(SRC)$(MAKE) CC=/usr/bin/gcc ARCH=ppc 'CFLAGS=-arch ppc -g -O2' 'LDFLAGS=-arch ppc' R.ppc$(MAKE) CC=/usr/local/gcc4.0/bin/gcc ARCH=i386 R.i386lipo -create R.ppc R.i386 -o Rsush.$(ARCH): Tools/sush.c$(CC) -o $@ $^ $(CFLAGS)sush: Tools/sush.c$(MAKE) CC=/usr/bin/gcc ARCH=ppc 'CFLAGS=-arch ppc -g -O2' 'LDFLAGS=-arch ppc' sush.ppc$(MAKE) CC=/usr/local/gcc4.0/bin/gcc ARCH=i386 sush.i386lipo -create sush.ppc sush.i386 -o sush%.$(ARCH).o: %.c$(CC) -c $(CFLAGS) $(CPPFLAGS) -o $@ $^%.$(ARCH).o: %.m$(OBJCC) -c $(CFLAGS) $(CPPFLAGS) $(OBJCFLAGS) -o $@ $^clean-obj:rm -f $(OBJ)clean: clean-obj$(MAKE) ARCH=ppc clean-obj$(MAKE) ARCH=i386 clean-objrm -rf R R.fat R.i386 R.ppc build R.app.PHONY: clean clean-obj all