1 # $Id: Makefile 3214 2005-11-17 19:43:37Z bjarni $ |
1 # $Id: Makefile 3214 2005-11-17 19:43:37Z bjarni $ |
2 # This makefile is not a standalone makefile, but is called from the general one |
2 # This makefile is not a standalone makefile, but is called from the general one |
3 # it contains targets specific to MacOS X |
3 # it contains targets specific to MacOS X |
4 |
4 |
5 ifdef UNIVERSAL_BINARY |
|
6 ifdef TRIPPLE_BINARY |
5 ifdef TRIPPLE_BINARY |
7 TRIPPLE_BINARY:=tripple_binary |
6 # this is to add G5_FLAGS to ppc970 builds only. If the ability to add flags to a single arch only shows up in the future |
8 endif |
7 # we can get rid of this. Xcode supports arch dependant flags, but we can't do it in the makefile (yet?) |
9 UNIVERSAL_BINARY:=build_universal_binary |
8 %.o: %.c $(MAKE_CONFIG) |
|
9 @echo '===> Compiling $<' |
|
10 $(Q)$(CC) $(CFLAGS) $(CDEFS) -arch ppc -c -arch i386 -o $@.uni $< |
|
11 $(Q)$(CC) $(CFLAGS) $(CDEFS) $(G5_FLAGS) -arch ppc970 -c -o $@.ppc970 $< |
|
12 $(Q)lipo -create -output $@ $@.uni $@.ppc970 |
|
13 $(Q)rm $@.uni $@.ppc970 |
|
14 |
|
15 %.o: %.cpp $(MAKE_CONFIG) |
|
16 @echo '===> Compiling $<' |
|
17 $(Q)$(CXX) $(CFLAGS) $(CDEFS) -arch ppc -arch i386 -c -o $@.uni $< |
|
18 $(Q)$(CXX) $(CFLAGS) $(CDEFS) $(G5_FLAGS) -arch ppc970 -c -o $@.ppc970 $< |
|
19 $(Q)lipo -create -output $@ $@.uni $@.ppc970 |
|
20 $(Q)rm $@.uni $@.ppc970 |
|
21 |
|
22 %.o: %.m $(MAKE_CONFIG) |
|
23 @echo '===> Compiling $<' |
|
24 $(Q)$(CC) $(CFLAGS) $(CDEFS) -arch ppc -arch i386 -c -o $@.uni $< |
|
25 $(Q)$(CC) $(CFLAGS) $(CDEFS) -arch ppc970 $(G5_FLAGS) -c -o $@.ppc970 $< |
|
26 $(Q)lipo -create -output $@ $@.uni $@.ppc970 |
|
27 $(Q)rm $@.uni $@.ppc970 |
10 endif |
28 endif |
11 |
29 |
12 ifdef UNIVERSAL_PPC_PART |
30 ifdef UNIVERSAL_PPC_PART |
13 # the bundle is build by the PPC compile when making universal binaries |
31 # the bundle is build by the PPC compile when making universal binaries |
14 BUILD_OSX_BUNDLE:= |
32 BUILD_OSX_BUNDLE:= |
15 else |
33 else |
16 BUILD_OSX_BUNDLE:=build_OSX_bundle |
34 BUILD_OSX_BUNDLE:=build_OSX_bundle |
17 endif |
35 endif |
18 |
|
19 # building an universal binary |
|
20 # since we can only compile for PPC or x86 at any one time, we compile one and then |
|
21 # we make clean and compile the other one. In the end we use lipo to join them together |
|
22 # when this is done, we can continue with the targets from the first run, which is build_OSX_bundle |
|
23 |
|
24 $(UNIVERSAL_BINARY): $(TTD) |
|
25 $(Q)mkdir -p temp_binary_dir |
|
26 $(Q)cp $(TTD) temp_binary_dir/$(TTD)_a |
|
27 $(Q)rm -rf $(TTD) $(OBJS) # delete all .o files so we can compile for a new CPU |
|
28 $(Q)make UNIVERSAL_PPC_PART:=1 |
|
29 $(Q)cp $(TTD) temp_binary_dir/$(TTD)_b |
|
30 @echo '===> Joining the PPC and x86 binaries into one universal one' |
|
31 $(Q)lipo temp_binary_dir/$(TTD)_a temp_binary_dir/$(TTD)_b -create -output $(TTD) |
|
32 $(Q)rm -rf temp_binary_dir |
|
33 |
|
34 $(TRIPPLE_BINARY): $(UNIVERSAL_BINARY) |
|
35 $(Q)mkdir -p temp_binary_dir |
|
36 $(Q)cp $(TTD) temp_binary_dir/$(TTD)_a |
|
37 $(Q)rm -rf $(TTD) $(OBJS) # delete all .o files so we can compile for a new CPU |
|
38 $(Q)make UNIVERSAL_PPC_PART:=1 IS_G5:=1 |
|
39 $(Q)cp $(TTD) temp_binary_dir/$(TTD)_b |
|
40 @echo '===> Joining the Universal and G5 binaries into a tripple binary' |
|
41 $(Q)lipo temp_binary_dir/$(TTD)_a temp_binary_dir/$(TTD)_b -create -output $(TTD) |
|
42 $(Q)rm -rf temp_binary_dir |
|
43 |
36 |
44 # build the bundle. OSX wants to keep apps in bundles, so we will give it one |
37 # build the bundle. OSX wants to keep apps in bundles, so we will give it one |
45 # the good thing about bundles is that you can keep extra files in them, so we keep lng files and a data dir in it |
38 # the good thing about bundles is that you can keep extra files in them, so we keep lng files and a data dir in it |
46 |
39 |
47 $(BUILD_OSX_BUNDLE): $(TTD) $(UNIVERSAL_BINARY) $(TRIPPLE_BINARY) |
40 $(BUILD_OSX_BUNDLE): $(TTD) $(UNIVERSAL_BINARY) $(TRIPPLE_BINARY) |