2007-01-02 19:19:48 +00:00
# Auto-generated file -- DO NOT EDIT
# Check if we want to show what we are doing
i f d e f V E R B O S E
Q =
e l s e
Q = @
e n d i f
i n c l u d e M a k e f i l e . a m
SOURCE_LIST = !!SOURCE_LIST!!
CONFIG_CACHE_SOURCE_LIST = !!CONFIG_CACHE_SOURCE_LIST!!
CONFIGURE_FILES = !!CONFIGURE_FILES!!
LIPO = !!LIPO!!
BIN_DIR = !!BIN_DIR!!
SRC_DIR = !!SRC_DIR!!
ROOT_DIR = !!ROOT_DIR!!
BUNDLE_DIR = " $( ROOT_DIR) /bundle "
BUNDLES_DIR = " $( ROOT_DIR) /bundles "
INSTALL_DIR = !!INSTALL_DIR!!
INSTALL_BINARY_DIR = " $( INSTALL_DIR) / " !!BINARY_DIR!!
INSTALL_ICON_DIR = " $( INSTALL_DIR) / " !!ICON_DIR!!
INSTALL_DATA_DIR = " $( INSTALL_DIR) / " !!DATA_DIR!!
INSTALL_PERSONAL_DIR = !!PERSONAL_DIR!!
TTD = !!TTD!!
TTDS = $( SRC_DIRS:%= %/$( TTD) )
OS = !!OS!!
OSXAPP = !!OSXAPP!!
2007-01-05 15:01:51 +00:00
REVISION = !!REVISION!!
2007-02-19 19:59:19 +00:00
AWK = !!AWK!!
2007-06-11 10:29:07 +00:00
DISTCC = !!DISTCC!!
2007-01-02 19:19:48 +00:00
RES := $( shell if ! [ -f $( CONFIG_CACHE_SOURCE_LIST) ] || [ -n " `cmp $( CONFIG_CACHE_SOURCE_LIST) $( SOURCE_LIST) ` " ] ; then cp $( SOURCE_LIST) $( CONFIG_CACHE_SOURCE_LIST) ; fi )
2007-06-27 18:53:24 +00:00
all : config .cache
i f d e f D I S T C C
@if [ -z " `echo ' $( MFLAGS) ' | grep '\-j'` " ] ; then echo; echo "WARNING: you enabled distcc support, but you don't seem to be using the -jN paramter" ; echo; fi
e n d i f
@for dir in $( DIRS) ; do \
$( MAKE) -C $$ dir all; \
done
i f d e f L I P O
# Lipo is an OSX thing. If it is defined, it means we are building for universal,
# and so we have have to combine the binaries into one big binary
# Remove the last binary made by the last compiled target
$( Q) rm -f $( BIN_DIR) /$( TTD)
# Make all the binaries into one
$( Q) $( LIPO) -create -output $( BIN_DIR) /$( TTD) $( TTDS)
e n d i f
2007-06-27 18:50:18 +00:00
help :
@echo "Available make commands:"
@echo ""
@echo "Compilation:"
@echo " all compile the executable and the lang files"
@echo " lang compile the lang files only"
@echo "Clean up:"
@echo " clean remove the files generated during compilation"
@echo " mrproper remove the files generated during configuration and compilation"
@echo "Run after compilation:"
@echo " run execute openttd after the compilation"
@echo " run-gdb execute openttd in debug mode after the compilation"
@echo " run-prof execute openttd in profiling mode after the compilation"
@echo "Installation:"
@echo " install install the compiled files and the data-files after the compilation"
@echo " bundle create the base for an installation bundle"
@echo " bundle_zip create the zip installation bundle"
@echo " bundle_gzip create the gzip installation bundle"
@echo " bundle_bzip2 create the bzip2 installation bundle"
@echo " bundle_lha create the lha installation bundle"
@echo " bundle_dmg create the dmg installation bundle"
2007-01-02 19:19:48 +00:00
config.cache : $( CONFIG_CACHE_SOURCE_LIST ) $( CONFIGURE_FILES )
i f e q ( $( shell if test -f config .cache ; then echo 1; fi ) , 1 )
@echo "----------------"
@echo "The system detected that source.list or any configure file is altered."
@echo " Going to reconfigure with last known settings..."
@echo "----------------"
# Make sure we don't lock config.cache
@$( shell cat config.cache) || exit 1
@echo "----------------"
@echo "Reconfig done. Now compiling..."
@echo "----------------"
e l s e
@echo "----------------"
@echo "Have not found a configuration, please run configure first."
@echo "----------------"
@exit 1
e n d i f
clean :
@for dir in $( DIRS) ; do \
$( MAKE) -C $$ dir clean; \
done
$( Q) rm -rf $( BUNDLE_TARGET)
lang :
@for dir in $( LANG_DIRS) ; do \
$( MAKE) -C $$ dir all; \
done
mrproper :
@for dir in $( DIRS) ; do \
$( MAKE) -C $$ dir mrproper; \
rm -f $$ dir/Makefile; \
done
$( Q) rm -rf objs
$( Q) rm -f Makefile Makefile.am
$( Q) rm -f $( CONFIG_CACHE_SOURCE_LIST) config.cache config.log
$( Q) rm -rf $( BUNDLE_DIR)
$( Q) rm -rf $( BUNDLES_DIR)
depend :
@for dir in $( SRC_DIRS) ; do \
$( MAKE) -C $$ dir depend; \
done
run : all
2007-03-08 12:40:45 +00:00
$( Q) cd !!BIN_DIR!! && ./!!TTD!! $( OPENTTD_ARGS)
2007-01-02 19:19:48 +00:00
2007-03-15 13:17:54 +00:00
run-gdb : all
$( Q) cd !!BIN_DIR!! && gdb --ex run --args ./!!TTD!! $( OPENTTD_ARGS)
2007-06-08 17:54:48 +00:00
run-prof : all
$( Q) cd !!BIN_DIR!! && ./!!TTD!! $( OPENTTD_ARGS) && gprof !!TTD!! | less
2007-01-02 19:19:48 +00:00
%.o :
@for dir in $( SRC_DIRS) ; do \
2007-01-06 22:58:01 +00:00
$( MAKE) -C $$ dir $( @:src/%= %) ; \
2007-01-02 19:19:48 +00:00
done
%.lng :
@for dir in $( LANG_DIRS) ; do \
$( MAKE) -C $$ dir $@ ; \
done
#
# Creation of bundles
#
# The revision is needed for the bundle name and creating an OSX application bundle.
i f d e f R E V I S I O N
REV := $( REVISION)
e l s e
# Are we a SVN dir?
i f e q ( $( shell if test -d $ ( SRC_DIR ) /.svn ; then echo 1; fi ) , 1 )
# Find if the local source if modified
REV_MODIFIED := $( shell svnversion $( SRC_DIR) | sed -n 's/.*\(M\).*/\1/p' )
# Find the revision like: rXXXX-branch
2007-02-19 19:59:19 +00:00
REV := $( shell LC_ALL = C svn info $( SRC_DIR) | $( AWK) '/^URL:.*branches/ { split($$2, a, "/"); BRANCH="-"a[5] } /^Last Changed Rev:/ { REV="r"$$4"$(REV_MODIFIED)" } END { print REV BRANCH }' )
2007-01-02 19:19:48 +00:00
e n d i f
e n d i f
# Make sure we have something in REV
i f e q ( $( REV ) , )
REV := norev000
e n d i f
i f n d e f B U N D L E _ N A M E
BUNDLE_NAME = OTTD-$( OS) -custom-$( REV)
e n d i f
# An OSX application bundle needs the data files, lang files and openttd executable in a different location.
i f d e f O S X A P P
2007-03-12 15:54:19 +00:00
DATA_DIR = $( BUNDLE_DIR) /$( OSXAPP) /Contents/Resources/data
LANG_DIR = $( BUNDLE_DIR) /$( OSXAPP) /Contents/Resources/lang
2007-01-02 19:19:48 +00:00
TTD_DIR = $( BUNDLE_DIR) /$( OSXAPP) /Contents/MacOS
e l s e
DATA_DIR = $( BUNDLE_DIR) /data
LANG_DIR = $( BUNDLE_DIR) /lang
TTD_DIR = $( BUNDLE_DIR)
e n d i f
bundle : all
@echo '[BUNDLE] Constructing bundle'
$( Q) rm -rf " ${ BUNDLE_DIR } "
$( Q) mkdir -p " ${ BUNDLE_DIR } "
$( Q) mkdir -p " $( BUNDLE_DIR) /docs "
$( Q) mkdir -p " $( BUNDLE_DIR) /scenario "
$( Q) mkdir -p " $( BUNDLE_DIR) /scenario/heightmap "
$( Q) mkdir -p " $( BUNDLE_DIR) /media "
$( Q) mkdir -p " $( TTD_DIR) "
$( Q) mkdir -p " $( DATA_DIR) "
$( Q) mkdir -p " $( LANG_DIR) "
i f d e f O S X A P P
$( Q) mkdir -p " $( BUNDLE_DIR) / $( OSXAPP) /Contents/Resources "
$( Q) echo "APPL????" > " $( BUNDLE_DIR) / $( OSXAPP) /Contents/PkgInfo "
$( Q) cp " $( ROOT_DIR) /os/macosx/openttd.icns " " $( BUNDLE_DIR) / $( OSXAPP) /Contents/Resources/openttd.icns "
$( Q) $( ROOT_DIR) /os/macosx/plistgen.sh " ${ BUNDLE_DIR } / $( OSXAPP) " " $( REV) "
$( Q) cp " $( ROOT_DIR) /docs/OSX_install_instructions.txt " " $( BUNDLE_DIR) /docs/ "
$( Q) cp " $( ROOT_DIR) /os/macosx/splash.png " " $( DATA_DIR) "
e n d i f
$( Q) cp " $( BIN_DIR) / $( TTD) " " $( TTD_DIR) / "
$( Q) cp " $( BIN_DIR) /data/ " *.grf " $( DATA_DIR) / "
$( Q) cp " $( BIN_DIR) /data/opntitle.dat " " $( DATA_DIR) / "
$( Q) cp " $( BIN_DIR) /lang/ " *.lng " $( LANG_DIR) / "
$( Q) cp " $( ROOT_DIR) /readme.txt " " $( BUNDLE_DIR) / "
$( Q) cp " $( ROOT_DIR) /COPYING " " $( BUNDLE_DIR) / "
$( Q) cp " $( ROOT_DIR) /known-bugs.txt " " $( BUNDLE_DIR) /docs/ "
$( Q) cp " $( ROOT_DIR) /docs/multiplayer.txt " " $( BUNDLE_DIR) /docs/ "
2007-06-18 19:42:48 +00:00
$( Q) cp " $( ROOT_DIR) /docs/32bpp.txt " " $( BUNDLE_DIR) /docs/ "
2007-01-02 19:19:48 +00:00
$( Q) cp " $( ROOT_DIR) /changelog.txt " " $( BUNDLE_DIR) /docs/ "
$( Q) cp " $( ROOT_DIR) /media/openttd.64.png " " $( BUNDLE_DIR) /media/ "
$( Q) cp " $( ROOT_DIR) /media/openttd.32.xpm " " $( BUNDLE_DIR) /media/ "
$( Q) cp " $( ROOT_DIR) /media/openttd.32.bmp " " $( BUNDLE_DIR) /media/ "
2007-01-03 00:02:18 +00:00
i f e q ( $( shell if test -n "`ls -l \"$ ( BIN_DIR ) /scenario /\"*.scn 2> /dev /null `"; then echo 1; fi ) , 1 )
2007-01-02 19:19:48 +00:00
$( Q) cp " $( BIN_DIR) /scenario/ " *.scn " $( BUNDLE_DIR) /scenario/ "
e n d i f
2007-01-03 00:02:18 +00:00
i f e q ( $( shell if test -n "`ls -l \"$ ( BIN_DIR ) /scenario /heightmaps /\"* 2>/dev /null `"; then echo 1; fi ) , 1 )
2007-01-02 19:19:48 +00:00
$( Q) cp " $( BIN_DIR) /scenario/heightmaps/ " * " $( BUNDLE_DIR) /scenario/heightmap/ "
e n d i f
2007-10-06 22:08:04 +00:00
i f e q ( $( TTD ) , o p e n t t d . e x e )
2007-10-06 13:18:43 +00:00
$( Q) unix2dos " $( BUNDLE_DIR) /docs/ " * " $( BUNDLE_DIR) /readme.txt " " $( BUNDLE_DIR) /COPYING "
e n d i f
2007-01-02 19:19:48 +00:00
### Packing the current bundle into several compressed file formats ###
#
# Zips & dmgs do not contain a root folder, i.e. they have files in the root of the zip/dmg.
# gzip, bzip2 and lha archives have a root folder, with the same name as the bundle.
#
# One can supply a custom name by adding BUNDLE_NAME:=<name> to the make command.
#
bundle_zip : bundle
@echo '[BUNDLE] Creating $(BUNDLE_NAME).zip'
$( Q) mkdir -p " $( BUNDLES_DIR) "
$( Q) cd " $( BUNDLE_DIR) " && zip -r $( shell if test -z " $( VERBOSE) " ; then echo '-q' ; fi ) " $( BUNDLES_DIR) / $( BUNDLE_NAME) .zip " .
bundle_gzip : bundle
@echo '[BUNDLE] Creating $(BUNDLE_NAME).tar.gz'
$( Q) mkdir -p " $( BUNDLES_DIR) /.gzip/ $( BUNDLE_NAME) "
$( Q) cp -R " $( BUNDLE_DIR) / " * " $( BUNDLES_DIR) /.gzip/ $( BUNDLE_NAME) / "
$( Q) cd " $( BUNDLES_DIR) /.gzip " && tar -zc$( shell if test -n " $( VERBOSE) " ; then echo 'v' ; fi ) f " $( BUNDLES_DIR) / $( BUNDLE_NAME) .tar.gz " " $( BUNDLE_NAME) "
$( Q) rm -rf " $( BUNDLES_DIR) /.gzip "
bundle_bzip2 : bundle
@echo '[BUNDLE] Creating $(BUNDLE_NAME).tar.bz2'
$( Q) mkdir -p " $( BUNDLES_DIR) /.bzip2/ $( BUNDLE_NAME) "
$( Q) cp -R " $( BUNDLE_DIR) / " * " $( BUNDLES_DIR) /.bzip2/ $( BUNDLE_NAME) / "
$( Q) cd " $( BUNDLES_DIR) /.bzip2 " && tar -jc$( shell if test -n " $( VERBOSE) " ; then echo 'v' ; fi ) f " $( BUNDLES_DIR) / $( BUNDLE_NAME) .tar.bz2 " " $( BUNDLE_NAME) "
$( Q) rm -rf " $( BUNDLES_DIR) /.bzip2 "
bundle_lha : bundle
@echo '[BUNDLE] Creating $(BUNDLE_NAME).lha'
$( Q) mkdir -p " $( BUNDLES_DIR) /.lha/ $( BUNDLE_NAME) "
$( Q) cp -R " $( BUNDLE_DIR) / " * " $( BUNDLES_DIR) /.lha/ $( BUNDLE_NAME) / "
$( Q) cd " $( BUNDLES_DIR) /.lha " && lha ao6 " $( BUNDLES_DIR) / $( BUNDLE_NAME) .lha " " $( BUNDLE_NAME) "
$( Q) rm -rf " $( BUNDLES_DIR) /.lha "
bundle_dmg : bundle
@echo '[BUNDLE] Creating $(BUNDLE_NAME).dmg'
$( Q) mkdir -p " $( BUNDLES_DIR) "
$( Q) hdiutil create -ov -format UDZO -srcfolder " $( BUNDLE_DIR) " " $( BUNDLES_DIR) / $( BUNDLE_NAME) .dmg "
i f d e f O S X A P P
install :
@echo '[INSTALL] Cannot install the OSX Application Bundle'
e l s e
install : bundle
@echo '[INSTALL] Installing OpenTTD'
$( Q) install -d " $( INSTALL_BINARY_DIR) "
$( Q) install -d " $( INSTALL_ICON_DIR) "
$( Q) install -d " $( INSTALL_DATA_DIR) /gm "
$( Q) install -d " $( INSTALL_DATA_DIR) /data "
$( Q) install -d " $( INSTALL_DATA_DIR) /lang "
$( Q) install -d " $( INSTALL_DATA_DIR) /docs "
$( Q) install -m 755 " $( BUNDLE_DIR) / $( TTD) " " $( INSTALL_BINARY_DIR) "
$( Q) install -m 644 " $( BUNDLE_DIR) /lang/ " * " $( INSTALL_DATA_DIR) /lang "
$( Q) install -m 644 " $( BUNDLE_DIR) /data/ " * " $( INSTALL_DATA_DIR) /data "
$( Q) install -m 644 " $( BUNDLE_DIR) /docs/ " * " $( INSTALL_DATA_DIR) /docs "
$( Q) install -m 644 " $( BUNDLE_DIR) /media/ " * " $( INSTALL_ICON_DIR) "
i f d e f I N S T A L L _ P E R S O N A L _ D I R
$( Q) mkdir -p ~/" $( INSTALL_PERSONAL_DIR) "
$( Q) cp -R " $( BUNDLE_DIR) /scenario " ~/" $( INSTALL_PERSONAL_DIR) "
e l s e
$( Q) cp -R " $( BUNDLE_DIR) /scenario " " $( INSTALL_DATA_DIR) "
e n d i f # INSTALL_PERSONAL_DIR
e n d i f # OSXAPP