mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-03-09 23:50:25 +00:00
Instead of compiling a binary for each arch and then join them in the end, each .o file is now compiled as a fat file This means that the makefile will not call itself to make a binary for each target and we don't have to make clean between each build it also means that if one file changed, we don't have to recompile all files Another benefit is since it's handled at .o level and though LDFLAGS, no special code is needed if we decide to compile more binaries (like a lot of stuff used to happen at post linking) We also needs much less flags to set up, so it should be even easier to get to work out of the box now The tradeoff in doing so is that now the binary needs at least OSX 10.3.9 to execute To deal with this issue, the JAGUAR flag can be used to compile for older OSes. We will release a binary for old OSes at next release to see if anybody even downloads it (not that many people use OSX 10.2 anymore) GPMI will not work on 10.2 anyway so we will cut support for it some day anyway
77 lines
3.3 KiB
Makefile
77 lines
3.3 KiB
Makefile
# $Id: Makefile 3214 2005-11-17 19:43:37Z bjarni $
|
|
# This makefile is not a standalone makefile, but is called from the general one
|
|
# it contains targets specific to MacOS X
|
|
|
|
ifdef TRIPPLE_BINARY
|
|
# 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
|
|
# we can get rid of this. Xcode supports arch dependant flags, but we can't do it in the makefile (yet?)
|
|
%.o: %.c $(MAKE_CONFIG)
|
|
@echo '===> Compiling $<'
|
|
$(Q)$(CC) $(CFLAGS) $(CDEFS) -arch ppc -c -arch i386 -o $@.uni $<
|
|
$(Q)$(CC) $(CFLAGS) $(CDEFS) $(G5_FLAGS) -arch ppc970 -c -o $@.ppc970 $<
|
|
$(Q)lipo -create -output $@ $@.uni $@.ppc970
|
|
$(Q)rm $@.uni $@.ppc970
|
|
|
|
%.o: %.cpp $(MAKE_CONFIG)
|
|
@echo '===> Compiling $<'
|
|
$(Q)$(CXX) $(CFLAGS) $(CDEFS) -arch ppc -arch i386 -c -o $@.uni $<
|
|
$(Q)$(CXX) $(CFLAGS) $(CDEFS) $(G5_FLAGS) -arch ppc970 -c -o $@.ppc970 $<
|
|
$(Q)lipo -create -output $@ $@.uni $@.ppc970
|
|
$(Q)rm $@.uni $@.ppc970
|
|
|
|
%.o: %.m $(MAKE_CONFIG)
|
|
@echo '===> Compiling $<'
|
|
$(Q)$(CC) $(CFLAGS) $(CDEFS) -arch ppc -arch i386 -c -o $@.uni $<
|
|
$(Q)$(CC) $(CFLAGS) $(CDEFS) -arch ppc970 $(G5_FLAGS) -c -o $@.ppc970 $<
|
|
$(Q)lipo -create -output $@ $@.uni $@.ppc970
|
|
$(Q)rm $@.uni $@.ppc970
|
|
endif
|
|
|
|
ifdef UNIVERSAL_PPC_PART
|
|
# the bundle is build by the PPC compile when making universal binaries
|
|
BUILD_OSX_BUNDLE:=
|
|
else
|
|
BUILD_OSX_BUNDLE:=build_OSX_bundle
|
|
endif
|
|
|
|
# build the bundle. OSX wants to keep apps in bundles, so we will give it one
|
|
# 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
|
|
|
|
$(BUILD_OSX_BUNDLE): $(TTD) $(UNIVERSAL_BINARY) $(TRIPPLE_BINARY)
|
|
@echo '===> Building application bundle'
|
|
$(Q)rm -fr "$(OSXAPP)"
|
|
$(Q)mkdir -p "$(OSXAPP)"/Contents/MacOS
|
|
$(Q)mkdir -p "$(OSXAPP)"/Contents/Resources
|
|
$(Q)mkdir -p "$(OSXAPP)"/Contents/Data
|
|
$(Q)mkdir -p "$(OSXAPP)"/Contents/Lang
|
|
$(Q)echo "APPL????" > "$(OSXAPP)"/Contents/PkgInfo
|
|
$(Q)cp os/macosx/openttd.icns "$(OSXAPP)"/Contents/Resources/openttd.icns
|
|
$(Q)os/macosx/plistgen.sh "$(OSXAPP)" "$(REV)"
|
|
$(Q)cp data/* "$(OSXAPP)"/Contents/Data/
|
|
$(Q)cp os/macosx/splash.png "$(OSXAPP)"/Contents/Data/
|
|
$(Q)cp lang/*.lng "$(OSXAPP)"/Contents/Lang/
|
|
$(Q)cp $(TTD) "$(OSXAPP)"/Contents/MacOS/$(TTD)
|
|
|
|
# make the release disk image. Should only be used with releases and is a good and fast way to make sure to remember all the needed files
|
|
release: all
|
|
$(Q)mkdir -p "OpenTTD $(RELEASE)"
|
|
$(Q)mkdir -p "OpenTTD $(RELEASE)"/docs
|
|
$(Q)mkdir -p "OpenTTD $(RELEASE)"/scenario
|
|
$(Q)cp -R $(OSXAPP) "OpenTTD $(RELEASE)"/
|
|
$(Q)cp docs/OSX_install_instructions.txt "OpenTTD $(RELEASE)"/How\ to\ install\ (please\ read).txt
|
|
$(Q)cp readme.txt "OpenTTD $(RELEASE)"/docs/
|
|
$(Q)cp docs/README_if_game_crashed_on_OSX.txt "OpenTTD $(RELEASE)"/docs/readme\ if\ crashed\ on\ OSX.txt
|
|
$(Q)cp docs/console.txt "OpenTTD $(RELEASE)"/docs/
|
|
$(Q)cp COPYING "OpenTTD $(RELEASE)"/docs/
|
|
$(Q)cp changelog.txt "OpenTTD $(RELEASE)"/docs/
|
|
$(Q)cp docs/README_if_game_crashed_on_OSX.txt "OpenTTD $(RELEASE)"/docs/
|
|
$(Q)cp os/macosx/*.webloc "OpenTTD $(RELEASE)"
|
|
$(Q)cp known-bugs.txt "OpenTTD $(RELEASE)"/known-bugs.txt
|
|
$(Q)cp scenario/* "OpenTTD $(RELEASE)"/scenario/
|
|
$(Q)/usr/bin/hdiutil create -ov -format UDZO -srcfolder "OpenTTD $(RELEASE)" openttd-"$(RELEASE)"-osx.dmg
|
|
$(Q)rm -fr "OpenTTD $(RELEASE)"
|
|
|
|
$(OSX): $(TTD) $(BUILD_OSX_BUNDLE)
|
|
|
|
.PHONY: release $(BUILD_OSX_BUNDLE) $(UNIVERSAL_BINARY)
|