tron@2185: # $Id$ tron@2185: truelight@0: # This Makefile is partially based on "a completely generic Makefile", truelight@0: # originally created by Justin Husted truelight@0: # truelight@0: # Rewrite and sane dependencies support by Petr Baudis truelight@0: # Cygwin support and configuration by Jaen Saul truelight@0: # A lot of modifications by Bjarni Corfitzen truelight@0: # truelight@0: # Last modified by: $Author: strigeus $ truelight@0: # On: $Date: 2004/03/11 19:15:06 $ truelight@0: truelight@0: truelight@0: ############################################################################## truelight@0: # truelight@0: # Usage truelight@0: # truelight@0: truelight@0: # Synopsis: truelight@0: # truelight@0: # make WITH_ZLIB=1 UNIX=1 MANUAL_CONFIG=1 truelight@0: # truelight@0: # (See below for the list of possible options.) truelight@0: # truelight@0: # Alternately, you can run make without the MANUAL_CONFIG part. It then truelight@0: # generates Makefile.config, where you can customize all the options. truelight@0: # However beware that for all subsequent calls the option values from truelight@0: # Makefile.config take precedence to the commandline options. truelight@0: # truelight@0: # (That means that you probably want to either specify the options on command truelight@0: # line together with MANUAL_CONFIG=1 or you want to specify no commandline truelight@0: # options at all.) truelight@0: truelight@0: # Targets: truelight@0: # truelight@0: # Defaults to building binary truelight@0: # clean: remove intermediate build files truelight@0: # mrproper: remove intermediate files and makefile configuration truelight@0: # upgradeconf: add new options to old Makefile.config truelight@0: # osx: OS X application bjarni@563: # release: used by OSX to make a dmg file ready to release truelight@0: truelight@0: # Options: truelight@0: # truelight@0: # Summary of OS choice defines truelight@0: # WIN32: building on Windows truelight@0: # UNIX: building on *nix derivate (Linux, FreeBSD) truelight@0: # OSX: building on Mac OS X truelight@0: # MORPHOS: building on MorphOS tron@421: # BEOS: building on BeOS tron@446: # SUNOS: building on SunOS (Solaris) truelight@0: # truelight@0: # Summary of library choice defines truelight@0: # WITH_ZLIB: savegames using zlib truelight@0: # WITH_PNG: screenshots using PNG truelight@0: # WITH_SDL: SDL video driver support truelight@0: # truelight@0: # Summary of other defines: truelight@0: # MANUAL_CONFIG: do not use Makefile.config, config options set manually truelight@0: # DEBUG: build in debug mode truelight@0: # PROFILE: build in profile mode, disables -s and -fomit-frame-pointer truelight@0: # TRANSLATOR: build in translator mode (untranslated strings are prepended by truelight@0: # a mark) truelight@0: # RELEASE: this will be the released version number. It replaces all places truelight@0: # where it normally would print the revision number darkvater@222: # MIDI: if set, it will use it as custom path to midi player. pasky@1584: # If unset, it will use the hardcoded path in the c code pasky@1584: # This can still be overriden by the music.extmidi openttd.cfg option. bjarni@804: # WITH_NETWORK: enable networking bjarni@804: # DEDICATED: allows compilation on UNIX without SDL. Useful for dedicated servers truelight@0: # bjarni@285: # Paths: bjarni@285: # INSTALL: If not set, the game uses the directory of the binary to truelight@543: # store everything (lang, data, gm, save and openttd.cfg), this is the `old' behaviour. bjarni@285: # In this case, none of the following paths are used, you also should _not_ bjarni@285: # use `make install', but copy the required stuff yourself (or just play out bjarni@285: # of you source directory, which should work fine). bjarni@285: # If you want to use `make install' to install the game globally, you should bjarni@285: # define it _before_ you build the game. If you only define INSTALL when you bjarni@285: # do `make install', the game won't be able to find it's files (so you should bjarni@285: # also define all the following paths before building). bjarni@285: # bjarni@285: # So, the following paths should be defined if INSTALL is defined. bjarni@285: # None of these paths have to end with / bjarni@285: # PREFIX: Normally /usr/local bjarni@285: # BINARY_DIR: The location of the binary, normally games. (Will be prefixed bjarni@285: # with $PREFIX) matthijs@1865: # DATA_DIR: The location of the data (lang, data, gm and scenario), normally matthijs@1865: # share/games/openttd. (Will be prefixed with $PREFIX) Note that scenarios matthijs@1865: # are only put here if USE_HOMEDIR is true, otherwise they are placed in matthijs@1865: # PERSONAL_DIR/scenario bjarni@285: # PERSONAL_DIR: The directory where openttd.cfg and the save folder will be bjarni@285: # stored. You cannot use ~ here, define USE_HOMEDIR for that. bjarni@285: # USE_HOMEDIR: If this variable is set, PERSONAL_DIR will be prefixed with bjarni@285: # ~/ at runtime (the user's homedir) bjarni@561: # SECOND_DATA_PATH Use this data dir if a file is not found in the data dir in the data path tron@1251: # CUSTOM_LANG_PATH If this is set, it will use the path given to search for lng files bjarni@561: # instead of the lang dir in the data path bjarni@561: # NOTE: both SECOND_DATA_PATH and CUSTOM_LANG_PATH uses paths relative to where OTTD is opened bjarni@285: # bjarni@285: # DEST_DIR: make install will use this directory instead of the filesystem bjarni@285: # root to install its files. This should normally not be used by bjarni@285: # ordinary users, currently it is only used for the debian bjarni@285: # packaging. This value should only be set when calling `make bjarni@285: # install' and is not saved in Makefile.config pasky@1476: # (Note that DESTDIR is checked if DEST_DIR is not set.) truelight@0: # truelight@0: # STATIC: link statically truelight@0: # CYGWIN: build in Cygwin environment truelight@0: # MINGW: build with MingW compiler, link with MingW libraries truelight@0: # pasky@1411: # VERBOSE: show full compiler invocations instead of brief progress messages pasky@1411: # TrueLight@1692: # Special for crosscompiling there are some commands available: TrueLight@1692: # TrueLight@1692: # ENDIAN_FORCE: forces the endian-check to give a certain result. Can be either BE or LE. TrueLight@1692: # WINDRES: the location of your windres TrueLight@1692: # CC_HOST: the gcc of your localhost if you are making a target that produces incompatible executables TrueLight@1692: # CFLAGS_HOST: cflags used for CC_HOST. Make it something if you are getting errors when you try to compi TrueLight@1692: # windows executables on linux. (just: CFLAGS_HOST:='-I' or something) TrueLight@1692: # truelight@0: # Experimental (does not work properly): truelight@0: # WITH_DIRECTMUSIC: enable DirectMusic MIDI support truelight@0: truelight@0: truelight@0: ############################################################################## truelight@0: # truelight@0: # Configuration truelight@0: # truelight@0: bjarni@1148: bjarni@180: # Makefile version tag pasky@1492: # it checks if the version tag in Makefile.config is the same and force update outdated config files TrueLight@1692: MAKEFILE_VERSION:=7 bjarni@180: tron@1146: # CONFIG_WRITER has to be found even for manual configuration truelight@0: CONFIG_WRITER=makefiledir/Makefile.config_writer truelight@0: truelight@0: ifndef MANUAL_CONFIG truelight@0: # Automatic configuration truelight@0: MAKE_CONFIG:=Makefile.config truelight@0: MAKEFILE:=Makefile truelight@0: LIB_DETECTION=makefiledir/Makefile.libdetection truelight@0: CONFIG_WRITER=makefiledir/Makefile.config_writer truelight@0: truelight@0: # Apply automatic configuration truelight@0: # See target section for how this is built, suppress errors truelight@0: # since first time it isn't found but make reads this twice truelight@0: -include $(MAKE_CONFIG) truelight@0: else truelight@0: CONFIG_INCLUDED:=1 truelight@0: endif truelight@0: bjarni@1955: ifndef LIBPNG-CONFIG bjarni@1955: LIBPNG-CONFIG :=libpng-config bjarni@1955: endif bjarni@1955: pasky@1492: # updates Makefile.config if it's outdated bjarni@180: ifneq ($(MAKEFILE_VERSION),$(CONFIG_VERSION)) bjarni@189: ifndef MANUAL_CONFIG # manual config should not check this bjarni@189: UPDATECONFIG:=upgradeconf bjarni@189: CONFIG_INCLUDED:= bjarni@189: else bjarni@189: # this should define SDL-CONFIG for manual configuration bjarni@189: ifeq ($(shell uname),FreeBSD) bjarni@189: SDL-CONFIG:=sdl11-config bjarni@189: else bjarni@189: SDL-CONFIG:=sdl-config bjarni@189: endif bjarni@189: endif bjarni@1693: endif bjarni@1693: bjarni@1693: ifndef SDL-CONFIG bjarni@1693: UPDATECONFIG:=upgradeconf bjarni@1693: CONFIG_INCLUDED:= truelight@0: endif truelight@0: pasky@1492: # this is used if there aren't any Makefile.config truelight@0: ifndef CONFIG_INCLUDED bjarni@285: # sets network on by default if there aren't any config file truelight@543: ENABLE_NETWORK:=1 bjarni@285: bjarni@285: # paths for make install bjarni@285: # disabled as they would break it for some (many?) people if they were default bjarni@285: #PREFIX:=/usr/local bjarni@285: #DATA_DIR:=share/games/openttd bjarni@285: #BINARY_DIR:=games bjarni@285: #PERSONAL_DIR:=.openttd bjarni@285: #USE_HOMEDIR:=1 bjarni@285: truelight@0: -include $(LIB_DETECTION) truelight@0: endif truelight@0: bjarni@180: ifdef SUPRESS_LANG_ERRORS bjarni@180: LANG_ERRORS = >/dev/null 2>&1 bjarni@180: endif bjarni@180: truelight@0: ifdef STATIC truelight@0: ifndef WIN32 truelight@0: ifndef OSX truelight@0: ifndef MORPHOS truelight@0: ifndef SKIP_STATIC_CHECK pasky@1492: $(error Static is only known to work on MorphOS and MacOSX!!! --- Check Makefile.config for more info and howto bypass this check) truelight@0: endif truelight@0: endif truelight@0: endif truelight@0: endif truelight@0: endif truelight@0: bjarni@580: ifdef RELEASE bjarni@580: ifdef OSX bjarni@580: ifndef STATIC bjarni@580: $(error do not make dynamically linked releases. Most users can't use those) bjarni@580: endif bjarni@580: endif bjarni@580: endif truelight@0: truelight@0: # Force SDL on UNIX platforms truelight@0: ifndef WITH_SDL truelight@0: ifdef UNIX bjarni@549: ifndef DEDICATED bjarni@549: $(error You need to have SDL installed in order to run OpenTTD on UNIX. Use DEDICATED if you want to compile a CLI based server) truelight@0: endif truelight@0: endif bjarni@549: endif bjarni@549: bjarni@1029: # remove the dependancy for sdl if DEDICALTED is used truelight@1952: # and add -lpthread to LDFLAGS, because SDL normally adds that... bjarni@1029: ifdef DEDICATED bjarni@1029: WITH_SDL:= truelight@1952: LDFLAGS+=-lpthread bjarni@1029: endif truelight@0: truelight@0: truelight@0: ############################################################################## truelight@0: # truelight@0: # Compiler configuration truelight@0: # truelight@0: truelight@0: # Executable file extension truelight@0: ifdef WIN32 truelight@0: EXE=.exe truelight@0: else truelight@0: EXE= truelight@0: endif truelight@0: truelight@0: # Set output executable names darkvater@32: TTD=openttd$(EXE) truelight@157: ENDIAN_CHECK=endian_check$(EXE) truelight@0: STRGEN=strgen/strgen$(EXE) truelight@0: OSXAPP="OpenTTD.app" truelight@0: truelight@0: # What revision are we compiling, if we have an idea? truelight@0: REV_NUMBER := $(shell if test -d .svn; then svnversion . | tr -dc 0-9; fi) truelight@0: truelight@0: ifdef RELEASE truelight@0: REV:=$(RELEASE) truelight@0: else tron@450: REV := $(shell if test -d .svn; then svnversion . | awk '{ print "r"$$0 }'; fi) truelight@0: tmp_test:=$(shell echo "$(REV)" | grep "M" ) truelight@0: ifdef tmp_test truelight@0: REV_NUMBER:=1 truelight@0: endif truelight@0: endif truelight@0: truelight@0: ifndef REV_NUMBER truelight@0: REV_NUMBER:=0 truelight@0: endif truelight@0: truelight@0: # MorphOS needs builddate tron@1289: BUILDDATE=`date +%d.%m.%y` truelight@0: truelight@0: # AMD64 needs a little more settings to work truelight@0: ifeq ($(shell uname -m), x86_64) truelight@0: endwarnings:=endwarnings truelight@0: 64_bit_warnings:=64_bit_warnings truelight@157: BASECFLAGS += -m64 truelight@0: endif truelight@0: TrueLight@1692: # Check if there is a windres override TrueLight@1692: ifndef WINDRES TrueLight@1692: WINDRES = windres TrueLight@1692: endif TrueLight@1692: TrueLight@1692: # Check if we have a new target TrueLight@1692: ifdef CC_TARGET TrueLight@1692: CC = $(CC_TARGET) TrueLight@1692: endif TrueLight@1692: TrueLight@1692: # Check if CC_HOST is defined. If not, it is CC TrueLight@1692: ifndef CC_HOST TrueLight@1692: CC_HOST = $(CC) TrueLight@1692: endif TrueLight@1692: ifndef CFLAGS_HOST TrueLight@1692: CFLAGS_HOST = $(BASECFLAGS) TrueLight@1692: endif truelight@0: truelight@0: # When calling the compiler, use these flags truelight@0: # -g debugging symbols truelight@0: # -Wall all warnings truelight@0: # -s automatic strip truelight@0: # truelight@0: # You may also want: truelight@0: # -O optimize or -O2 fully optimize (O's above 2 are not recommended) truelight@0: # -pg profile - generate profiling data. See "man gprof" to use this. truelight@0: tron@1069: CC_VERSION = $(shell $(CC) -dumpversion | cut -c 1,3) tron@1052: tron@1052: # GNU make can only test for (in)equality tron@1052: # this is a workaround to test for >= tron@1069: ifeq ($(shell if test $(CC_VERSION) -ge 29; then echo true; fi), true) tron@1093: CFLAGS += -O -Wall -Wno-multichar -Wsign-compare -Wstrict-prototypes tron@1324: CFLAGS += -Wwrite-strings -Wpointer-arith tron@1052: endif tron@1069: ifeq ($(shell if test $(CC_VERSION) -ge 30; then echo true; fi), true) tron@1052: CFLAGS += -W -Wno-unused-parameter tron@1052: endif tron@1069: ifeq ($(shell if test $(CC_VERSION) -ge 34; then echo true; fi), true) tron@1093: CFLAGS += -Wdeclaration-after-statement -Wold-style-definition tron@1052: endif tron@1052: tron@1240: ifdef DEBUG tron@1479: ifeq ($(shell expr $(DEBUG) \>= 1), 1) tron@1479: CFLAGS += -g -D_DEBUG tron@1479: endif tron@1479: ifeq ($(shell expr $(DEBUG) \>= 2), 1) tron@1479: CFLAGS += -fno-inline tron@1479: endif tron@1479: ifeq ($(shell expr $(DEBUG) \>= 3), 1) tron@1479: CFLAGS += -O0 tron@1479: endif tron@1240: endif tron@1240: tron@1240: ifdef PROFILE tron@1240: CFLAGS += -pg tron@1240: LDFLAGS += -pg tron@1240: endif tron@1240: truelight@0: CDEFS=-DWITH_REV truelight@0: tron@1240: ifndef DEBUG tron@1240: ifndef PROFILE truelight@0: # Release mode truelight@0: ifndef MORPHOS Darkvater@1810: ifndef IRIX truelight@0: # automatical strip breaks under morphos truelight@0: BASECFLAGS += -s truelight@0: LDFLAGS += -s truelight@0: endif truelight@0: endif Darkvater@1810: endif truelight@0: truelight@0: ifdef OSX truelight@0: # these compilerflags makes the app run as fast as possible without making the app unstable. It works on G3 or newer tron@1169: BASECFLAGS += -O3 -funroll-loops -fsched-interblock -falign-loops=16 -falign-jumps=16 -falign-functions=16 -falign-jumps-max-skip=15 -falign-loops-max-skip=15 -mdynamic-no-pic -mpowerpc-gpopt -force_cpusubtype_ALL truelight@0: else truelight@0: ifdef MORPHOS tron@1291: BASECFLAGS += -O2 -noixemul -fstrict-aliasing -fexpensive-optimizations tron@1291: BASECFLAGS += -mcpu=604 -fno-inline -mstring -mmultiple truelight@0: else tron@1169: BASECFLAGS += -O2 truelight@0: endif truelight@0: ifndef PROFILE Darkvater@1810: ifndef IRIX truelight@0: BASECFLAGS += -fomit-frame-pointer truelight@0: endif truelight@0: endif truelight@0: endif Darkvater@1810: endif truelight@0: truelight@0: ifdef STATIC truelight@0: ifndef OSX # OSX can't build static if -static flag is used truelight@0: LDFLAGS += -static truelight@0: endif truelight@0: endif truelight@0: darkvater@798: # If building on MingW don't link with Cygwin libs truelight@0: ifdef WIN32 darkvater@798: ifdef CYGWIN darkvater@798: BASECFLAGS += -mwin32 darkvater@798: LDFLAGS += -mwin32 darkvater@798: endif truelight@0: ifdef MINGW truelight@0: BASECFLAGS += -mno-cygwin truelight@0: LDFLAGS += -mno-cygwin truelight@0: endif truelight@0: endif truelight@0: truelight@0: CFLAGS += $(BASECFLAGS) truelight@0: truelight@2033: # See if we want to enable GPMI truelight@2033: ifdef GPMI truelight@2033: CFLAGS += -DGPMI truelight@2033: GPMI_STATIC_PATH = `gpmi-config --static` truelight@2033: LDFLAGS += -rdynamic `gpmi-config --libs` truelight@2033: # Static link paths into the game truelight@2033: LDFLAGS += $(GPMI_STATIC_PATH)/paths-static.o truelight@2033: endif truelight@2033: truelight@0: ifdef UNIX truelight@0: CDEFS += -DUNIX truelight@0: endif truelight@0: tron@421: ifdef BEOS tron@421: CDEFS += -DBEOS tron@421: LDFLAGS += -lmidi -lbe tron@421: ifdef WITH_NETWORK tron@421: ifdef BEOS_NET_SERVER tron@1051: CDEFS += -DBEOS_NET_SERVER tron@1051: else tron@1051: # Zeta needs a few more libraries than R5 tron@1051: LDFLAGS += -lbind -lsocket tron@421: endif tron@421: endif tron@421: endif tron@421: tron@1164: ifdef MORPHOS tron@1291: # -Wstrict-prototypes generates much noise because of system headers tron@1291: CFLAGS += -Wno-strict-prototypes tron@1164: endif tron@1164: tron@446: ifdef SUNOS tron@446: CDEFS += -DSUNOS tron@446: ifdef WITH_NETWORK tron@446: LDFLAGS += -lnsl -lsocket tron@446: endif tron@446: endif tron@446: truelight@0: # SDL config truelight@0: ifdef WITH_SDL truelight@0: CDEFS += -DWITH_SDL tron@1254: CFLAGS += $(shell $(SDL-CONFIG) --cflags) truelight@0: ifdef STATIC tron@1254: LIBS += $(shell $(SDL-CONFIG) --static-libs) truelight@0: else tron@1254: LIBS += $(shell $(SDL-CONFIG) --libs) truelight@0: endif truelight@0: endif truelight@0: truelight@0: truelight@0: # zlib config truelight@0: ifdef WITH_ZLIB truelight@0: CDEFS += -DWITH_ZLIB truelight@0: ifdef STATIC truelight@0: ifdef OSX truelight@0: # zlib is default on OSX, so everybody have it. No need for static linking truelight@0: LIBS += -lz truelight@0: else truelight@0: ifndef STATIC_ZLIB_PATH truelight@0: ifndef MANUAL_CONFIG pasky@1492: # updates Makefile.config with the zlib path truelight@0: UPDATECONFIG:=upgradeconf truelight@0: endif truelight@0: TEMP:=$(shell ls /lib 2>/dev/null | grep "zlib.a")$(shell ls /lib 2>/dev/null | grep "libz.a") truelight@0: ifdef TEMP truelight@0: STATIC_ZLIB_PATH:=/lib/$(TEMP) truelight@0: else truelight@0: TEMP:=$(shell ls /usr/lib 2>/dev/null | grep "zlib.a")$(shell ls /usr/lib 2>/dev/null | grep "libz.a") truelight@0: ifdef TEMP truelight@0: STATIC_ZLIB_PATH:=/usr/lib/$(TEMP) truelight@0: else truelight@0: TEMP:=$(shell ls /usr/local/lib 2>/dev/null | grep "zlib.a")$(shell ls /usr/local/lib 2>/dev/null | grep "libz.a") truelight@0: ifdef TEMP truelight@0: STATIC_ZLIB_PATH:=/usr/local/lib/$(TEMP) truelight@0: endif truelight@0: endif truelight@0: endif truelight@0: endif truelight@0: LIBS += $(STATIC_ZLIB_PATH) truelight@0: endif truelight@0: else truelight@0: LIBS += -lz truelight@0: endif truelight@0: endif truelight@0: truelight@0: # libpng config truelight@0: ifdef WITH_PNG truelight@0: CDEFS += -DWITH_PNG bjarni@1955: CFLAGS += $(shell $(LIBPNG-CONFIG) --cflags) bjarni@551: truelight@0: # seems like older libpng versions are broken and need this truelight@0: PNGCONFIG_FLAGS = --ldflags --libs truelight@0: ifdef STATIC bjarni@583: ifdef OSX bjarni@583: # Seems like we need a tiny hack for OSX static to work bjarni@1955: LIBS += $(shell $(LIBPNG-CONFIG) --prefix)/lib/libpng.a bjarni@583: else bjarni@1955: LIBS += $(shell $(LIBPNG-CONFIG) --static $(PNGCONFIG_FLAGS)) bjarni@583: endif truelight@0: else bjarni@1955: LIBS += $(shell $(LIBPNG-CONFIG) --L_opts $(PNGCONFIG_FLAGS)) truelight@0: endif truelight@0: endif truelight@0: bjarni@347: # enables/disables assert() bjarni@348: ifdef DISABLE_ASSERTS bjarni@348: CFLAGS += -DNDEBUG bjarni@348: endif bjarni@348: bjarni@348: # automatically disables asserts for release bjarni@348: ifdef RELEASE bjarni@347: ifndef ENABLE_ASSERTS bjarni@347: CFLAGS += -DNDEBUG bjarni@347: endif bjarni@348: endif truelight@0: truelight@0: ifdef TRANSLATOR truelight@0: STRGEN_FLAGS=-t truelight@0: else truelight@0: STRGEN_FLAGS= truelight@0: endif truelight@0: truelight@0: truelight@0: # MIDI setup truelight@0: ifdef OSX truelight@0: ifndef MIDI truelight@1951: MIDI:=$(OSXAPP)/Contents/MacOS/track_starter truelight@0: endif bjarni@561: ifndef SECOND_DATA_PATH truelight@1720: SECOND_DATA_PATH:="$(OSXAPP)/Contents/Data/" bjarni@561: endif bjarni@561: ifndef CUSTOM_LANG_DIR truelight@1720: CUSTOM_LANG_DIR:="$(OSXAPP)/Contents/Lang/" bjarni@561: endif truelight@0: endif truelight@0: truelight@0: ifdef MIDI truelight@0: CDEFS += -DEXTERNAL_PLAYER=\"$(MIDI)\" truelight@0: ifdef MIDI_ARG truelight@0: CDEFS += -DMIDI_ARG=\"$(MIDI_ARG)\" truelight@0: endif truelight@0: endif truelight@0: truelight@0: ifdef WITH_NETWORK truelight@0: CDEFS += -DENABLE_NETWORK truelight@543: ifdef QNX truelight@543: LIBS += -lsocket truelight@543: endif truelight@0: ifdef UNIX truelight@0: ifndef OSX truelight@0: ifndef MORPHOS truelight@0: # this have caused problems on many platforms and disabling it didn't break anything truelight@0: # now we test if disabling it as a general breaks it for anybody truelight@0: #LIBS += -lresolv truelight@0: endif truelight@0: endif truelight@0: endif truelight@0: endif truelight@0: bjarni@561: bjarni@561: ifdef SECOND_DATA_PATH bjarni@561: CDEFS += -DSECOND_DATA_DIR=\"$(SECOND_DATA_PATH)/\" bjarni@561: endif bjarni@561: bjarni@561: ifdef CUSTOM_LANG_DIR bjarni@561: CDEFS += -DCUSTOM_LANG_DIR=\"$(CUSTOM_LANG_DIR)/\" bjarni@561: endif bjarni@561: truelight@0: ifdef WITH_DIRECTMUSIC truelight@0: CDEFS += -DWIN32_ENABLE_DIRECTMUSIC_SUPPORT truelight@0: endif truelight@0: truelight@0: ifdef WIN32 TrueLight@1692: LIBS += -lws2_32 -lwinmm -lgdi32 -ldxguid -lole32 TrueLight@1692: ifdef WITH_DIRECTMUSIC TrueLight@1692: LIBS += -lstdc++ TrueLight@1692: endif truelight@0: TTDLDFLAGS += -Wl,--subsystem,windows truelight@0: endif truelight@0: pasky@1476: ifndef DEST_DIR pasky@1476: DEST_DIR = $(DESTDIR) pasky@1476: endif pasky@1476: truelight@0: # sets up the paths for use for make install bjarni@285: ifdef INSTALL bjarni@285: # We use _PREFIXED vars here, so the paths are recalculated every time, and bjarni@285: # the prefix is not prepended in the makefile config bjarni@285: BINARY_DIR_PREFIXED:=$(PREFIX)/$(BINARY_DIR) bjarni@285: DATA_DIR_PREFIXED:=$(PREFIX)/$(DATA_DIR) bjarni@285: # We use _INSTALL vars here, these vars are the locations where the files will bjarni@285: # be installed bjarni@285: DATA_DIR_INSTALL=$(DEST_DIR)/$(DATA_DIR_PREFIXED) bjarni@285: BINARY_DIR_INSTALL=$(DEST_DIR)/$(BINARY_DIR_PREFIXED) bjarni@285: # Let the code know where to find stuff bjarni@285: ifdef DATA_DIR_PREFIXED bjarni@285: CDEFS += -DGAME_DATA_DIR=\"$(DATA_DIR_PREFIXED)/\" truelight@0: endif bjarni@285: bjarni@285: ifdef PERSONAL_DIR bjarni@285: CDEFS += -DPERSONAL_DIR=\"$(PERSONAL_DIR)/\" bjarni@285: endif bjarni@285: bjarni@285: ifdef USE_HOMEDIR bjarni@285: CDEFS += -DUSE_HOMEDIR bjarni@285: endif truelight@0: endif truelight@0: truelight@0: ############################################################################## truelight@0: # truelight@0: # What to compile truelight@0: # (users do not want to modify anything below) truelight@0: # truelight@0: truelight@0: truelight@0: ### Sources truelight@0: truelight@2096: C_SOURCES += ai_old.c tron@677: C_SOURCES += ai_build.c tron@677: C_SOURCES += ai_new.c tron@677: C_SOURCES += ai_pathfinder.c tron@677: C_SOURCES += ai_shared.c tron@677: C_SOURCES += aircraft_cmd.c tron@677: C_SOURCES += aircraft_gui.c tron@677: C_SOURCES += airport.c tron@677: C_SOURCES += airport_gui.c tron@677: C_SOURCES += aystar.c tron@677: C_SOURCES += bridge_gui.c tron@677: C_SOURCES += callback_table.c tron@677: C_SOURCES += clear_cmd.c tron@677: C_SOURCES += command.c tron@677: C_SOURCES += console.c tron@677: C_SOURCES += console_cmds.c tron@1299: C_SOURCES += debug.c tron@677: C_SOURCES += dedicated.c truelight@1313: C_SOURCES += depot.c tron@677: C_SOURCES += disaster_cmd.c tron@677: C_SOURCES += dock_gui.c tron@2171: C_SOURCES += driver.c tron@677: C_SOURCES += dummy_land.c tron@677: C_SOURCES += economy.c tron@677: C_SOURCES += engine.c tron@677: C_SOURCES += engine_gui.c tron@677: C_SOURCES += fileio.c tron@677: C_SOURCES += gfx.c tron@677: C_SOURCES += graph_gui.c tron@677: C_SOURCES += newgrf.c tron@677: C_SOURCES += industry_cmd.c tron@677: C_SOURCES += industry_gui.c tron@677: C_SOURCES += intro_gui.c tron@677: C_SOURCES += landscape.c tron@677: C_SOURCES += main_gui.c tron@679: C_SOURCES += map.c tron@677: C_SOURCES += md5.c Darkvater@2075: C_SOURCES += mersenne.c tron@677: C_SOURCES += minilzo.c tron@677: C_SOURCES += misc.c tron@677: C_SOURCES += misc_cmd.c tron@677: C_SOURCES += misc_gui.c tron@1496: C_SOURCES += mixer.c tron@677: C_SOURCES += music_gui.c tron@677: C_SOURCES += namegen.c tron@677: C_SOURCES += network.c tron@677: C_SOURCES += network_client.c tron@677: C_SOURCES += network_data.c tron@677: C_SOURCES += network_gamelist.c tron@677: C_SOURCES += network_gui.c tron@677: C_SOURCES += network_server.c tron@677: C_SOURCES += network_udp.c tron@677: C_SOURCES += news_gui.c matthijs@1247: C_SOURCES += npf.c tron@677: C_SOURCES += oldloader.c tron@677: C_SOURCES += order_cmd.c tron@677: C_SOURCES += order_gui.c celestar@1985: C_SOURCES += openttd.c tron@677: C_SOURCES += pathfind.c hackykid@2008: C_SOURCES += pbs.c tron@677: C_SOURCES += player_gui.c tron@677: C_SOURCES += players.c truelight@1259: C_SOURCES += pool.c tron@677: C_SOURCES += queue.c matthijs@1942: C_SOURCES += rail.c tron@677: C_SOURCES += rail_cmd.c tron@677: C_SOURCES += rail_gui.c tron@677: C_SOURCES += rev.c tron@677: C_SOURCES += road_cmd.c tron@677: C_SOURCES += road_gui.c tron@677: C_SOURCES += roadveh_cmd.c tron@677: C_SOURCES += roadveh_gui.c tron@677: C_SOURCES += saveload.c tron@677: C_SOURCES += screenshot.c tron@677: C_SOURCES += settings.c tron@677: C_SOURCES += settings_gui.c tron@677: C_SOURCES += ship_cmd.c tron@677: C_SOURCES += ship_gui.c truelight@988: C_SOURCES += signs.c tron@677: C_SOURCES += smallmap_gui.c tron@677: C_SOURCES += sound.c tron@677: C_SOURCES += sprite.c tron@677: C_SOURCES += spritecache.c tron@677: C_SOURCES += station_cmd.c tron@677: C_SOURCES += station_gui.c tron@1317: C_SOURCES += string.c tron@677: C_SOURCES += strings.c tron@677: C_SOURCES += subsidy_gui.c tron@677: C_SOURCES += terraform_gui.c tron@677: C_SOURCES += texteff.c tron@1211: C_SOURCES += tile.c tron@677: C_SOURCES += town_cmd.c tron@677: C_SOURCES += town_gui.c tron@677: C_SOURCES += train_cmd.c tron@677: C_SOURCES += train_gui.c tron@677: C_SOURCES += tree_cmd.c tron@677: C_SOURCES += tunnelbridge_cmd.c tron@677: C_SOURCES += unmovable_cmd.c tron@677: C_SOURCES += vehicle.c tron@677: C_SOURCES += vehicle_gui.c tron@677: C_SOURCES += viewport.c tron@677: C_SOURCES += water_cmd.c truelight@1542: C_SOURCES += waypoint.c tron@677: C_SOURCES += widget.c tron@677: C_SOURCES += window.c tron@2174: C_SOURCES += music/null_m.c tron@2174: C_SOURCES += sound/null_s.c tron@2177: C_SOURCES += video/dedicated_v.c tron@2174: C_SOURCES += video/null_v.c tron@677: tron@421: CXX_SOURCES = truelight@0: bjarni@2188: OBJC_SOURCES = bjarni@2188: Darkvater@1829: ifdef WITH_SDL Darkvater@1829: C_SOURCES += sdl.c tron@2174: C_SOURCES += sound/sdl_s.c tron@2174: C_SOURCES += video/sdl_v.c Darkvater@1829: endif Darkvater@1829: truelight@0: ifdef WIN32 tron@2171: C_SOURCES += win32.c tron@2174: C_SOURCES += music/win32_m.c tron@2174: C_SOURCES += sound/win32_s.c tron@2174: C_SOURCES += video/win32_v.c truelight@0: else tron@2171: C_SOURCES += unix.c tron@2171: C_SOURCES += music/extmidi.c truelight@0: endif truelight@0: bjarni@2188: ifdef OSX bjarni@2188: OBJC_SOURCES += os/macosx/macos.m bjarni@2188: endif bjarni@2188: bjarni@2188: OBJS = $(C_SOURCES:%.c=%.o) $(CXX_SOURCES:%.cpp=%.o) $(OBJC_SOURCES:%.m=%.o) tron@421: tron@421: ifdef BEOS tron@2171: CXX_SOURCES += music/bemidi.cpp tron@421: endif truelight@0: truelight@0: ifdef WIN32 truelight@0: # Resource file tron@1167: OBJS += winres.o truelight@0: endif truelight@0: truelight@0: ifdef WITH_DIRECTMUSIC tron@2171: C_SOURCES += music/dmusic.c tron@2171: CXX_SOURCES += music/dmusic2.cpp truelight@0: endif truelight@0: tron@1170: DEPS = $(OBJS:%.o=.deps/%.d) truelight@0: truelight@0: LANG_TXT = $(filter-out %.unfinished.txt,$(wildcard lang/*.txt)) truelight@0: LANGS = $(LANG_TXT:%.txt=%.lng) truelight@0: bjarni@162: truelight@0: ############################################################################## truelight@0: # pasky@1413: # Build commands pasky@1413: # pasky@1413: pasky@1413: # If we are verbose, we will show commands prefixed by $(Q) (which acts as tron@1435: # @ in the non-verbose mode), and we will show the "real" cmds instead of tron@1435: # their quiet versions (which are used in the non-verbose mode). pasky@1413: # Inspired by the Linux kernel build system. pasky@1413: ifdef VERBOSE pasky@1413: Q = tron@1435: quiet = pasky@1413: else pasky@1413: Q = @ tron@1435: quiet = quiet_ pasky@1413: endif pasky@1413: tron@1435: # Show the command (quiet or non-quiet version based on the assignment tron@1435: # just above) and then execute it. tron@1435: cmd = @$(if $($(quiet)cmd_$(1)),echo $($(quiet)cmd_$(1)) &&) $(cmd_$(1)) tron@1435: tron@1435: tron@1435: # The build commands themselves. Note that if you omit the quiet version, tron@1435: # nothing will be shown in the non-verbose mode. tron@1435: tron@1435: quiet_cmd_compile_link = '===> Compiling and Linking $@' TrueLight@1692: cmd_compile_link = $(CC_HOST) $(CFLAGS_HOST) $(CDEFS) $< -o $@ tron@1435: tron@1435: quiet_cmd_ttd_link = '===> Linking $@' tron@1435: cmd_ttd_link = $(CC) $(LDFLAGS) $(TTDLDFLAGS) $(OBJS) $(LIBS) -o $@ tron@1435: tron@1435: COMPILE_PARAMS=$(CFLAGS) $(CDEFS) -MD -c $< -o $@ tron@1435: tron@1435: quiet_cmd_c_compile = '===> Compiling $<' tron@1435: cmd_c_compile = $(CC) $(COMPILE_PARAMS) tron@1435: tron@1435: quiet_cmd_cxx_compile = '===> Compiling $<' tron@1435: cmd_cxx_compile = $(CXX) $(COMPILE_PARAMS) tron@1435: bjarni@2188: quiet_cmd_objc_compile = '===> Compiling $<' bjarni@2188: cmd_objc_compile = $(CC) $(COMPILE_PARAMS) bjarni@2188: pasky@1413: pasky@1413: ############################################################################## pasky@1413: # truelight@0: # Targets truelight@0: # truelight@0: truelight@0: truelight@0: ### Normal build rules truelight@0: truelight@0: truelight@0: ifdef OSX truelight@0: OSX:=OSX bjarni@1822: OSX_MIDI_PLAYER_FILE:=os/macos/OpenTTDMidi.class truelight@0: endif truelight@0: truelight@0: truelight@1721: all: endian_target.h endian_host.h $(UPDATECONFIG) $(LANGS) $(TTD) $(OSX) $(endwarnings) truelight@0: truelight@1721: endian_host.h: $(ENDIAN_CHECK) truelight@1721: @echo '===> Testing endianness for host' truelight@1721: $(Q)./$(ENDIAN_CHECK) > $@ truelight@1721: truelight@1721: endian_target.h: $(ENDIAN_CHECK) truelight@1721: @echo '===> Testing endianness for target' TrueLight@1692: $(Q)./$(ENDIAN_CHECK) $(ENDIAN_FORCE) > $@ truelight@157: truelight@157: $(ENDIAN_CHECK): endian_check.c tron@1435: $(call cmd,compile_link) darkvater@222: truelight@0: tron@1167: $(TTD): table/strings.h $(OBJS) $(MAKE_CONFIG) tron@1435: $(call cmd,ttd_link) truelight@0: bjarni@728: $(OSX): $(TTD) pasky@1413: $(Q)rm -fr "$(OSXAPP)" pasky@1413: $(Q)mkdir -p "$(OSXAPP)"/Contents/MacOS pasky@1413: $(Q)mkdir -p "$(OSXAPP)"/Contents/Resources pasky@1413: $(Q)mkdir -p "$(OSXAPP)"/Contents/Data pasky@1413: $(Q)mkdir -p "$(OSXAPP)"/Contents/Lang pasky@1413: $(Q)echo "APPL????" > "$(OSXAPP)"/Contents/PkgInfo bjarni@1694: $(Q)cp os/macosx/openttd.icns "$(OSXAPP)"/Contents/Resources/openttd.icns bjarni@1694: $(Q)os/macosx/plistgen.sh "$(OSXAPP)" "$(REV)" truelight@1722: $(Q)cp os/macosx/track_starter "$(OSXAPP)"/Contents/MacOS bjarni@1694: $(Q)ls os/macosx | grep -q "\.class" || \ bjarni@1694: javac os/macosx/OpenTTDMidi.java truelight@1722: $(Q)cp os/macosx/OpenTTDMidi.class "$(OSXAPP)"/Contents/MacOS truelight@1720: $(Q)cp data/* "$(OSXAPP)"/Contents/Data/ truelight@1720: $(Q)cp lang/*.lng "$(OSXAPP)"/Contents/Lang/ pasky@1413: $(Q)cp $(TTD) "$(OSXAPP)"/Contents/MacOS/$(TTD) truelight@0: truelight@0: $(endwarnings): $(64_bit_warnings) truelight@0: truelight@0: $(64_bit_warnings): truelight@0: $(warning 64 bit CPUs will get some 64 bit specific bugs!) truelight@0: $(warning If you see any bugs, include in your bug report that you use a 64 bit CPU) truelight@0: truelight@1721: $(STRGEN): strgen/strgen.c endian_host.h tron@1435: $(call cmd,compile_link) truelight@0: tron@474: table/strings.h: lang/english.txt $(STRGEN) tron@1118: @echo '===> Generating $@' pasky@1413: $(Q)$(STRGEN) darkvater@222: tron@476: lang/%.lng: lang/%.txt $(STRGEN) lang/english.txt tron@1118: @echo '===> Compiling language $(*F)' tron@2106: $(Q)$(STRGEN) $(STRGEN_FLAGS) $< $(LANG_ERRORS) || rm -f $@ truelight@0: Darkvater@1891: winres.o: openttd.rc tron@1118: @echo '===> Compiling resource $<' TrueLight@1692: $(Q)$(WINDRES) -o $@ $< truelight@0: bjarni@770: ifdef MORPHOS bjarni@770: release: all pasky@1413: $(Q)rm -fr "/t/openttd-$(RELEASE)-morphos.lha" pasky@1413: $(Q)mkdir -p "/t/" pasky@1413: $(Q)mkdir -p "/t/openttd-$(RELEASE)-morphos" pasky@1413: $(Q)mkdir -p "/t/openttd-$(RELEASE)-morphos/docs" pasky@1413: $(Q)mkdir -p "/t/openttd-$(RELEASE)-morphos/data" pasky@1413: $(Q)mkdir -p "/t/openttd-$(RELEASE)-morphos/lang" pasky@1413: $(Q)mkdir -p "/t/openttd-$(RELEASE)-morphos/scenario" pasky@1413: $(Q)cp -R $(TTD) "/t/openttd-$(RELEASE)-morphos/" pasky@1413: $(Q)cp data/* "/t/openttd-$(RELEASE)-morphos/data/" pasky@1413: $(Q)cp lang/*.lng "/t/openttd-$(RELEASE)-morphos/lang/" pasky@1413: $(Q)cp scenario/* "/t/openttd-$(RELEASE)-morphos/scenario/" pasky@1413: $(Q)cp readme.txt "/t/openttd-$(RELEASE)-morphos/docs/ReadMe" pasky@1413: $(Q)cp docs/console.txt "/t/openttd-$(RELEASE)-morphos/docs/Console" pasky@1413: $(Q)cp COPYING "/t/openttd-$(RELEASE)-morphos/docs/" pasky@1413: $(Q)cp changelog.txt "/t/openttd-$(RELEASE)-morphos/docs/ChangeLog" pasky@1413: $(Q)cp known-bugs.txt "/t/openttd-$(RELEASE)-morphos/docs/known-bugs.txt" pasky@1413: $(Q)cp os/morphos/icons/openttd.info "/t/openttd-$(RELEASE)-morphos/$(TTD).info" pasky@1413: $(Q)cp os/morphos/icons/docs.info "/t/openttd-$(RELEASE)-morphos/docs.info" pasky@1413: $(Q)cp os/morphos/icons/drawer.info "/t/openttd-$(RELEASE)-morphos.info" pasky@1413: $(Q)cp os/morphos/icons/document.info "/t/openttd-$(RELEASE)-morphos/docs/ReadMe.info" pasky@1413: $(Q)cp os/morphos/icons/document.info "/t/openttd-$(RELEASE)-morphos/docs/Console.info" pasky@1413: $(Q)cp os/morphos/icons/document.info "/t/openttd-$(RELEASE)-morphos/docs/COPYING.info" pasky@1413: $(Q)cp os/morphos/icons/document.info "/t/openttd-$(RELEASE)-morphos/docs/ChangeLog.info" pasky@1413: $(Q)strip --strip-all --strip-unneeded --remove-section .comment "/t/openttd-$(RELEASE)-morphos/$(TTD)" pasky@1413: $(Q)lha a -r "t:openttd-$(RELEASE)-morphos.lha" "t:openttd-$(RELEASE)-morphos" pasky@1413: $(Q)lha a "t:openttd-$(RELEASE)-morphos.lha" "t:openttd-$(RELEASE)-morphos.info" pasky@1413: $(Q)rm -fr "/t/openttd-$(RELEASE)-morphos" pasky@1413: $(Q)rm -fr "/t/openttd-$(RELEASE)-morphos.info" bjarni@770: @echo "Release archive can be found in RAM:t/ now." bjarni@770: tron@1251: .PHONY: release bjarni@770: endif bjarni@770: bjarni@563: ifdef OSX bjarni@563: release: all pasky@1413: $(Q)mkdir -p "OpenTTD $(RELEASE)" pasky@1413: $(Q)mkdir -p "OpenTTD $(RELEASE)"/docs pasky@1413: $(Q)mkdir -p "OpenTTD $(RELEASE)"/scenario pasky@1413: $(Q)cp -R $(OSXAPP) "OpenTTD $(RELEASE)"/ pasky@1413: $(Q)cp docs/OSX_where_did_the_package_go.txt "OpenTTD $(RELEASE)"/Where\ did\ the\ package\ go.txt pasky@1413: $(Q)cp readme.txt "OpenTTD $(RELEASE)"/docs/ pasky@1413: $(Q)cp docs/README_if_game_crashed_on_OSX.txt "OpenTTD $(RELEASE)"/docs/readme\ if\ crashed\ on\ OSX.txt pasky@1413: $(Q)cp docs/console.txt "OpenTTD $(RELEASE)"/docs/ pasky@1413: $(Q)cp COPYING "OpenTTD $(RELEASE)"/docs/ pasky@1413: $(Q)cp changelog.txt "OpenTTD $(RELEASE)"/docs/ pasky@1413: $(Q)cp docs/README_if_game_crashed_on_OSX.txt "OpenTTD $(RELEASE)"/docs/ bjarni@1694: $(Q)cp os/macosx/*.webloc "OpenTTD $(RELEASE)" pasky@1413: $(Q)cp known-bugs.txt "OpenTTD $(RELEASE)"/known-bugs.txt pasky@1413: $(Q)cp scenario/* "OpenTTD $(RELEASE)"/scenario/ pasky@1413: $(Q)/usr/bin/hdiutil create -ov -format UDZO -srcfolder "OpenTTD $(RELEASE)" openttd-"$(RELEASE)"-osx.dmg pasky@1413: $(Q)rm -fr "OpenTTD $(RELEASE)" bjarni@563: bjarni@564: nightly_build: all pasky@1413: $(Q)mkdir -p "OpenTTD_nightly_$(DATE)" pasky@1413: $(Q)mkdir -p "OpenTTD_nightly_$(DATE)"/docs pasky@1413: $(Q)cp -R $(OSXAPP) "OpenTTD_nightly_$(DATE)"/ pasky@1413: $(Q)cp docs/OSX_where_did_the_package_go.txt "OpenTTD_nightly_$(DATE)"/Where\ did\ the\ package\ go.txt pasky@1413: $(Q)cp readme.txt "OpenTTD_nightly_$(DATE)"/docs/ pasky@1413: $(Q)cp docs/README_if_game_crashed_on_OSX.txt "OpenTTD_nightly_$(DATE)"/docs/readme\ if\ crashed\ on\ OSX.txt pasky@1413: $(Q)cp docs/console.txt "OpenTTD_nightly_$(DATE)"/docs/ pasky@1413: $(Q)cp COPYING "OpenTTD_nightly_$(DATE)"/docs/ pasky@1413: $(Q)cp revisionlog.txt "OpenTTD_nightly_$(DATE)"/revisionlog.txt pasky@1413: $(Q)cp docs/README_if_game_crashed_on_OSX.txt "OpenTTD_nightly_$(DATE)"/docs/ bjarni@1694: $(Q)cp os/macosx/*.webloc "OpenTTD_nightly_$(DATE)"/ pasky@1413: $(Q)/usr/bin/hdiutil create -ov -format UDZO -srcfolder "OpenTTD_nightly_$(DATE)" openttd-nightly-"$(DATE)".dmg pasky@1413: $(Q)rm -fr "OpenTTD_nightly_$(DATE)" bjarni@564: bjarni@564: .PHONY: release nightly_build bjarni@563: endif truelight@0: truelight@0: rev.c: FORCE truelight@0: @# setting the revision number in a place, there the binary can read it bjarni@615: @echo 'const char _openttd_revision[] = "$(REV)";' >>rev.c.new truelight@0: @echo 'const int _revision_number = $(REV_NUMBER);' >>rev.c.new truelight@0: @# some additions for MorphOS versions tag truelight@0: @echo '#ifdef __MORPHOS__' >>rev.c.new bjarni@615: @echo 'const char morphos_versions_tag[] = "\\0$$VER: OpenTTD $(REV) ('${BUILDDATE}') © OpenTTD Team [MorphOS, PowerPC]";' >>rev.c.new truelight@0: @echo '#endif' >>rev.c.new truelight@0: @# Only update the real rev.c if it actually changed, to prevent truelight@0: @# useless rebuilds. truelight@0: @cmp -s rev.c rev.c.new 2>/dev/null || mv rev.c.new rev.c truelight@0: @rm -f rev.c.new truelight@0: truelight@0: FORCE: truelight@0: truelight@0: truelight@0: clean: tron@1118: @echo '===> Cleaning up' truelight@1721: # endian.h is out-dated and no longer in use, so it can be removed soon truelight@1721: $(Q)rm -rf .deps *~ $(TTD) $(STRGEN) core table/strings.h $(LANGS) $(OBJS) $(OSX_MIDI_PLAYER_FILE) endian.h endian_host.h endian_target.h $(ENDIAN_CHECK) truelight@0: truelight@0: mrproper: clean pasky@1413: $(Q)rm -rf $(MAKE_CONFIG) truelight@0: truelight@0: ifndef OSX truelight@0: ifndef MORPHOS truelight@0: install: bjarni@285: ifeq ($(INSTALL),) bjarni@285: $(error make install is highly experimental at his state and not\ pasky@1492: tested very much - use at your own risk - to use run \"make install INSTALL:=1\" - make sure Makefile.config\ truelight@0: is set correctly up - run \"make upgradeconf\") bjarni@285: endif bjarni@285: truelight@543: ifeq ($(PREFIX), ) pasky@1492: $(error no prefix set - check Makefile.config) bjarni@285: endif bjarni@285: # We compare against the non prefixed version here, so we won't install bjarni@285: # if only the prefix has been set bjarni@285: ifeq ($(DATA_DIR),) pasky@1492: $(error no data path set - check Makefile.config) bjarni@285: endif bjarni@285: ifeq ($(BINARY_DIR),) pasky@1492: $(error no binary path set - check Makefile.config) bjarni@285: endif bjarni@285: # We'll install in $DEST_DIR instead of root if it is set (we don't bjarni@285: # care about extra /'s pasky@1491: install -d $(DATA_DIR_INSTALL)/lang \ pasky@1491: $(DATA_DIR_INSTALL)/data \ pasky@1491: $(DATA_DIR_INSTALL)/gm \ pasky@1491: $(BINARY_DIR_INSTALL) matthijs@1865: ifndef USE_HOMEDIR matthijs@1865: mkdir -p $(PERSONAL_DIR)/scenario matthijs@1865: else matthijs@1865: mkdir -p $(DATA_DIR_INSTALL)/scenario matthijs@1865: endif pasky@1491: install $(TTD) $(BINARY_DIR_INSTALL) pasky@1491: install -m 644 lang/*.lng $(DATA_DIR_INSTALL)/lang pasky@1491: install -m 644 data/*.grf $(DATA_DIR_INSTALL)/data pasky@1491: install -m 644 data/opntitle.dat $(DATA_DIR_INSTALL)/data pasky@1491: install -m 644 media/openttd.64.png $(DATA_DIR_INSTALL) matthijs@1865: install -m 644 media/openttd.32.xpm $(DATA_DIR_INSTALL) matthijs@1865: ifndef USE_HOMEDIR bjarni@1160: cp scenario/* $(PERSONAL_DIR)/scenario/ matthijs@1865: else matthijs@1865: cp scenario/* $(DATA_DIR_INSTALL)/scenario/ matthijs@1865: endif truelight@0: else #MorphOS truelight@0: install: truelight@0: $(error make install is not supported on MorphOS) truelight@0: endif truelight@0: else # OSX truelight@0: install: truelight@0: $(error make install is not supported on MacOSX) truelight@0: endif truelight@0: truelight@0: truelight@0: love: truelight@0: @echo "YES! I thought you would never ask. We will have a great time. You can keep me turned on all night" truelight@0: truelight@730: .PHONY: clean all $(OSX) install $(64_bit_warnings) $(endwarnings) love truelight@0: truelight@0: truelight@0: ### Automatic configuration truelight@0: -include $(CONFIG_WRITER) darkvater@222: truelight@0: truelight@0: # Export all variables set to subprocesses (a bit dirty) truelight@0: .EXPORT_ALL_VARIABLES: truelight@0: upgradeconf: $(MAKE_CONFIG) pasky@1413: $(Q)rm $(MAKE_CONFIG) pasky@1413: $(Q)$(MAKE) $(MAKE_CONFIG) truelight@0: truelight@0: .PHONY: upgradeconf truelight@0: truelight@0: truelight@0: ### Internal build rules truelight@0: truelight@0: # This makes sure the .deps dir is always around. bjarni@2188: DEPS_MAGIC := $(shell mkdir -p .deps .deps/music .deps/sound .deps/video .deps/os .deps/os/macosx) truelight@0: truelight@0: # Introduce the dependencies tron@1167: -include $(DEPS) truelight@0: truelight@0: # This compiles the object file as well as silently updating its dependencies truelight@0: # list at the same time. It is not an issue that they aren't around during the truelight@0: # first compilation round as we just build everything at that time anyway, truelight@0: # therefore we do not need to watch deps. bjarni@162: truelight@1721: %.o: %.c $(MAKE_CONFIG) endian_target.h table/strings.h tron@1435: $(call cmd,c_compile) tron@1170: @mv $(<:%.c=%.d) $(<:%.c=.deps/%.d) truelight@0: truelight@1721: %.o: %.cpp $(MAKE_CONFIG) endian_target.h table/strings.h tron@1435: $(call cmd,cxx_compile) tron@1629: @mv $(<:%.cpp=%.d) $(<:%.cpp=.deps/%.d) tron@1170: bjarni@2188: %.o: %.m $(MAKE_CONFIG) endian_target.h table/strings.h bjarni@2188: $(call cmd,objc_compile) bjarni@2188: @mv $(<:%.m=%.d) $(<:%.m=.deps/%.d) bjarni@2188: tron@1170: # Silence stale header dependencies tron@1170: %.h: tron@1170: @true tron@1163: tron@1163: tron@1163: info: tron@1435: @echo 'CFLAGS = $(CFLAGS)' tron@1163: @echo 'LDFLAGS = $(LDFLAGS)' tron@1163: @echo 'LIBS = $(LIBS)'