From f7218cfa0598f20cf71fda2db2b5554f67886bbf Mon Sep 17 00:00:00 2001 From: Charlie Fenton Date: Wed, 26 Mar 2008 14:43:00 +0000 Subject: [PATCH] Update Mac makefile and build script, create second, stand-alone Mac makefile svn path=/trunk/boinc_samples/; revision=14961 --- checkin_notes | 10 ++++ example_app/MakeMacExample.sh | 21 ++++--- example_app/Makefile_mac | 7 ++- example_app/Makefile_mac2 | 101 ++++++++++++++++++++++++++++++++++ 4 files changed, 126 insertions(+), 13 deletions(-) create mode 100644 example_app/Makefile_mac2 diff --git a/checkin_notes b/checkin_notes index 26bfa4df93..f8fde11dd6 100644 --- a/checkin_notes +++ b/checkin_notes @@ -630,3 +630,13 @@ Charlie 25 Mar 2008 example_app/ Makefile_mac (new) MakeMacExample.sh (new) + +Charlie 26 Mar 2008 + - example_app: Update Mac makefile and build script, create second + stand-alone makefile to demonstrate another way to build Mac + applications. + + example_app/ + Makefile_mac + Makefile_mac2 (new) + MakeMacExample.sh diff --git a/example_app/MakeMacExample.sh b/example_app/MakeMacExample.sh index adff111774..10fce0cb2c 100644 --- a/example_app/MakeMacExample.sh +++ b/example_app/MakeMacExample.sh @@ -22,7 +22,7 @@ # # Script to build Macintosh example_app using Makefile # -# by Charlie Fenton 3/25/08 +# by Charlie Fenton 3/26/08 # ## In Terminal, CD to the example_app/Mac directory. ## cd [path]/example_app/Mac/ @@ -54,14 +54,13 @@ echo ## PowerPC build for OS 10.3.0 must use GCC-3.3 and MacOSX10.3.9 SDK export PATH=/usr/local/bin:$PATH -export SDKROOT="/Developer/SDKs/MacOSX10.3.9.sdk" -export MACOSX_DEPLOYMENT_TARGET=10.3 +##export SDKROOT="/Developer/SDKs/MacOSX10.3.9.sdk" +##export MACOSX_DEPLOYMENT_TARGET=10.3 export CC=/usr/bin/gcc-3.3;export CXX=/usr/bin/g++-3.3 export LDFLAGS="-Wl,-syslibroot,/Developer/SDKs/MacOSX10.3.9.sdk -arch ppc" ## If your make file passes LDFLAGS directly to ld instead of to gcc, use the following instead: ## export LDFLAGS="-syslibroot /Developer/SDKs/MacOSX10.3.9.sdk -arch ppc" -export VARIANTFLAGS="-arch ppc -D_NONSTD_SOURCE -isystem /Developer/SDKs/MacOSX10.3.9.sdk" -##export VARIANTFLAGS="-arch ppc -D_NONSTD_SOURCE -isystem /Developer/SDKs/MacOSX10.3.9.sdk/usr/include/gcc/darwin/3.3" +export VARIANTFLAGS="-arch ppc -D_NONSTD_SOURCE -isystem /Developer/SDKs/MacOSX10.3.9.sd -DMACOSX_DEPLOYMENT_TARGET" make -f Makefile_mac clean make -f Makefile_mac all @@ -80,13 +79,13 @@ echo ## 32-bit Intel build for OS 10.4 must use GCC-4.0 and MacOSX10.4u SDK -export SDKROOT="/Developer/SDKs/MacOSX10.4u.sdk" -export MACOSX_DEPLOYMENT_TARGET=10.4 +##export SDKROOT="/Developer/SDKs/MacOSX10.4u.sdk" +##export MACOSX_DEPLOYMENT_TARGET=10.4 export CC=/usr/bin/gcc-4.0;export CXX=/usr/bin/g++-4.0 export LDFLAGS="-Wl,-syslibroot,/Developer/SDKs/MacOSX10.4u.sdk -arch i386" ## If your make file passes LDFLAGS directly to ld instead of to gcc, use the following instead: ## export LDFLAGS="-syslibroot /Developer/SDKs/MacOSX10.3.9.sdk -arch i386" -export VARIANTFLAGS="-isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch i386" +export VARIANTFLAGS="-isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch i386 -mmacosx-version-min=10.4" export CFLAGS="-isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch i386" make -f Makefile_mac clean @@ -109,13 +108,13 @@ if [ -d /Developer/SDKs/MacOSX10.5.sdk/ ]; then echo "***************************************************" echo - export SDKROOT="/Developer/SDKs/MacOSX10.5.sdk" - export MACOSX_DEPLOYMENT_TARGET=10.5 + ##export SDKROOT="/Developer/SDKs/MacOSX10.5.sdk" + ##export MACOSX_DEPLOYMENT_TARGET=10.5 export CC=/usr/bin/gcc-4.0;export CXX=/usr/bin/g++-4.0 export LDFLAGS="-Wl,-syslibroot,/Developer/SDKs/MacOSX10.5.sdk -arch x86_64" ## If your make file passes LDFLAGS directly to ld instead of to gcc, use the following instead: ## export LDFLAGS="-syslibroot /Developer/SDKs/MacOSX10.3.9.sdk -arch x86_64" - export VARIANTFLAGS="-isysroot /Developer/SDKs/MacOSX10.5.sdk -arch x86_64 -fvisibility=hidden -fvisibility-inlines-hidden" + export VARIANTFLAGS="-isysroot /Developer/SDKs/MacOSX10.5.sdk -arch x86_64 -mmacosx-version-min=10.5 -fvisibility=hidden -fvisibility-inlines-hidden" export CFLAGS="-isysroot /Developer/SDKs/MacOSX10.5.sdk -arch x86_64" make -f Makefile_mac clean diff --git a/example_app/Makefile_mac b/example_app/Makefile_mac index 3531d55744..f80b1ed522 100644 --- a/example_app/Makefile_mac +++ b/example_app/Makefile_mac @@ -1,4 +1,7 @@ # makefile for uc2 BOINC example application on Macintosh. +# This is invoked from MakeMacExample.sh shell script. +# It should not be used by itself without the script. +# Updated 3/26/08 BOINC_DIR = ../../boinc BOINC_API_DIR = $(BOINC_DIR)/api @@ -30,9 +33,9 @@ clean: /bin/rm -f $(PROGS) $(OBJ) uc2: uc2.o $(BOINC_LIB_LINK_DIR)/libboinc_api.a $(BOINC_LIB_LINK_DIR)/libboinc.a - $(CXX) $(VARIANTFLAGS) $(CXXFLAGS) -o uc2 uc2.o -lboinc_api -lboinc + $(CXX) $(LDFLAGS) $(CXXFLAGS) -o uc2 uc2.o -lboinc_api -lboinc uc2_graphics: uc2_graphics.o $(BOINC_LIB_LINK_DIR)/libboinc.a $(BOINC_LIB_LINK_DIR)/libboinc_graphics2.a - $(CXX) $(VARIANTFLAGS) $(CXXFLAGS) -o uc2_graphics uc2_graphics.o\ + $(CXX) $(CXXFLAGS) $(LDFLAGS) -o uc2_graphics uc2_graphics.o\ -lboinc_graphics2 -lboinc_api -lboinc \ -framework AppKit -framework GLUT -framework OpenGL $(LIBJPEG) \ No newline at end of file diff --git a/example_app/Makefile_mac2 b/example_app/Makefile_mac2 new file mode 100644 index 0000000000..69bcba8955 --- /dev/null +++ b/example_app/Makefile_mac2 @@ -0,0 +1,101 @@ +# stand-alone makefile for uc2 BOINC example application on Macintosh. +# Updated 3/26/08 +# + +BOINC_DIR = ../../boinc +BOINC_API_DIR = $(BOINC_DIR)/api +BOINC_LIB_DIR = $(BOINC_DIR)/lib +BOINC_LIB_LINK_DIR = $(BOINC_DIR)/mac_build/build/Deployment +FRAMEWORKS_DIR = /System/Library/Frameworks + +CXXFLAGS_ALL = \ + -g \ + -DAPP_GRAPHICS \ + -I$(BOINC_DIR) \ + -I$(BOINC_DIR)/clientgui/mac/ \ + -I$(BOINC_LIB_DIR) \ + -I$(BOINC_API_DIR) \ + -L$(BOINC_LIB_LINK_DIR) \ + -L. + +CC_PPC = /usr/bin/gcc-3.3 +CXX_PPC = /usr/bin/g++-3.3 +CXXFLAGS_PPC = -arch ppc -D_NONSTD_SOURCE -isystem /Developer/SDKs/MacOSX10.3.9.sdk \ + -DMAC_OS_X_VERSION_MIN_REQUIRED=1030 $(CXXFLAGS_ALL) +LDFLAGS_PPC = -Wl,-syslibroot,/Developer/SDKs/MacOSX10.3.9.sdk,-arch,ppc + +CC_i386 = /usr/bin/gcc-4.0 +CXX_i386 = /usr/bin/g++-4.0 +CXXFLAGS_i386 = -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk \ + -mmacosx-version-min=10.4 -fvisibility=hidden -fvisibility-inlines-hidden \ + $(CXXFLAGS_ALL) +LDFLAGS_i386 = -Wl,-syslibroot,/Developer/SDKs/MacOSX10.4u.sdk,-arch,i386 + +CC_x86_64 = /usr/bin/gcc-4.0 +CXX_x86_64 = /usr/bin/g++-4.0 +CXXFLAGS_x86_64 = -arch x86_64 -isysroot /Developer/SDKs/MacOSX10.5.sdk \ + -mmacosx-version-min=10.5 -fvisibility=hidden -fvisibility-inlines-hidden \ + $(CXXFLAGS_ALL) +LDFLAGS_x86_64 = -Wl,-syslibroot,/Developer/SDKs/MacOSX10.5.sdk,-arch,x86_64 + + +LIBJPEG = ../../jpeg-6b/libjpeg.a + +OBJ = \ + uc2_ppc.o \ + uc2_graphics_ppc.o \ + uc2_i386.o \ + uc2_graphics_i386.o \ + uc2_x86_64.o \ + uc2_graphics_x86_64.o \ + +PROGS = uc2_ppc uc2_graphics_ppc uc2_i386 uc2_graphics_i386 uc2_x86_64 uc2_graphics_x86_64 + +all: $(PROGS) + +clean: + /bin/rm -f $(PROGS) $(OBJ) + +uc2_ppc.o: uc2.C + $(CXX_PPC) -c $(CXXFLAGS_PPC) uc2.C -o uc2_ppc.o + +uc2_graphics_ppc.o: uc2_graphics.C + $(CXX_PPC) -c $(CXXFLAGS_PPC) uc2_graphics.C -o uc2_graphics_ppc.o + +uc2_i386.o: uc2.C + $(CXX_i386) -c $(CXXFLAGS_i386) uc2.C -o uc2_i386.o + +uc2_graphics_i386.o: uc2_graphics.C + $(CXX_i386) -c $(CXXFLAGS_i386) uc2_graphics.C -o uc2_graphics_i386.o + +uc2_x86_64.o: uc2.C + $(CXX_x86_64) -c $(CXXFLAGS_x86_64) uc2.C -o uc2_x86_64.o + +uc2_graphics_x86_64.o: uc2_graphics.C + $(CXX_x86_64) -c $(CXXFLAGS_x86_64) uc2_graphics.C -o uc2_graphics_x86_64.o + + +uc2_ppc: uc2_ppc.o $(BOINC_LIB_LINK_DIR)/libboinc_api.a $(BOINC_LIB_LINK_DIR)/libboinc.a + $(CXX_PPC) $(CXXFLAGS_PPC) $(LDFLAGS_PPC) -o uc2_ppc uc2_ppc.o -lboinc_api -lboinc + +uc2_graphics_ppc: uc2_graphics_ppc.o $(BOINC_LIB_LINK_DIR)/libboinc.a $(BOINC_LIB_LINK_DIR)/libboinc_graphics2.a + $(CXX_PPC) $(CXXFLAGS_PPC) $(LDFLAGS_PPC) -o uc2_graphics_ppc uc2_graphics_ppc.o\ + -lboinc_graphics2 -lboinc_api -lboinc \ + -framework AppKit -framework GLUT -framework OpenGL $(LIBJPEG) + +uc2_i386: uc2_i386.o $(BOINC_LIB_LINK_DIR)/libboinc_api.a $(BOINC_LIB_LINK_DIR)/libboinc.a + $(CXX_i386) $(CXXFLAGS_i386) $(LDFLAGS_i386) -o uc2_i386 uc2_i386.o -lboinc_api -lboinc + +uc2_graphics_i386: uc2_graphics_i386.o $(BOINC_LIB_LINK_DIR)/libboinc.a $(BOINC_LIB_LINK_DIR)/libboinc_graphics2.a + $(CXX_i386) $(CXXFLAGS_i386) $(LDFLAGS_i386) -o uc2_graphics_i386 uc2_graphics_i386.o\ + -lboinc_graphics2 -lboinc_api -lboinc \ + -framework AppKit -framework GLUT -framework OpenGL $(LIBJPEG) + +uc2_x86_64: uc2_x86_64.o $(BOINC_LIB_LINK_DIR)/libboinc_api.a $(BOINC_LIB_LINK_DIR)/libboinc.a + $(CXX_x86_64) $(CXXFLAGS_x86_64) $(LDFLAGS_x86_64) -o uc2_x86_64 uc2_x86_64.o -lboinc_api -lboinc + +uc2_graphics_x86_64: uc2_graphics_x86_64.o $(BOINC_LIB_LINK_DIR)/libboinc.a $(BOINC_LIB_LINK_DIR)/libboinc_graphics2.a + $(CXX_x86_64) $(CXXFLAGS_x86_64) $(LDFLAGS_x86_64) -o uc2_graphics_x86_64 uc2_graphics_x86_64.o\ + -lboinc_graphics2 -lboinc_api -lboinc \ + -framework AppKit -framework GLUT -framework OpenGL $(LIBJPEG) +