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 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 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: # DISPLAY_WARNINGS: when off, some errors are not displayed while compiling 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 truelight@0: # MIDI: if set, it will use it as custom path to midi player. truelight@0: # If unset, it will use the hardcoded path in the c code bjarni@162: # NOVERBOSE: supress all warnings and errors during compilation. bjarni@162: # It looks nicer, but you will not know what went wrong. Use it on released (stable) sources only truelight@0: # truelight@0: # DATA_DIR_PREFIX: This sets the dir OpenTTD looks for the needed files. truelight@0: # MUST END WITH / if defined 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: # truelight@0: # Experimental (does not work properly): truelight@0: # WITH_NETWORK: enable networking truelight@0: # WITH_DIRECTMUSIC: enable DirectMusic MIDI support truelight@0: truelight@0: truelight@0: ############################################################################## truelight@0: # truelight@0: # Configuration truelight@0: # truelight@0: bjarni@180: # Makefile version tag bjarni@180: # it checks if the version tag in makefile.config is the same and force update outdated config files bjarni@180: MAKEFILE_VERSION:=1 bjarni@180: truelight@0: # CONFIG_WRITER have 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@180: # 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 truelight@0: 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 truelight@0: endif truelight@0: bjarni@219: # this is used if there aren't any makefile.config truelight@0: ifndef CONFIG_INCLUDED bjarni@219: ENABLE_NETWORK:=1 # sets network on by default if there aren't any config file truelight@0: -include $(LIB_DETECTION) truelight@0: endif truelight@0: bjarni@162: # Verbose filter bjarni@162: bjarni@162: ifdef NOVERBOSE bjarni@162: VERBOSE_FILTER = >/dev/null 2>&1 bjarni@162: else bjarni@162: VERBOSE_FILTER = bjarni@162: endif bjarni@162: truelight@0: ifdef DISPLAY_WARNINGS truelight@0: WARNING_DISPLAY:=-fstrict-aliasing bjarni@162: VERBOSE_FILTER = truelight@0: else truelight@0: WARNING_DISPLAY:=-fno-strict-aliasing truelight@0: endif truelight@0: bjarni@180: ifdef SUPRESS_LANG_ERRORS bjarni@180: ifndef VERBOSE_FILTER bjarni@180: LANG_ERRORS = >/dev/null 2>&1 bjarni@180: endif 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 truelight@0: $(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: truelight@0: truelight@0: # Force SDL on UNIX platforms truelight@0: ifndef WITH_SDL truelight@0: ifdef UNIX truelight@0: $(error You need to have SDL installed in order to run OpenTTD on UNIX.) truelight@0: endif truelight@0: endif truelight@0: truelight@0: truelight@0: truelight@0: ############################################################################## truelight@0: # truelight@0: # Compiler configuration truelight@0: # truelight@0: CC=gcc truelight@0: CXX=g++ truelight@0: truelight@0: ifdef MORPHOS truelight@0: CC += -noixemul -pipe truelight@0: CXX += -noixemul -pipe truelight@0: endif 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 truelight@0: REV := $(shell if test -d .svn; then echo -n r; svnversion .; 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 truelight@0: 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@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: truelight@0: CFLAGS=-Wall -Wno-multichar truelight@0: CDEFS=-DWITH_REV truelight@0: LDFLAGS= truelight@0: LIBS= truelight@0: truelight@0: ifdef DEBUG truelight@0: # Debug mode truelight@0: CDEFS += -D_DEBUG truelight@0: BASECFLAGS += -g truelight@0: else truelight@0: ifdef PROFILE truelight@0: BASECFLAGS += -pg truelight@0: else truelight@0: # Release mode truelight@0: ifndef MORPHOS truelight@0: # automatical strip breaks under morphos truelight@0: BASECFLAGS += -s truelight@0: LDFLAGS += -s truelight@0: endif truelight@0: 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 truelight@0: 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 $(WARNING_DISPLAY) truelight@0: else truelight@0: ifdef MORPHOS truelight@0: BASECFLAGS += -O2 -funroll-loops -fexpensive-optimizations -mstring -mmultiple $(WARNING_DISPLAY) truelight@0: else truelight@0: BASECFLAGS += -O2 $(WARNING_DISPLAY) truelight@0: endif truelight@0: ifndef PROFILE truelight@0: BASECFLAGS += -fomit-frame-pointer truelight@0: endif truelight@0: endif truelight@0: 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: truelight@0: # If building on Cygwin/MingW don't link with Cygwin libs truelight@0: ifdef WIN32 truelight@0: ifdef MINGW truelight@0: ifdef CYGWIN truelight@0: BASECFLAGS += -mno-cygwin truelight@0: LDFLAGS += -mno-cygwin truelight@0: endif 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: truelight@0: # SDL config truelight@0: ifdef WITH_SDL truelight@0: CDEFS += -DWITH_SDL truelight@0: CFLAGS += `$(SDL-CONFIG) --cflags` truelight@0: ifdef STATIC truelight@0: LIBS += `$(SDL-CONFIG) --static-libs` truelight@0: else truelight@0: LIBS += `$(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 truelight@0: # 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 truelight@0: # FreeBSD doesn't use libpng-config truelight@0: ifdef FREEBSD truelight@0: LIBS += -lpng truelight@0: else truelight@0: CFLAGS += `libpng-config --cflags` truelight@0: ifdef OSX truelight@0: ifdef STATIC truelight@0: # Seems like we need a tiny hack for OSX static to work truelight@0: LIBS += `libpng-config --prefix`/lib/libpng.a truelight@0: else truelight@0: LIBS += `libpng-config --libs` truelight@0: endif truelight@0: else truelight@0: # seems like older libpng versions are broken and need this truelight@0: PNGCONFIG_FLAGS = --ldflags --libs truelight@0: ifdef STATIC truelight@0: LIBS += `libpng-config --static $(PNGCONFIG_FLAGS)` truelight@0: else truelight@0: LIBS += `libpng-config $(PNGCONFIG_FLAGS)` truelight@0: endif truelight@0: endif truelight@0: endif truelight@0: endif truelight@0: 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: # file paths setup truelight@0: ifdef GAME_DATA_DIR truelight@0: CDEFS += -DGAME_DATA_DIR=\"$(GAME_DATA_DIR)\" truelight@0: endif truelight@0: truelight@0: ifdef PERSONAL_DIR truelight@0: CDEFS += -DPERSONAL_DIR=\"$(PERSONAL_DIR)\" truelight@0: endif truelight@0: truelight@0: ifdef USE_HOMEDIR truelight@0: CDEFS += -DUSE_HOMEDIR truelight@0: endif truelight@0: truelight@0: # MIDI setup truelight@0: ifdef OSX truelight@0: ifndef MIDI truelight@0: MIDI:=$(OSXAPP)/contents/macos/track_starter truelight@0: 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: # Experimental truelight@0: ifdef WITH_NETWORK truelight@0: CDEFS += -DENABLE_NETWORK 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: truelight@0: ifdef WITH_DIRECTMUSIC truelight@0: CDEFS += -DWIN32_ENABLE_DIRECTMUSIC_SUPPORT truelight@0: endif truelight@0: truelight@0: ifdef WIN32 truelight@0: LIBS += -lws2_32 -lwinmm -lgdi32 -ldxguid -lole32 -lstdc++ truelight@0: TTDLDFLAGS += -Wl,--subsystem,windows truelight@0: endif truelight@0: truelight@0: # sets up the paths for use for make install truelight@0: ifdef BINARY_DIR truelight@0: BINARY_INSTALL:=$(BINARY_DIR)$(TTD) truelight@0: else truelight@0: BINARY_INSTALL:=$(INSTALL_DIR)$(TTD) truelight@0: endif truelight@0: ifdef DATA_DIR_PREFIX truelight@0: DATA_DIR:=$(DATA_DIR_PREFIX) truelight@0: else truelight@0: DATA_DIR:=$(INSTALL_DIR) 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@0: ttd_SOURCES = \ truelight@112: ai.c ai_build.c ai_new.c ai_pathfinder.c ai_shared.c aircraft_cmd.c \ truelight@112: aircraft_gui.c airport.c airport_gui.c aystar.c bridge_gui.c \ signde@221: clear_cmd.c command.c console.c console_cmds.c disaster_cmd.c dock_gui.c dummy_land.c economy.c \ truelight@112: engine.c engine_gui.c fileio.c gfx.c graph_gui.c grfspecial.c \ truelight@112: industry_cmd.c industry_gui.c intro_gui.c landscape.c main_gui.c \ truelight@112: minilzo.c misc.c misc_cmd.c misc_gui.c music_gui.c namegen.c network.c \ truelight@112: network_gui.c news_gui.c oldloader.c order_cmd.c order_gui.c \ truelight@112: pathfind.c player_gui.c players.c queue.c rail_cmd.c rail_gui.c rev.c \ truelight@112: road_cmd.c road_gui.c roadveh_cmd.c roadveh_gui.c saveload.c \ truelight@112: screenshot.c settings.c settings_gui.c ship_cmd.c ship_gui.c \ truelight@112: smallmap_gui.c sound.c spritecache.c station_cmd.c station_gui.c \ truelight@112: strings.c subsidy_gui.c terraform_gui.c texteff.c town_cmd.c \ truelight@112: town_gui.c train_cmd.c train_gui.c tree_cmd.c ttd.c tunnelbridge_cmd.c \ darkvater@164: unmovable_cmd.c vehicle.c vehicle_gui.c viewport.c water_cmd.c widget.c window.c \ truelight@0: truelight@0: ifdef WITH_SDL truelight@0: ttd_SOURCES += sdl.c truelight@0: endif truelight@0: truelight@0: ifdef WIN32 truelight@0: ttd_SOURCES += win32.c w32dm.c truelight@0: else truelight@0: ttd_SOURCES += extmidi.c unix.c truelight@0: endif truelight@0: truelight@0: ttd_OBJS = $(ttd_SOURCES:%.c=%.o) truelight@0: truelight@0: ifdef WIN32 truelight@0: # Resource file truelight@0: ttd_OBJS += winres.o truelight@0: endif truelight@0: truelight@0: ifdef WITH_DIRECTMUSIC truelight@0: ttd_SOURCES += w32dm2.cpp truelight@0: ttd_OBJS += w32dm2.o truelight@0: endif truelight@0: truelight@0: ttd_DEPS1 = $(foreach obj,$(ttd_OBJS),.deps/$(obj)) truelight@0: ttd_DEPS = $(ttd_DEPS1:%.o=%.P) truelight@0: truelight@0: LANG_TXT = $(filter-out %.unfinished.txt,$(wildcard lang/*.txt)) truelight@0: LANGS = $(LANG_TXT:%.txt=%.lng) truelight@0: truelight@0: C_COMPILE = $(CC) $(CFLAGS) $(CDEFS) truelight@0: CXX_COMPILE = $(CXX) $(CFLAGS) $(CDEFS) truelight@0: truelight@0: C_BUILD = $(C_COMPILE) -c truelight@0: CXX_BUILD = $(CXX_COMPILE) -c truelight@0: truelight@0: C_LINK = $(CC) $(LDFLAGS) -o truelight@0: truelight@0: bjarni@162: truelight@0: ############################################################################## truelight@0: # 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 truelight@0: endif truelight@0: truelight@0: truelight@157: all: endian.h $(UPDATECONFIG) $(TTD) $(OSX) $(endwarnings) truelight@0: truelight@157: endian.h: $(ENDIAN_CHECK) truelight@163: @# Check if system is LITTLE_ENDIAN or BIG_ENDIAN truelight@163: @echo 'Running endian_check'; \ truelight@163: ./$(ENDIAN_CHECK) > $@ truelight@157: truelight@157: $(ENDIAN_CHECK): endian_check.c truelight@163: @echo 'Compiling and Linking $@'; \ truelight@163: $(CC) $(BASECFLAGS) $(CDEFS) endian_check.c -o $@ truelight@157: truelight@0: truelight@0: $(TTD): table/strings.h $(ttd_OBJS) $(LANGS) $(MAKE_CONFIG) bjarni@162: @echo 'Compiling and Linking $@'; \ bjarni@162: $(C_LINK) $@ $(TTDLDFLAGS) $(ttd_OBJS) $(LIBS) $(VERBOSE_FILTER) truelight@0: truelight@0: $(OSX): truelight@0: @mkdir -p $(OSXAPP)/Contents/MacOS truelight@0: @mkdir -p $(OSXAPP)/Contents/Resources truelight@0: @echo "APPL????" > $(OSXAPP)/Contents/PkgInfo darkvater@35: @cp os/macos/ttd.icns $(OSXAPP)/Contents/Resources/openttd.icns truelight@0: @os/macos/plistgen.sh $(OSXAPP) $(REV) truelight@0: @cp os/macos/track_starter $(OSXAPP)/contents/macos truelight@0: @ls os/macos | grep -q "\.class" || \ truelight@0: javac os/macos/OpenTTDMidi.java truelight@0: @cp os/macos/OpenTTDMidi.class $(OSXAPP)/contents/macos bjarni@162: @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@0: $(STRGEN): strgen/strgen.c rev.o bjarni@162: @echo 'Compiling and Linking $@'; \ bjarni@162: $(CC) $(BASECFLAGS) $(CDEFS) -o $@ $^ $(VERBOSE_FILTER) truelight@0: truelight@0: lang/english.lng: lang/english.txt $(STRGEN) bjarni@162: @echo 'Generating $@'; \ truelight@0: $(STRGEN) truelight@0: truelight@0: table/strings.h: lang/english.lng truelight@0: truelight@0: lang/%.lng: lang/%.txt $(STRGEN) bjarni@162: @echo 'Generating $@'; \ bjarni@180: $(STRGEN) $(STRGEN_FLAGS) $< $(VERBOSE_FILTER) $(LANG_ERRORS) truelight@0: truelight@0: winres.o: ttd.rc truelight@0: windres -o $@ $< truelight@0: truelight@0: truelight@0: rev.c: FORCE truelight@0: @# setting the revision number in a place, there the binary can read it truelight@0: @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 truelight@0: @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: darkvater@32: # ttd$(EXE) is removed just to make sure people execute the right binary (openttd$(EXE)) darkvater@32: # remove this for next release! truelight@0: clean: bjarni@162: @echo 'Cleaning up...'; \ truelight@163: rm -rf .deps *~ $(TTD) $(STRGEN) core table/strings.h $(LANGS) $(ttd_OBJS) endian.h $(ENDIAN_CHECK) ttd$(EXE) truelight@0: truelight@0: mrproper: clean truelight@0: rm -rf $(MAKE_CONFIG) truelight@0: truelight@0: ifndef OSX truelight@0: ifndef MORPHOS truelight@0: install: truelight@0: @if [ "$(INSTALL)" == "" ]; then $(error make install is highly experimental at his state and not\ truelight@0: 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\") truelight@0: @if [ "$(DATA_DIR)" == "" ]; then $(error no install path set - check makefile.config) truelight@0: mkdir -p $(DATA_DIR)/lang truelight@0: mkdir -p $(DATA_DIR)/data truelight@0: cp $(TTD) $(BINARY_INSTALL) truelight@0: cp lang/*.lng $(DATA_DIR)/lang truelight@0: cp data/*.grf $(DATA_DIR)/data 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@0: .PHONY: clean all $(OSX) install $(64_bit_warnings) $(endwarnings) love truelight@0: truelight@0: truelight@0: ### Automatic configuration truelight@0: -include $(CONFIG_WRITER) truelight@0: truelight@0: truelight@0: # Export all variables set to subprocesses (a bit dirty) truelight@0: .EXPORT_ALL_VARIABLES: truelight@0: upgradeconf: $(MAKE_CONFIG) truelight@0: rm $(MAKE_CONFIG) truelight@0: $(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. truelight@0: DEPS_MAGIC := $(shell mkdir .deps > /dev/null 2>&1 || :) truelight@0: truelight@0: # Introduce the dependencies truelight@0: -include $(ttd_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: bjarni@162: #@echo '$(C_BUILD) $<'; \ bjarni@162: bjarni@162: truelight@0: %.o: %.c $(MAKE_CONFIG) bjarni@162: @echo 'Compiling $(*F).o'; \ bjarni@162: $(C_BUILD) $< -Wp,-MD,.deps/$(*F).pp $(VERBOSE_FILTER) truelight@0: @-cp .deps/$(*F).pp .deps/$(*F).P; \ truelight@0: tr ' ' '\012' < .deps/$(*F).pp \ truelight@0: | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \ truelight@0: >> .deps/$(*F).P; \ truelight@0: rm .deps/$(*F).pp truelight@0: truelight@0: # For DirectMusic build truelight@0: %.o: %.cpp $(MAKE_CONFIG) truelight@0: $(CXX_BUILD) $<