tron@2185: # $Id$ tron@2185: 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 bjarni@2736: # WITH_COCOA: Cocoa video driver support truelight@0: # truelight@0: # Summary of other defines: 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. tron@2197: # WITH_DIRECTMUSIC: enable DirectMusic MIDI support 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 matthijs@2901: # ICON_DIR: The location of the openttd icon. (Will be prefixed with matthijs@2901: # $PREFIX). 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: # bjarni@5560: # CUSTOM_FONTCONFIG: use a custom name/path to the libfontconfig library. Useful for static linking bjarni@5560: # 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: # bjarni@3085: # UNIVERSAL_BINARY: builds a universal binary for OSX. Make sure you got both PPC and x86 libs. Only works with GCC 4 or newer bjarni@3212: # TRIPLE_BINARY: builds a universal binary with the addition of code optimised for G5 (which means a total of 3 binaries in one file) bjarni@3354: # OTTD_PPC, OTTD_PPC970, OTTD_i386: compile for target architecture. bjarni@3354: # Multiple flags can be used so OTTD_PPC:=1 OTTD_i386:=1 produces the same result as UNIVERSAL_BINARY bjarni@2834: # bjarni@2719: # ENDIAN_FORCE: forces the endian-check to give a certain result. Can be BE, LE or PREPROCESSOR. bjarni@2719: # PREPROCESSOR is always used on all OSX targets and will make the preprocessor pick the right endian. bjarni@2719: # this means that you don't have to think about endianess when compiling for OSX. bjarni@2719: # Very useful for universal binaries and crosscompilers. Not sure if it works on non OSX targets 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@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 bjarni@3354: MAKEFILE_VERSION:=10 bjarni@180: 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: bjarni@1955: pasky@1492: # updates Makefile.config if it's outdated bjarni@180: ifneq ($(MAKEFILE_VERSION),$(CONFIG_VERSION)) 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: bjarni@2722: ifdef OSX truelight@3901: -include os/macosx/Makefile.setup bjarni@2722: endif bjarni@2722: 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@2736: ifdef WITH_COCOA bjarni@2736: ifdef WITH_SDL bjarni@2736: $(error You can not use both the SDL video driver and the Cocoa video driver at the same time) bjarni@2736: endif bjarni@2736: ifdef DEDICATED bjarni@2736: $(error You can not use the Cocoa video driver in a dedicated server) bjarni@2736: endif bjarni@2736: else 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@2736: endif bjarni@549: bjarni@1029: # remove the dependancy for sdl if DEDICALTED is used bjarni@1029: ifdef DEDICATED Darkvater@2779: WITH_SDL:= Darkvater@2779: endif Darkvater@2779: Darkvater@2779: # add -lpthread to LDFLAGS truelight@2298: ifndef WIN32 Darkvater@2779: ifndef MORPHOS Darkvater@2779: ifndef OSX Darkvater@2779: LDFLAGS+=-lpthread Darkvater@2779: endif Darkvater@2779: endif bjarni@1029: endif Darkvater@2779: truelight@2300: ifdef OSX Darkvater@2779: LDFLAGS+=-framework Cocoa truelight@2300: endif truelight@0: bjarni@3380: ifdef WITH_SDL peter1138@3406: ifndef SDL_CONFIG peter1138@3406: $(error WITH_SDL can't be used when SDL_CONFIG is not set. Edit Makefile.config to correct this) bjarni@3380: endif bjarni@3380: endif bjarni@3380: bjarni@3380: ifdef WITH_PNG peter1138@3406: ifndef LIBPNG_CONFIG peter1138@3406: $(error WITH_PNG can't be used when LIBPNG_CONFIG is not set. Edit Makefile.config to correct this) bjarni@3380: endif bjarni@3380: endif truelight@0: peter1138@5108: ifdef WITH_FREETYPE peter1138@5108: ifndef FREETYPE_CONFIG peter1138@5108: $(error WITH_FREETYPE can't be used when FREETYPE_CONFIG is not set. Edit Makefile.config to correct this) peter1138@5108: endif peter1138@5108: endif peter1138@5108: rubidium@5117: ifdef WITH_FONTCONFIG rubidium@5117: ifndef FONTCONFIG_CONFIG rubidium@5117: $(error WITH_FONTCONFIG can't be used when FONTOCNFIG_CONFIG is not set. Edit Makefile.config to correct this) rubidium@5117: endif rubidium@5117: endif rubidium@5117: truelight@0: ############################################################################## truelight@0: # truelight@0: # Compiler configuration truelight@0: # truelight@0: truelight@0: # Executable file extension truelight@0: ifdef WIN32 Darkvater@5305: EXE=.exe truelight@0: else Darkvater@5305: ifdef OS2 Darkvater@5305: EXE=.exe Darkvater@5305: else Darkvater@5305: EXE= Darkvater@5305: endif 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: ifdef RELEASE truelight@0: REV:=$(RELEASE) truelight@0: else peter1138@3994: ifeq ($(shell if test -d .svn; then echo 1; fi), 1) truelight@4135: REV_MODIFIED := $(shell svnversion . | sed -n 's/.*\(M\).*/\1/p' ) peter1138@3994: REV := $(shell LC_ALL=C svn info | awk '/^URL:.*branch/ { BRANCH="-"a[split($$2, a, "/")] } /^Last Changed Rev:/ { REV="r"$$4"$(REV_MODIFIED)" } END { print REV BRANCH }') peter1138@3994: endif truelight@0: endif truelight@0: KUDr@3900: # define flag to use for -lrt (some OSes overwrites this later for compatibility) KUDr@3900: ifndef LRT KUDr@3900: ifndef MORPHOS KUDr@3900: LRT:= -lrt KUDr@3900: endif KUDr@3900: endif KUDr@3900: truelight@0: # MorphOS needs builddate tron@1289: BUILDDATE=`date +%d.%m.%y` truelight@0: TrueLight@1692: # Check if there is a windres override TrueLight@1692: ifndef WINDRES TrueLight@1692: WINDRES = windres TrueLight@1692: endif TrueLight@1692: KUDr@3900: # Check that CXX is defined. If not, then it's g++ KUDr@3900: ifndef CXX KUDr@3900: CXX = g++ KUDr@3900: endif KUDr@3900: KUDr@3900: # Check if CXX_HOST is defined. If not, it is CXX KUDr@3900: ifndef CXX_HOST KUDr@3900: CXX_HOST = $(CXX) KUDr@3900: endif KUDr@3900: KUDr@3900: # Check if we have a new target peter1138@4094: ifndef CXX_TARGET peter1138@4094: CXX_TARGET = $(CXX_HOST) KUDr@3900: endif KUDr@3900: 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 peter1138@4094: TrueLight@1692: ifndef CFLAGS_HOST TrueLight@1692: CFLAGS_HOST = $(BASECFLAGS) TrueLight@1692: endif truelight@0: bjarni@3141: # Check if we have a new target peter1138@4094: ifndef CC_TARGET peter1138@4094: CC_TARGET = $(CC_HOST) bjarni@3141: endif truelight@0: truelight@4113: CC_VERSION = $(shell $(CC_TARGET) -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@2240: ifeq ($(shell expr $(CC_VERSION) \>= 29), 1) KUDr@3900: CFLAGS += -O -Wall -Wno-multichar -Wsign-compare -Wundef KUDr@3900: CC_CFLAGS += -Wstrict-prototypes tron@1324: CFLAGS += -Wwrite-strings -Wpointer-arith tron@1052: endif tron@2240: ifeq ($(shell expr $(CC_VERSION) \>= 30), 1) tron@1052: CFLAGS += -W -Wno-unused-parameter tron@1052: endif tron@2240: ifeq ($(shell expr $(CC_VERSION) \>= 34), 1) KUDr@3900: CC_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 bjarni@3031: ifdef OSX bjarni@3031: # Shark (Xcode's profiling tool) needs -g to relate CPU usage to line numbers in the source code bjarni@3031: BASECFLAGS += -g bjarni@3031: endif 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 bjarni@3907: ifdef OSX bjarni@3907: # it appears that OSX can't handle automated stripping when mixing C and C++ bjarni@3907: # we will do it manually in the target OSX_STRIP bjarni@3907: OSX_STRIP:=OSX_STRIP bjarni@3907: else truelight@0: LDFLAGS += -s truelight@0: endif truelight@0: endif Darkvater@1810: endif bjarni@3907: 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 bjarni@2713: 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 truelight@0: else truelight@0: ifdef MORPHOS tron@2356: BASECFLAGS += -I/gg/os-include -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 KUDr@3900: # -lrt fails with MINGW, so we disable it KUDr@3900: LRT:= truelight@0: endif truelight@0: endif truelight@0: truelight@0: CFLAGS += $(BASECFLAGS) truelight@0: truelight@0: ifdef UNIX truelight@0: CDEFS += -DUNIX truelight@0: endif truelight@0: tron@421: ifdef BEOS tron@421: CDEFS += -DBEOS bjarni@2497: LDFLAGS += -lmidi -lbe -lpthread tron@421: ifdef WITH_NETWORK tron@421: ifdef BEOS_NET_SERVER tron@1051: CDEFS += -DBEOS_NET_SERVER bjarni@2497: LDFLAGS += -lnet tron@1051: else bjarni@2497: # BONE 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 KUDr@3900: # and it also uses 4-byte bools in the C++ ABI, so C bools need to be that size as well for YAPF to work KUDr@3900: CFLAGS += -Wno-strict-prototypes -DFOUR_BYTE_BOOL 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: bjarni@2500: # tell the source that we are building a dedicated server bjarni@2500: ifdef DEDICATED bjarni@2500: CDEFS += -DDEDICATED bjarni@2500: endif bjarni@2500: truelight@0: # SDL config truelight@0: ifdef WITH_SDL truelight@0: CDEFS += -DWITH_SDL tron@5050: CCFLAGS_SDL := $(shell $(SDL_CONFIG) --cflags) tron@5050: CFLAGS += $(CCFLAGS_SDL) truelight@0: ifdef STATIC tron@5050: LDFLAGS_SDL := $(shell $(SDL_CONFIG) --static-libs) truelight@0: else tron@5050: LDFLAGS_SDL := $(shell $(SDL_CONFIG) --libs) truelight@0: endif tron@5050: LIBS += $(LDFLAGS_SDL) truelight@0: endif truelight@0: truelight@0: # zlib config truelight@0: ifdef WITH_ZLIB bjarni@3389: CDEFS += -DWITH_ZLIB bjarni@3389: ifdef STATIC bjarni@3389: ifdef OSX bjarni@3389: # OSX links dynamically to zlib, even in static builds since it's always present in the system bjarni@3389: LIBS += -lz bjarni@3389: else bjarni@3389: LIBS += $(STATIC_ZLIB_PATH) bjarni@3389: endif bjarni@3389: else bjarni@3389: LIBS += -lz bjarni@3389: endif truelight@0: endif truelight@0: truelight@0: # libpng config truelight@0: ifdef WITH_PNG truelight@0: CDEFS += -DWITH_PNG tron@5051: CCFLAGS_PNG := $(shell $(LIBPNG_CONFIG) --cppflags --I_opts) tron@5051: CFLAGS += $(CCFLAGS_PNG) 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 tron@5051: LDFLAGS_PNG := $(shell $(LIBPNG_CONFIG) --prefix)/lib/libpng.a bjarni@583: else tron@5051: LDFLAGS_PNG := $(shell $(LIBPNG_CONFIG) --static $(PNGCONFIG_FLAGS)) bjarni@583: endif truelight@0: else tron@5051: LDFLAGS_PNG := $(shell $(LIBPNG_CONFIG) --L_opts $(PNGCONFIG_FLAGS)) truelight@0: endif tron@5051: LIBS += $(LDFLAGS_PNG) truelight@0: endif truelight@0: KUDr@3900: # use std C++ lib: KUDr@3900: LIBS += -lstdc++ KUDr@3900: ifndef MINGW KUDr@3900: LIBS += -lc KUDr@3900: endif KUDr@3900: peter1138@5108: # freetype config peter1138@5108: ifdef WITH_FREETYPE peter1138@5108: CDEFS += -DWITH_FREETYPE peter1138@5108: CCFLAGS_FREETYPE := $(shell $(FREETYPE_CONFIG) --cflags) peter1138@5108: LDFLAGS_FREETYPE := $(shell $(FREETYPE_CONFIG) --libs) peter1138@5108: CFLAGS += $(CCFLAGS_FREETYPE) peter1138@5108: LIBS += $(LDFLAGS_FREETYPE) peter1138@5108: endif peter1138@5108: rubidium@5117: # fontconfig config rubidium@5117: ifdef WITH_FONTCONFIG rubidium@5117: CDEFS += -DWITH_FONTCONFIG rubidium@5117: CCFLAGS_FONTCONFIG := $(shell $(FONTCONFIG_CONFIG) --cflags) rubidium@5117: LDFLAGS_FONTCONFIG := $(shell $(FONTCONFIG_CONFIG) --libs) bjarni@5560: bjarni@5560: ifdef CUSTOM_FONTCONFIG bjarni@5560: # To allow usage of non-default libs, such as absolute path to static libs bjarni@5560: # not stored in Makefile.config bjarni@5560: LDFLAGS_FONTCONFIG := $(CUSTOM_FONTCONFIG) bjarni@5560: endif bjarni@5560: rubidium@5117: CFLAGS += $(CCFLAGS_FONTCONFIG) rubidium@5117: LIBS += $(LDFLAGS_FONTCONFIG) rubidium@5117: endif rubidium@5117: Darkvater@3409: # iconv is enabled defaultly on OSX >= 10.3 tron@3313: ifdef OSX bjarni@5586: WITH_ICONV=1 bjarni@5586: LIBS += -liconv tron@3313: endif Darkvater@3408: Darkvater@3408: ifdef WITH_ICONV Darkvater@3408: CDEFS += -DWITH_ICONV Darkvater@3408: ifdef WITH_ICONV_PATH Darkvater@3408: CFLAGS += -I$(WITH_ICONV_PATH) Darkvater@3408: endif bjarni@3294: endif bjarni@3260: bjarni@347: # enables/disables assert() bjarni@348: ifdef DISABLE_ASSERTS bjarni@348: CFLAGS += -DNDEBUG bjarni@348: endif bjarni@348: truelight@4324: ifdef NO_THREADS truelight@4324: CFLAGS += -DNO_THREADS truelight@4324: endif truelight@4324: 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: bjarni@2555: # OSX specific setup truelight@0: ifdef OSX bjarni@2719: # set the endian flag for OSX, that can't fail bjarni@2719: ENDIAN_FORCE:=PREPROCESSOR bjarni@2719: KUDr@3900: # -lrt fails on OSX, so we disable it KUDr@3900: LRT:= KUDr@3900: bjarni@2555: ifndef DEDICATED bjarni@2555: LIBS += -framework QuickTime bjarni@2555: endif bjarni@2555: bjarni@2736: ifdef WITH_COCOA bjarni@2736: CDEFS += -DWITH_COCOA bjarni@2736: LIBS += -F/System/Library/Frameworks -framework Cocoa -framework Carbon -framework AudioUnit bjarni@2736: endif bjarni@2736: bjarni@2555: # OSX path setup bjarni@2555: ifndef SECOND_DATA_PATH bjarni@2555: SECOND_DATA_PATH:="$(OSXAPP)/Contents/Data/" bjarni@2555: endif bjarni@2555: bjarni@2555: ifndef CUSTOM_LANG_DIR bjarni@2555: ifndef DEDICATED bjarni@2555: CUSTOM_LANG_DIR:="$(OSXAPP)/Contents/Lang/" bjarni@2555: endif bjarni@2555: endif bjarni@2500: 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: 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) matthijs@2901: ICON_DIR_PREFIXED:=$(PREFIX)/$(ICON_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) matthijs@2901: ICON_DIR_INSTALL=$(DEST_DIR)/$(ICON_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 Darkvater@4256: Darkvater@4256: ifdef ICON_DIR Darkvater@4256: CDEFS += -DICON_DIR=\"$(ICON_DIR_PREFIXED)/\" Darkvater@4256: 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: bjarni@2713: # clean up C_SOURCES first. Needed since building universal binaries on OSX calls the makefile recursively (just one time) tron@2735: SRCS := bjarni@2713: tron@2735: SRCS += aircraft_cmd.c tron@2735: SRCS += aircraft_gui.c tron@2735: SRCS += airport.c tron@2735: SRCS += airport_gui.c tron@2735: SRCS += aystar.c truelight@4300: SRCS += bmp.c celestar@5595: SRCS += bridge_cmd.c tron@2735: SRCS += bridge_gui.c tron@3214: SRCS += bridge_map.c bjarni@4800: SRCS += build_vehicle_gui.c tron@2735: SRCS += callback_table.c tron@2735: SRCS += clear_cmd.c tron@2735: SRCS += command.c tron@2735: SRCS += console.c tron@2735: SRCS += console_cmds.c tron@2735: SRCS += currency.c rubidium@4261: SRCS += date.c tron@2735: SRCS += debug.c tron@2735: SRCS += dedicated.c tron@2735: SRCS += depot.c bjarni@4638: SRCS += depot_gui.c tron@2735: SRCS += disaster_cmd.c tron@2735: SRCS += dock_gui.c tron@2735: SRCS += driver.c tron@2735: SRCS += dummy_land.c tron@2735: SRCS += economy.c celestar@3355: SRCS += elrail.c tron@2735: SRCS += engine.c tron@2735: SRCS += engine_gui.c tron@2735: SRCS += fileio.c Darkvater@4220: SRCS += fios.c peter1138@5108: SRCS += fontcache.c truelight@4300: SRCS += genworld.c truelight@4300: SRCS += genworld_gui.c tron@2735: SRCS += gfx.c tron@2735: SRCS += gfxinit.c tron@2735: SRCS += graph_gui.c truelight@4300: SRCS += heightmap.c KUDr@5187: SRCS += helpers.cpp tron@2735: SRCS += industry_cmd.c tron@2735: SRCS += industry_gui.c tron@2735: SRCS += intro_gui.c tron@2735: SRCS += landscape.c tron@2735: SRCS += main_gui.c tron@2735: SRCS += map.c tron@2735: SRCS += md5.c tron@2735: SRCS += mersenne.c tron@2735: SRCS += minilzo.c tron@2735: SRCS += misc.c tron@2735: SRCS += misc_cmd.c tron@2735: SRCS += misc_gui.c tron@2735: SRCS += mixer.c belugas@4120: SRCS += music.c tron@2735: SRCS += music_gui.c tron@2735: SRCS += namegen.c tron@2735: SRCS += network.c tron@2735: SRCS += network_client.c tron@2735: SRCS += network_data.c tron@2735: SRCS += network_gamelist.c tron@2735: SRCS += network_gui.c tron@2735: SRCS += network_server.c tron@2735: SRCS += network_udp.c tron@2735: SRCS += newgrf.c belugas@3866: SRCS += newgrf_cargo.c peter1138@5228: SRCS += newgrf_config.c peter1138@2962: SRCS += newgrf_engine.c peter1138@5237: SRCS += newgrf_gui.c peter1138@4656: SRCS += newgrf_sound.c peter1138@3595: SRCS += newgrf_spritegroup.c peter1138@2963: SRCS += newgrf_station.c belugas@3601: SRCS += newgrf_text.c tron@2735: SRCS += news_gui.c tron@2735: SRCS += npf.c tron@2735: SRCS += oldloader.c matthijs@5216: SRCS += oldpool.c tron@2735: SRCS += openttd.c tron@2735: SRCS += order_cmd.c tron@2735: SRCS += order_gui.c Darkvater@3341: SRCS += os_timer.c tron@2735: SRCS += pathfind.c tron@2735: SRCS += player_gui.c tron@2735: SRCS += players.c tron@2735: SRCS += queue.c tron@2735: SRCS += rail.c tron@2735: SRCS += rail_cmd.c tron@2735: SRCS += rail_gui.c tron@2735: SRCS += rev.c tron@2735: SRCS += road_cmd.c tron@2735: SRCS += road_gui.c tron@3146: SRCS += road_map.c tron@2735: SRCS += roadveh_cmd.c tron@2735: SRCS += roadveh_gui.c tron@2735: SRCS += saveload.c tron@2735: SRCS += screenshot.c tron@2735: SRCS += settings.c tron@2735: SRCS += settings_gui.c tron@2735: SRCS += ship_cmd.c tron@2735: SRCS += ship_gui.c tron@2735: SRCS += signs.c tron@2735: SRCS += smallmap_gui.c tron@2735: SRCS += sound.c tron@2735: SRCS += spritecache.c tron@2735: SRCS += station_cmd.c tron@2735: SRCS += station_gui.c celestar@3334: SRCS += station_map.c tron@2735: SRCS += string.c tron@2735: SRCS += strings.c tron@2735: SRCS += subsidy_gui.c tron@2735: SRCS += terraform_gui.c tron@2735: SRCS += texteff.c truelight@4300: SRCS += tgp.c tron@2735: SRCS += thread.c tron@2735: SRCS += tile.c tron@2735: SRCS += town_cmd.c tron@2735: SRCS += town_gui.c tron@2735: SRCS += train_cmd.c tron@2735: SRCS += train_gui.c tron@2735: SRCS += tree_cmd.c tron@3154: SRCS += tunnel_map.c celestar@5594: SRCS += tunnel_cmd.c tron@2735: SRCS += unmovable_cmd.c tron@2735: SRCS += vehicle.c tron@2735: SRCS += vehicle_gui.c tron@2735: SRCS += viewport.c tron@2735: SRCS += water_cmd.c tron@2735: SRCS += waypoint.c tron@2735: SRCS += widget.c tron@2735: SRCS += window.c tron@2735: SRCS += music/null_m.c tron@2735: SRCS += sound/null_s.c tron@2735: SRCS += video/dedicated_v.c tron@2735: SRCS += video/null_v.c KUDr@3900: SRCS += yapf/follow_track.cpp KUDr@3900: SRCS += yapf/yapf_common.cpp KUDr@3900: SRCS += yapf/yapf_rail.cpp KUDr@3900: SRCS += yapf/yapf_road.cpp KUDr@3900: SRCS += yapf/yapf_ship.cpp tron@677: truelight@2395: # AI related files tron@2735: SRCS += ai/ai.c tron@2735: SRCS += ai/default/default.c tron@2735: SRCS += ai/trolly/build.c tron@2735: SRCS += ai/trolly/pathfinder.c tron@2735: SRCS += ai/trolly/shared.c tron@2735: SRCS += ai/trolly/trolly.c bjarni@2188: Darkvater@1829: ifdef WITH_SDL tron@2735: SRCS += sdl.c tron@2735: SRCS += sound/sdl_s.c tron@2735: SRCS += video/sdl_v.c Darkvater@1829: endif Darkvater@1829: truelight@0: ifdef WIN32 tron@2735: SRCS += win32.c tron@2735: SRCS += music/win32_m.c tron@2735: SRCS += sound/win32_s.c tron@2735: SRCS += video/win32_v.c truelight@0: else tron@2735: SRCS += unix.c tron@2735: SRCS += music/extmidi.c truelight@0: endif truelight@0: bjarni@2188: ifdef OSX bjarni@2736: SRCS += os/macosx/macos.m bjarni@2736: ifndef DEDICATED bjarni@2736: SRCS += music/qtmidi.c bjarni@2736: endif bjarni@2736: ifdef WITH_COCOA bjarni@2736: SRCS += video/cocoa_v.m bjarni@2736: SRCS += sound/cocoa_s.c bjarni@2736: SRCS += os/macosx/splash.c bjarni@2736: endif bjarni@2500: endif bjarni@2188: tron@421: ifdef BEOS tron@2735: SRCS += music/bemidi.cpp tron@421: endif truelight@0: truelight@0: ifdef WIN32 tron@2742: SRCS += ottdres.rc truelight@0: endif truelight@0: truelight@0: ifdef WITH_DIRECTMUSIC tron@2735: SRCS += music/dmusic.cpp truelight@0: endif truelight@0: tron@2735: OBJS += $(filter %.o, $(SRCS:%.cpp=%.o) $(SRCS:%.m=%.o) $(SRCS:%.c=%.o) $(SRCS:%.rc=%.o)) 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: tron@2369: # If we are verbose, we will show commands prefixed by $(Q). tron@2369: # The $(Q)s get replaced by @ in non-verbose mode. pasky@1413: # Inspired by the Linux kernel build system. pasky@1413: ifdef VERBOSE pasky@1413: Q = pasky@1413: else pasky@1413: Q = @ pasky@1413: endif pasky@1413: 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 bjarni@2713: # needs to be before all truelight@0: OSX:=OSX truelight@0: endif truelight@0: truelight@0: truelight@3903: all: endian_target.h endian_host.h $(UPDATECONFIG) $(LANGS) $(TTD) $(OSX) truelight@0: bjarni@2714: ifdef OSX bjarni@2714: -include os/macosx/Makefile bjarni@2714: endif bjarni@2714: 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@2315: @echo '===> Compiling and Linking $@' tron@2315: $(Q)$(CC_HOST) $(CFLAGS_HOST) $(CDEFS) $< -o $@ darkvater@222: truelight@0: truelight@3901: ifndef MACOSX_BUILD bjarni@3354: # OSX links in os/macosx/Makefile to handle universal binaries better tron@2315: $(TTD): $(OBJS) $(MAKE_CONFIG) tron@2315: @echo '===> Linking $@' peter1138@4094: $(Q)$(CXX_TARGET) $(LDFLAGS) $(TTDLDFLAGS) $(OBJS) $(LIBS) -o $@ bjarni@3354: endif truelight@0: peter1138@5108: $(STRGEN): strgen/strgen.c string.c endian_host.h table/control_codes.h tron@2315: @echo '===> Compiling and Linking $@' truelight@4370: $(Q)$(CC_HOST) $(CFLAGS_HOST) -DSTRGEN strgen/strgen.c string.c -o $@ truelight@0: tron@474: table/strings.h: lang/english.txt $(STRGEN) tron@1118: @echo '===> Generating $@' truelight@4370: $(Q)$(STRGEN) -s lang -d table darkvater@222: tron@476: lang/%.lng: lang/%.txt $(STRGEN) lang/english.txt tron@1118: @echo '===> Compiling language $(*F)' truelight@4370: $(Q)$(STRGEN) $(STRGEN_FLAGS) -s lang -d lang $< $(LANG_ERRORS) || rm -f $@ truelight@0: bjarni@770: ifdef MORPHOS KUDr@3900: 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" Darkvater@5551: $(Q)mkdir -p "/t/openttd-$(RELEASE)-morphos/scenario/heightmap" 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/" Darkvater@5551: $(Q)-cp scenario/*.scn "/t/openttd-$(RELEASE)-morphos/scenario/" Darkvater@5551: $(Q)-cp scenario/heightmap/* "/t/openttd-$(RELEASE)-morphos/scenario/heightmap/" 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" Darkvater@5551: $(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: 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: @# some additions for MorphOS versions tag truelight@0: @echo '#ifdef __MORPHOS__' >>rev.c.new Darkvater@2378: @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 glx@4562: $(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) .OSX 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 \ matthijs@2948: $(ICON_DIR_INSTALL) \ pasky@1491: $(BINARY_DIR_INSTALL) matthijs@1865: ifndef USE_HOMEDIR matthijs@1865: mkdir -p $(PERSONAL_DIR)/scenario rubidium@4374: mkdir -p $(PERSONAL_DIR)/scenario/heightmap matthijs@1865: else matthijs@1865: mkdir -p $(DATA_DIR_INSTALL)/scenario rubidium@4374: mkdir -p $(DATA_DIR_INSTALL)/scenario/heightmap 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 matthijs@2901: install -m 644 media/openttd.64.png $(ICON_DIR_INSTALL) matthijs@2901: install -m 644 media/openttd.32.xpm $(ICON_DIR_INSTALL) 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@2576: .PHONY: clean all $(OSX) install 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. tron@2792: DEPS_MAGIC := $(shell mkdir -p $(sort $(dir $(DEPS)))) tron@2792: tron@2792: depend: tron@2792: @true # The include handles this automagically truelight@0: truelight@0: # Introduce the dependencies glx@4562: ifeq ($(findstring $(MAKECMDGOALS), clean info mrproper upgradeconf $(MAKE_CONFIG)),) tron@1167: -include $(DEPS) tron@2315: endif truelight@0: tron@2792: # Silence stale header dependency errors tron@2792: %.h: tron@2792: @true tron@1170: tron@2327: .deps/%.d: %.c $(MAKE_CONFIG) table/strings.h endian_target.h tron@2792: @echo '===> DEP $<' peter1138@4094: $(Q)$(CC_TARGET) $(CFLAGS) $(CDEFS) -MM $< | sed 's#^$(@F:%.d=%.o):#$@ $(@:.deps/%.d=%.o):#' > $@ bjarni@2188: tron@2327: .deps/%.d: %.cpp $(MAKE_CONFIG) table/strings.h endian_target.h tron@2792: @echo '===> DEP $<' peter1138@4094: $(Q)$(CXX_TARGET) $(CFLAGS) $(CDEFS) -MM $< | sed 's#^$(@F:%.d=%.o):#$@ $(@:.deps/%.d=%.o):#' > $@ tron@2315: tron@2327: .deps/%.d: %.m $(MAKE_CONFIG) table/strings.h endian_target.h tron@2792: @echo '===> DEP $<' peter1138@4094: $(Q)$(CC_TARGET) $(OBJCFLAGS) $(CDEFS) -MM $< | sed 's#^$(@F:%.d=%.o):#$@ $(@:.deps/%.d=%.o):#' > $@ tron@2315: tron@2315: truelight@3901: ifndef MACOSX_BUILD bjarni@3354: # OSX uses os/macosx/Makefile to compile files tron@2315: %.o: %.c $(MAKE_CONFIG) tron@2315: @echo '===> Compiling $<' peter1138@4094: $(Q)$(CC_TARGET) $(CC_CFLAGS) $(CFLAGS) $(CDEFS) -c -o $@ $< tron@2315: tron@2315: %.o: %.cpp $(MAKE_CONFIG) tron@2315: @echo '===> Compiling $<' peter1138@4094: $(Q)$(CXX_TARGET) $(CFLAGS) $(CDEFS) -c -o $@ $< tron@2315: tron@2315: %.o: %.m $(MAKE_CONFIG) tron@2315: @echo '===> Compiling $<' peter1138@4094: $(Q)$(CC_TARGET) $(CC_CFLAGS) $(CFLAGS) $(CDEFS) -c -o $@ $< bjarni@3211: endif tron@1163: tron@2742: %.o: %.rc tron@2742: @echo '===> Compiling resource $<' tron@2742: $(Q)$(WINDRES) -o $@ $< tron@2742: tron@1163: tron@1163: info: tron@1435: @echo 'CFLAGS = $(CFLAGS)' tron@1163: @echo 'LDFLAGS = $(LDFLAGS)' tron@1163: @echo 'LIBS = $(LIBS)' tron@2327: @echo 'CDEFS = $(CDEFS)'