diff --git a/Makefile b/Makefile deleted file mode 100644 index 13be2ab569..0000000000 --- a/Makefile +++ /dev/null @@ -1,1132 +0,0 @@ -# $Id$ - -############################################################################## -# -# Usage -# - -# Synopsis: -# -# make WITH_ZLIB=1 UNIX=1 MANUAL_CONFIG=1 -# -# (See below for the list of possible options.) -# -# Alternately, you can run make without the MANUAL_CONFIG part. It then -# generates Makefile.config, where you can customize all the options. -# However beware that for all subsequent calls the option values from -# Makefile.config take precedence to the commandline options. -# -# (That means that you probably want to either specify the options on command -# line together with MANUAL_CONFIG=1 or you want to specify no commandline -# options at all.) - -# Targets: -# -# Defaults to building binary -# clean: remove intermediate build files -# mrproper: remove intermediate files and makefile configuration -# upgradeconf: add new options to old Makefile.config -# osx: OS X application -# release: used by OSX to make a dmg file ready to release - -# Options: -# -# Summary of OS choice defines -# WIN32: building on Windows -# UNIX: building on *nix derivate (Linux, FreeBSD) -# OSX: building on Mac OS X -# MORPHOS: building on MorphOS -# BEOS: building on BeOS -# SUNOS: building on SunOS (Solaris) -# -# Summary of library choice defines -# WITH_ZLIB: savegames using zlib -# WITH_PNG: screenshots using PNG -# WITH_SDL: SDL video driver support -# WITH_COCOA: Cocoa video driver support -# -# Summary of other defines: -# DEBUG: build in debug mode -# PROFILE: build in profile mode, disables -s and -fomit-frame-pointer -# TRANSLATOR: build in translator mode (untranslated strings are prepended by -# a mark) -# RELEASE: this will be the released version number. It replaces all places -# where it normally would print the revision number -# MIDI: if set, it will use it as custom path to midi player. -# If unset, it will use the hardcoded path in the c code -# This can still be overriden by the music.extmidi openttd.cfg option. -# WITH_DIRECTMUSIC: enable DirectMusic MIDI support -# WITH_NETWORK: enable networking -# DEDICATED: allows compilation on UNIX without SDL. Useful for dedicated servers -# -# Paths: -# INSTALL: If not set, the game uses the directory of the binary to -# store everything (lang, data, gm, save and openttd.cfg), this is the `old' behaviour. -# In this case, none of the following paths are used, you also should _not_ -# use `make install', but copy the required stuff yourself (or just play out -# of you source directory, which should work fine). -# If you want to use `make install' to install the game globally, you should -# define it _before_ you build the game. If you only define INSTALL when you -# do `make install', the game won't be able to find it's files (so you should -# also define all the following paths before building). -# -# So, the following paths should be defined if INSTALL is defined. -# None of these paths have to end with / -# PREFIX: Normally /usr/local -# BINARY_DIR: The location of the binary, normally games. (Will be prefixed -# with $PREFIX) -# DATA_DIR: The location of the data (lang, data, gm and scenario), normally -# share/games/openttd. (Will be prefixed with $PREFIX) Note that scenarios -# are only put here if USE_HOMEDIR is true, otherwise they are placed in -# PERSONAL_DIR/scenario -# ICON_DIR: The location of the openttd icon. (Will be prefixed with -# $PREFIX). -# PERSONAL_DIR: The directory where openttd.cfg and the save folder will be -# stored. You cannot use ~ here, define USE_HOMEDIR for that. -# USE_HOMEDIR: If this variable is set, PERSONAL_DIR will be prefixed with -# ~/ at runtime (the user's homedir) -# SECOND_DATA_PATH Use this data dir if a file is not found in the data dir in the data path -# CUSTOM_LANG_PATH If this is set, it will use the path given to search for lng files -# instead of the lang dir in the data path -# NOTE: both SECOND_DATA_PATH and CUSTOM_LANG_PATH uses paths relative to where OTTD is opened -# -# DEST_DIR: make install will use this directory instead of the filesystem -# root to install its files. This should normally not be used by -# ordinary users, currently it is only used for the debian -# packaging. This value should only be set when calling `make -# install' and is not saved in Makefile.config -# (Note that DESTDIR is checked if DEST_DIR is not set.) -# -# STATIC: link statically -# CYGWIN: build in Cygwin environment -# MINGW: build with MingW compiler, link with MingW libraries -# -# CUSTOM_FONTCONFIG: use a custom name/path to the libfontconfig library. Useful for static linking -# -# VERBOSE: show full compiler invocations instead of brief progress messages -# -# Special for crosscompiling there are some commands available: -# -# UNIVERSAL_BINARY: builds a universal binary for OSX. Make sure you got both PPC and x86 libs. Only works with GCC 4 or newer -# TRIPLE_BINARY: builds a universal binary with the addition of code optimised for G5 (which means a total of 3 binaries in one file) -# OTTD_PPC, OTTD_PPC970, OTTD_i386: compile for target architecture. -# Multiple flags can be used so OTTD_PPC:=1 OTTD_i386:=1 produces the same result as UNIVERSAL_BINARY -# -# ENDIAN_FORCE: forces the endian-check to give a certain result. Can be BE, LE or PREPROCESSOR. -# PREPROCESSOR is always used on all OSX targets and will make the preprocessor pick the right endian. -# this means that you don't have to think about endianess when compiling for OSX. -# Very useful for universal binaries and crosscompilers. Not sure if it works on non OSX targets -# WINDRES: the location of your windres -# CC_HOST: the gcc of your localhost if you are making a target that produces incompatible executables -# CFLAGS_HOST: cflags used for CC_HOST. Make it something if you are getting errors when you try to compi -# windows executables on linux. (just: CFLAGS_HOST:='-I' or something) - - -############################################################################## -# -# Configuration -# - - -# Makefile version tag -# it checks if the version tag in Makefile.config is the same and force update outdated config files -MAKEFILE_VERSION:=10 - -# Automatic configuration -MAKE_CONFIG:=Makefile.config -MAKEFILE:=Makefile -LIB_DETECTION=makefiledir/Makefile.libdetection -CONFIG_WRITER=makefiledir/Makefile.config_writer - -# Apply automatic configuration -# See target section for how this is built, suppress errors -# since first time it isn't found but make reads this twice --include $(MAKE_CONFIG) - - -# updates Makefile.config if it's outdated -ifneq ($(MAKEFILE_VERSION),$(CONFIG_VERSION)) - UPDATECONFIG:=upgradeconf - CONFIG_INCLUDED:= -endif - -# this is used if there aren't any Makefile.config -ifndef CONFIG_INCLUDED -# sets network on by default if there aren't any config file -ENABLE_NETWORK:=1 - -# paths for make install -# disabled as they would break it for some (many?) people if they were default -#PREFIX:=/usr/local -#DATA_DIR:=share/games/openttd -#BINARY_DIR:=games -#PERSONAL_DIR:=.openttd -#USE_HOMEDIR:=1 - --include $(LIB_DETECTION) -endif - -ifdef SUPRESS_LANG_ERRORS -LANG_ERRORS = >/dev/null 2>&1 -endif - -ifdef OSX --include os/macosx/Makefile.setup -endif - -ifdef STATIC -ifndef WIN32 -ifndef OSX -ifndef MORPHOS -ifndef SKIP_STATIC_CHECK -$(error Static is only known to work on MorphOS and MacOSX!!! --- Check Makefile.config for more info and howto bypass this check) -endif -endif -endif -endif -endif - -ifdef WITH_COCOA -ifdef WITH_SDL -$(error You can not use both the SDL video driver and the Cocoa video driver at the same time) -endif -ifdef DEDICATED -$(error You can not use the Cocoa video driver in a dedicated server) -endif -else -# Force SDL on UNIX platforms -ifndef WITH_SDL -ifdef UNIX -ifndef DEDICATED -$(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) -endif -endif -endif -endif - -# remove the dependancy for sdl if DEDICALTED is used -ifdef DEDICATED - WITH_SDL:= -endif - -# add -lpthread to LDFLAGS -ifndef WIN32 - ifndef MORPHOS - ifndef OSX - LDFLAGS+=-lpthread - endif - endif -endif - -ifdef OSX - LDFLAGS+=-framework Cocoa -endif - -ifdef WITH_SDL - ifndef SDL_CONFIG -$(error WITH_SDL can't be used when SDL_CONFIG is not set. Edit Makefile.config to correct this) - endif -endif - -ifdef WITH_PNG - ifndef LIBPNG_CONFIG -$(error WITH_PNG can't be used when LIBPNG_CONFIG is not set. Edit Makefile.config to correct this) - endif -endif - -ifdef WITH_FREETYPE - ifndef FREETYPE_CONFIG -$(error WITH_FREETYPE can't be used when FREETYPE_CONFIG is not set. Edit Makefile.config to correct this) - endif -endif - -ifdef WITH_FONTCONFIG - ifndef FONTCONFIG_CONFIG -$(error WITH_FONTCONFIG can't be used when FONTOCNFIG_CONFIG is not set. Edit Makefile.config to correct this) - endif -endif - -############################################################################## -# -# Compiler configuration -# - -# Executable file extension -ifdef WIN32 - EXE=.exe -else - ifdef OS2 - EXE=.exe - else - EXE= - endif -endif - -# Set output executable names -TTD=openttd$(EXE) -ENDIAN_CHECK=endian_check$(EXE) -STRGEN=strgen/strgen$(EXE) -OSXAPP="OpenTTD.app" - -ifdef RELEASE -REV:=$(RELEASE) -else -ifeq ($(shell if test -d .svn; then echo 1; fi), 1) -REV_MODIFIED := $(shell svnversion . | sed -n 's/.*\(M\).*/\1/p' ) -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 }') -endif -endif - -# define flag to use for -lrt (some OSes overwrites this later for compatibility) -ifndef LRT -ifndef MORPHOS -LRT:= -lrt -endif -endif - -# MorphOS needs builddate -BUILDDATE=`date +%d.%m.%y` - -# Check if there is a windres override -ifndef WINDRES -WINDRES = windres -endif - -# Check that CXX is defined. If not, then it's g++ -ifndef CXX -CXX = g++ -endif - -# Check if CXX_HOST is defined. If not, it is CXX -ifndef CXX_HOST -CXX_HOST = $(CXX) -endif - -# Check if we have a new target -ifndef CXX_TARGET -CXX_TARGET = $(CXX_HOST) -endif - -# Check if CC_HOST is defined. If not, it is CC -ifndef CC_HOST -CC_HOST = $(CC) -endif - -ifndef CFLAGS_HOST -CFLAGS_HOST = $(BASECFLAGS) -endif - -# Check if we have a new target -ifndef CC_TARGET -CC_TARGET = $(CC_HOST) -endif - -CC_VERSION = $(shell $(CC_TARGET) -dumpversion | cut -c 1,3) - -# GNU make can only test for (in)equality -# this is a workaround to test for >= -ifeq ($(shell expr $(CC_VERSION) \>= 29), 1) - CFLAGS += -O -Wall -Wno-multichar -Wsign-compare -Wundef - CC_CFLAGS += -Wstrict-prototypes - CFLAGS += -Wwrite-strings -Wpointer-arith -endif -ifeq ($(shell expr $(CC_VERSION) \>= 30), 1) - CFLAGS += -W -Wno-unused-parameter -endif -ifeq ($(shell expr $(CC_VERSION) \>= 34), 1) - CC_CFLAGS += -Wdeclaration-after-statement -Wold-style-definition -endif - -ifdef DEBUG - ifeq ($(shell expr $(DEBUG) \>= 1), 1) - CFLAGS += -g -D_DEBUG - endif - ifeq ($(shell expr $(DEBUG) \>= 2), 1) - CFLAGS += -fno-inline - endif - ifeq ($(shell expr $(DEBUG) \>= 3), 1) - CFLAGS += -O0 - endif -endif - -ifdef PROFILE - CFLAGS += -pg - LDFLAGS += -pg - ifdef OSX - # Shark (Xcode's profiling tool) needs -g to relate CPU usage to line numbers in the source code - BASECFLAGS += -g - endif -endif - -CDEFS=-DWITH_REV - -ifndef DEBUG -ifndef PROFILE -# Release mode -ifndef MORPHOS -ifndef IRIX -# automatical strip breaks under morphos -ifdef OSX -# it appears that OSX can't handle automated stripping when mixing C and C++ -# we will do it manually in the target OSX_STRIP -OSX_STRIP:=OSX_STRIP -else -LDFLAGS += -s -endif -endif -endif -endif - -ifdef OSX -# these compilerflags makes the app run as fast as possible without making the app unstable. It works on G3 or newer -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 -else -ifdef MORPHOS -BASECFLAGS += -I/gg/os-include -O2 -noixemul -fstrict-aliasing -fexpensive-optimizations -BASECFLAGS += -mcpu=604 -fno-inline -mstring -mmultiple -else -BASECFLAGS += -O2 -endif -ifndef PROFILE -ifndef IRIX -BASECFLAGS += -fomit-frame-pointer -endif -endif -endif -endif - -ifdef STATIC -ifndef OSX # OSX can't build static if -static flag is used -LDFLAGS += -static -endif -endif - -# If building on MingW don't link with Cygwin libs -ifdef WIN32 -ifdef CYGWIN -BASECFLAGS += -mwin32 -LDFLAGS += -mwin32 -endif -ifdef MINGW -BASECFLAGS += -mno-cygwin -LDFLAGS += -mno-cygwin -# -lrt fails with MINGW, so we disable it -LRT:= -endif -endif - -CFLAGS += $(BASECFLAGS) - -ifdef UNIX -CDEFS += -DUNIX -endif - -ifdef BEOS -CDEFS += -DBEOS -LDFLAGS += -lmidi -lbe -lpthread -ifdef WITH_NETWORK - ifdef BEOS_NET_SERVER - CDEFS += -DBEOS_NET_SERVER - LDFLAGS += -lnet - else - # BONE needs a few more libraries than R5 - LDFLAGS += -lbind -lsocket - endif -endif -endif - -ifdef MORPHOS -# -Wstrict-prototypes generates much noise because of system headers -# 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 -CFLAGS += -Wno-strict-prototypes -DFOUR_BYTE_BOOL -endif - -ifdef SUNOS -CDEFS += -DSUNOS -ifdef WITH_NETWORK -LDFLAGS += -lnsl -lsocket -endif -endif - -# tell the source that we are building a dedicated server -ifdef DEDICATED -CDEFS += -DDEDICATED -endif - -# SDL config -ifdef WITH_SDL -CDEFS += -DWITH_SDL -CCFLAGS_SDL := $(shell $(SDL_CONFIG) --cflags) -CFLAGS += $(CCFLAGS_SDL) -ifdef STATIC -LDFLAGS_SDL := $(shell $(SDL_CONFIG) --static-libs) -else -LDFLAGS_SDL := $(shell $(SDL_CONFIG) --libs) -endif -LIBS += $(LDFLAGS_SDL) -endif - -# zlib config -ifdef WITH_ZLIB - CDEFS += -DWITH_ZLIB - ifdef STATIC - ifdef OSX - # OSX links dynamically to zlib, even in static builds since it's always present in the system - LIBS += -lz - else - LIBS += $(STATIC_ZLIB_PATH) - endif - else - LIBS += -lz - endif -endif - -# libpng config -ifdef WITH_PNG -CDEFS += -DWITH_PNG -CCFLAGS_PNG := $(shell $(LIBPNG_CONFIG) --cppflags --I_opts) -CFLAGS += $(CCFLAGS_PNG) - -# seems like older libpng versions are broken and need this -PNGCONFIG_FLAGS = --ldflags --libs -ifdef STATIC -ifdef OSX -# Seems like we need a tiny hack for OSX static to work -LDFLAGS_PNG := $(shell $(LIBPNG_CONFIG) --prefix)/lib/libpng.a -else -LDFLAGS_PNG := $(shell $(LIBPNG_CONFIG) --static $(PNGCONFIG_FLAGS)) -endif -else -LDFLAGS_PNG := $(shell $(LIBPNG_CONFIG) --L_opts $(PNGCONFIG_FLAGS)) -endif -LIBS += $(LDFLAGS_PNG) -endif - -# use std C++ lib: -LIBS += -lstdc++ -ifndef MINGW - LIBS += -lc -endif - -# freetype config -ifdef WITH_FREETYPE -CDEFS += -DWITH_FREETYPE -CCFLAGS_FREETYPE := $(shell $(FREETYPE_CONFIG) --cflags) -LDFLAGS_FREETYPE := $(shell $(FREETYPE_CONFIG) --libs) -CFLAGS += $(CCFLAGS_FREETYPE) -LIBS += $(LDFLAGS_FREETYPE) -endif - -# fontconfig config -ifdef WITH_FONTCONFIG -CDEFS += -DWITH_FONTCONFIG -CCFLAGS_FONTCONFIG := $(shell $(FONTCONFIG_CONFIG) --cflags) -LDFLAGS_FONTCONFIG := $(shell $(FONTCONFIG_CONFIG) --libs) - -ifdef CUSTOM_FONTCONFIG -# To allow usage of non-default libs, such as absolute path to static libs -# not stored in Makefile.config -LDFLAGS_FONTCONFIG := $(CUSTOM_FONTCONFIG) -endif - -CFLAGS += $(CCFLAGS_FONTCONFIG) -LIBS += $(LDFLAGS_FONTCONFIG) -endif - -# iconv is enabled defaultly on OSX >= 10.3 -ifdef OSX - WITH_ICONV=1 - LIBS += -liconv -endif - -ifdef WITH_ICONV - CDEFS += -DWITH_ICONV - ifdef WITH_ICONV_PATH - CFLAGS += -I$(WITH_ICONV_PATH) - endif -endif - -# enables/disables assert() -ifdef DISABLE_ASSERTS -CFLAGS += -DNDEBUG -endif - -ifdef NO_THREADS -CFLAGS += -DNO_THREADS -endif - -# automatically disables asserts for release -ifdef RELEASE -ifndef ENABLE_ASSERTS -CFLAGS += -DNDEBUG -endif -endif - -ifdef TRANSLATOR -STRGEN_FLAGS=-t -else -STRGEN_FLAGS= -endif - -# OSX specific setup -ifdef OSX - # set the endian flag for OSX, that can't fail - ENDIAN_FORCE:=PREPROCESSOR - - # -lrt fails on OSX, so we disable it - LRT:= - - ifndef DEDICATED - LIBS += -framework QuickTime - endif - - ifdef WITH_COCOA - CDEFS += -DWITH_COCOA - LIBS += -F/System/Library/Frameworks -framework Cocoa -framework Carbon -framework AudioUnit - endif - - # OSX path setup - ifndef SECOND_DATA_PATH - SECOND_DATA_PATH:="$(OSXAPP)/Contents/Data/" - endif - - ifndef CUSTOM_LANG_DIR - ifndef DEDICATED - CUSTOM_LANG_DIR:="$(OSXAPP)/Contents/Lang/" - endif - endif -endif - -ifdef MIDI -CDEFS += -DEXTERNAL_PLAYER=\"$(MIDI)\" -ifdef MIDI_ARG -CDEFS += -DMIDI_ARG=\"$(MIDI_ARG)\" -endif -endif - -ifdef WITH_NETWORK -CDEFS += -DENABLE_NETWORK -ifdef QNX -LIBS += -lsocket -endif -endif - - -ifdef SECOND_DATA_PATH -CDEFS += -DSECOND_DATA_DIR=\"$(SECOND_DATA_PATH)/\" -endif - -ifdef CUSTOM_LANG_DIR -CDEFS += -DCUSTOM_LANG_DIR=\"$(CUSTOM_LANG_DIR)/\" -endif - -ifdef WITH_DIRECTMUSIC -CDEFS += -DWIN32_ENABLE_DIRECTMUSIC_SUPPORT -endif - -ifdef WIN32 -LIBS += -lws2_32 -lwinmm -lgdi32 -ldxguid -lole32 -ifdef WITH_DIRECTMUSIC -LIBS += -lstdc++ -endif -TTDLDFLAGS += -Wl,--subsystem,windows -endif - -ifndef DEST_DIR -DEST_DIR = $(DESTDIR) -endif - -# sets up the paths for use for make install -ifdef INSTALL -# We use _PREFIXED vars here, so the paths are recalculated every time, and -# the prefix is not prepended in the makefile config -BINARY_DIR_PREFIXED:=$(PREFIX)/$(BINARY_DIR) -DATA_DIR_PREFIXED:=$(PREFIX)/$(DATA_DIR) -ICON_DIR_PREFIXED:=$(PREFIX)/$(ICON_DIR) -# We use _INSTALL vars here, these vars are the locations where the files will -# be installed -DATA_DIR_INSTALL=$(DEST_DIR)/$(DATA_DIR_PREFIXED) -BINARY_DIR_INSTALL=$(DEST_DIR)/$(BINARY_DIR_PREFIXED) -ICON_DIR_INSTALL=$(DEST_DIR)/$(ICON_DIR_PREFIXED) -# Let the code know where to find stuff -ifdef DATA_DIR_PREFIXED -CDEFS += -DGAME_DATA_DIR=\"$(DATA_DIR_PREFIXED)/\" -endif - -ifdef PERSONAL_DIR -CDEFS += -DPERSONAL_DIR=\"$(PERSONAL_DIR)/\" -endif - -ifdef USE_HOMEDIR -CDEFS += -DUSE_HOMEDIR -endif - -ifdef ICON_DIR -CDEFS += -DICON_DIR=\"$(ICON_DIR_PREFIXED)/\" -endif -endif - -############################################################################## -# -# What to compile -# (users do not want to modify anything below) -# - - -### Sources - -# clean up C_SOURCES first. Needed since building universal binaries on OSX calls the makefile recursively (just one time) -SRCS := - -SRCS += aircraft_cmd.c -SRCS += aircraft_gui.c -SRCS += airport.c -SRCS += airport_gui.c -SRCS += aystar.c -SRCS += bmp.c -SRCS += bridge_gui.c -SRCS += bridge_map.c -SRCS += build_vehicle_gui.c -SRCS += callback_table.c -SRCS += clear_cmd.c -SRCS += command.c -SRCS += console.c -SRCS += console_cmds.c -SRCS += currency.c -SRCS += date.c -SRCS += debug.c -SRCS += dedicated.c -SRCS += depot.c -SRCS += depot_gui.c -SRCS += disaster_cmd.c -SRCS += dock_gui.c -SRCS += driver.c -SRCS += dummy_land.c -SRCS += economy.c -SRCS += elrail.c -SRCS += engine.c -SRCS += engine_gui.c -SRCS += fileio.c -SRCS += fios.c -SRCS += fontcache.c -SRCS += genworld.c -SRCS += genworld_gui.c -SRCS += gfx.c -SRCS += gfxinit.c -SRCS += graph_gui.c -SRCS += heightmap.c -SRCS += helpers.cpp -SRCS += industry_cmd.c -SRCS += industry_gui.c -SRCS += intro_gui.c -SRCS += landscape.c -SRCS += main_gui.c -SRCS += map.c -SRCS += md5.c -SRCS += mersenne.c -SRCS += minilzo.c -SRCS += misc.c -SRCS += misc_cmd.c -SRCS += misc_gui.c -SRCS += mixer.c -SRCS += music.c -SRCS += music_gui.c -SRCS += namegen.c -SRCS += network/core/packet.c -SRCS += network/core/tcp.c -SRCS += network/core/udp.c -SRCS += network/network.c -SRCS += network/network_client.c -SRCS += network/network_data.c -SRCS += network/network_gamelist.c -SRCS += network/network_gui.c -SRCS += network/network_server.c -SRCS += network/network_udp.c -SRCS += newgrf.c -SRCS += newgrf_cargo.c -SRCS += newgrf_config.c -SRCS += newgrf_engine.c -SRCS += newgrf_gui.c -SRCS += newgrf_sound.c -SRCS += newgrf_spritegroup.c -SRCS += newgrf_station.c -SRCS += newgrf_text.c -SRCS += news_gui.c -SRCS += npf.c -SRCS += oldloader.c -SRCS += oldpool.c -SRCS += openttd.c -SRCS += order_cmd.c -SRCS += order_gui.c -SRCS += os_timer.c -SRCS += pathfind.c -SRCS += player_gui.c -SRCS += players.c -SRCS += queue.c -SRCS += rail.c -SRCS += rail_cmd.c -SRCS += rail_gui.c -SRCS += rev.c -SRCS += road_cmd.c -SRCS += road_gui.c -SRCS += road_map.c -SRCS += roadveh_cmd.c -SRCS += roadveh_gui.c -SRCS += saveload.c -SRCS += screenshot.c -SRCS += settings.c -SRCS += settings_gui.c -SRCS += ship_cmd.c -SRCS += ship_gui.c -SRCS += signs.c -SRCS += smallmap_gui.c -SRCS += sound.c -SRCS += spritecache.c -SRCS += station_cmd.c -SRCS += station_gui.c -SRCS += station_map.c -SRCS += string.c -SRCS += strings.c -SRCS += subsidy_gui.c -SRCS += terraform_gui.c -SRCS += texteff.c -SRCS += tgp.c -SRCS += thread.c -SRCS += tile.c -SRCS += town_cmd.c -SRCS += town_gui.c -SRCS += train_cmd.c -SRCS += train_gui.c -SRCS += tree_cmd.c -SRCS += tunnel_map.c -SRCS += tunnelbridge_cmd.c -SRCS += unmovable_cmd.c -SRCS += vehicle.c -SRCS += vehicle_gui.c -SRCS += viewport.c -SRCS += water_cmd.c -SRCS += waypoint.c -SRCS += widget.c -SRCS += window.c -SRCS += music/null_m.c -SRCS += sound/null_s.c -SRCS += video/dedicated_v.c -SRCS += video/null_v.c -SRCS += yapf/follow_track.cpp -SRCS += yapf/yapf_common.cpp -SRCS += yapf/yapf_rail.cpp -SRCS += yapf/yapf_road.cpp -SRCS += yapf/yapf_ship.cpp - -# AI related files -SRCS += ai/ai.c -SRCS += ai/default/default.c -SRCS += ai/trolly/build.c -SRCS += ai/trolly/pathfinder.c -SRCS += ai/trolly/shared.c -SRCS += ai/trolly/trolly.c - -ifdef WITH_SDL - SRCS += sdl.c - SRCS += sound/sdl_s.c - SRCS += video/sdl_v.c -endif - -ifdef WIN32 - SRCS += win32.c - SRCS += music/win32_m.c - SRCS += sound/win32_s.c - SRCS += video/win32_v.c -else - SRCS += unix.c - SRCS += music/extmidi.c -endif - -ifdef OSX - SRCS += os/macosx/macos.m - ifndef DEDICATED - SRCS += music/qtmidi.c - endif - ifdef WITH_COCOA - SRCS += video/cocoa_v.m - SRCS += sound/cocoa_s.c - SRCS += os/macosx/splash.c - endif -endif - -ifdef BEOS - SRCS += music/bemidi.cpp -endif - -ifdef WIN32 - SRCS += ottdres.rc -endif - -ifdef WITH_DIRECTMUSIC - SRCS += music/dmusic.cpp -endif - -OBJS += $(filter %.o, $(SRCS:%.cpp=%.o) $(SRCS:%.m=%.o) $(SRCS:%.c=%.o) $(SRCS:%.rc=%.o)) -DEPS = $(OBJS:%.o=.deps/%.d) - -LANG_TXT = $(filter-out %.unfinished.txt,$(wildcard lang/*.txt)) -LANGS = $(LANG_TXT:%.txt=%.lng) - - -############################################################################## -# -# Build commands -# - -# If we are verbose, we will show commands prefixed by $(Q). -# The $(Q)s get replaced by @ in non-verbose mode. -# Inspired by the Linux kernel build system. -ifdef VERBOSE - Q = -else - Q = @ -endif - - -############################################################################## -# -# Targets -# - - -### Normal build rules - - -ifdef OSX -# needs to be before all -OSX:=OSX -endif - - -all: endian_target.h endian_host.h $(UPDATECONFIG) $(LANGS) $(TTD) $(OSX) - -ifdef OSX --include os/macosx/Makefile -endif - -endian_host.h: $(ENDIAN_CHECK) - @echo '===> Testing endianness for host' - $(Q)./$(ENDIAN_CHECK) > $@ - -endian_target.h: $(ENDIAN_CHECK) - @echo '===> Testing endianness for target' - $(Q)./$(ENDIAN_CHECK) $(ENDIAN_FORCE) > $@ - -$(ENDIAN_CHECK): endian_check.c - @echo '===> Compiling and Linking $@' - $(Q)$(CC_HOST) $(CFLAGS_HOST) $(CDEFS) $< -o $@ - - -ifndef MACOSX_BUILD -# OSX links in os/macosx/Makefile to handle universal binaries better -$(TTD): $(OBJS) $(MAKE_CONFIG) - @echo '===> Linking $@' - $(Q)$(CXX_TARGET) $(LDFLAGS) $(TTDLDFLAGS) $(OBJS) $(LIBS) -o $@ -endif - -$(STRGEN): strgen/strgen.c string.c endian_host.h table/control_codes.h - @echo '===> Compiling and Linking $@' - $(Q)$(CC_HOST) $(CFLAGS_HOST) -DSTRGEN strgen/strgen.c string.c -o $@ - -table/strings.h: lang/english.txt $(STRGEN) - @echo '===> Generating $@' - $(Q)$(STRGEN) -s lang -d table - -lang/%.lng: lang/%.txt $(STRGEN) lang/english.txt - @echo '===> Compiling language $(*F)' - $(Q)$(STRGEN) $(STRGEN_FLAGS) -s lang -d lang $< $(LANG_ERRORS) || rm -f $@ - -ifdef MORPHOS - -release: all - $(Q)rm -fr "/t/openttd-$(RELEASE)-morphos.lha" - $(Q)mkdir -p "/t/" - $(Q)mkdir -p "/t/openttd-$(RELEASE)-morphos" - $(Q)mkdir -p "/t/openttd-$(RELEASE)-morphos/docs" - $(Q)mkdir -p "/t/openttd-$(RELEASE)-morphos/data" - $(Q)mkdir -p "/t/openttd-$(RELEASE)-morphos/lang" - $(Q)mkdir -p "/t/openttd-$(RELEASE)-morphos/scenario" - $(Q)mkdir -p "/t/openttd-$(RELEASE)-morphos/scenario/heightmap" - $(Q)cp -R $(TTD) "/t/openttd-$(RELEASE)-morphos/" - $(Q)cp data/* "/t/openttd-$(RELEASE)-morphos/data/" - $(Q)cp lang/*.lng "/t/openttd-$(RELEASE)-morphos/lang/" - $(Q)-cp scenario/*.scn "/t/openttd-$(RELEASE)-morphos/scenario/" - $(Q)-cp scenario/heightmap/* "/t/openttd-$(RELEASE)-morphos/scenario/heightmap/" - $(Q)cp readme.txt "/t/openttd-$(RELEASE)-morphos/docs/ReadMe" - $(Q)cp docs/console.txt "/t/openttd-$(RELEASE)-morphos/docs/Console" - $(Q)cp COPYING "/t/openttd-$(RELEASE)-morphos/docs/" - $(Q)cp changelog.txt "/t/openttd-$(RELEASE)-morphos/docs/ChangeLog" - $(Q)cp known-bugs.txt "/t/openttd-$(RELEASE)-morphos/docs/known-bugs.txt" - $(Q)cp os/morphos/icons/openttd.info "/t/openttd-$(RELEASE)-morphos/$(TTD).info" - $(Q)cp os/morphos/icons/docs.info "/t/openttd-$(RELEASE)-morphos/docs.info" - $(Q)cp os/morphos/icons/drawer.info "/t/openttd-$(RELEASE)-morphos.info" - $(Q)cp os/morphos/icons/document.info "/t/openttd-$(RELEASE)-morphos/docs/ReadMe.info" - $(Q)cp os/morphos/icons/document.info "/t/openttd-$(RELEASE)-morphos/docs/Console.info" - $(Q)cp os/morphos/icons/document.info "/t/openttd-$(RELEASE)-morphos/docs/COPYING.info" - $(Q)cp os/morphos/icons/document.info "/t/openttd-$(RELEASE)-morphos/docs/ChangeLog.info" - $(Q)strip --strip-all --strip-unneeded --remove-section .comment "/t/openttd-$(RELEASE)-morphos/$(TTD)" - $(Q)lha a -r "t:openttd-$(RELEASE)-morphos.lha" "t:openttd-$(RELEASE)-morphos" - $(Q)lha a "t:openttd-$(RELEASE)-morphos.lha" "t:openttd-$(RELEASE)-morphos.info" - $(Q)rm -fr "/t/openttd-$(RELEASE)-morphos" - $(Q)rm -fr "/t/openttd-$(RELEASE)-morphos.info" - @echo "Release archive can be found in RAM:t/ now." - -.PHONY: release -endif - -rev.c: FORCE - @# setting the revision number in a place, there the binary can read it - @echo 'const char _openttd_revision[] = "$(REV)";' >>rev.c.new - @# some additions for MorphOS versions tag - @echo '#ifdef __MORPHOS__' >>rev.c.new - @echo 'const char morphos_versions_tag[] = "\\0$$VER: OpenTTD $(REV) ('${BUILDDATE}') © OpenTTD Team [MorphOS, PowerPC]";' >>rev.c.new - @echo '#endif' >>rev.c.new - @# Only update the real rev.c if it actually changed, to prevent - @# useless rebuilds. - @cmp -s rev.c rev.c.new 2>/dev/null || mv rev.c.new rev.c - @rm -f rev.c.new - -FORCE: - - -clean: - @echo '===> Cleaning up' -# endian.h is out-dated and no longer in use, so it can be removed soon - $(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 - -mrproper: clean - $(Q)rm -rf $(MAKE_CONFIG) - -ifndef OSX -ifndef MORPHOS -install: -ifeq ($(INSTALL),) - $(error make install is highly experimental at his state and not\ - tested very much - use at your own risk - to use run \"make install INSTALL:=1\" - make sure Makefile.config\ - is set correctly up - run \"make upgradeconf\") -endif - -ifeq ($(PREFIX), ) - $(error no prefix set - check Makefile.config) -endif -# We compare against the non prefixed version here, so we won't install -# if only the prefix has been set -ifeq ($(DATA_DIR),) - $(error no data path set - check Makefile.config) -endif -ifeq ($(BINARY_DIR),) - $(error no binary path set - check Makefile.config) -endif -# We'll install in $DEST_DIR instead of root if it is set (we don't -# care about extra /'s - install -d $(DATA_DIR_INSTALL)/lang \ - $(DATA_DIR_INSTALL)/data \ - $(DATA_DIR_INSTALL)/gm \ - $(ICON_DIR_INSTALL) \ - $(BINARY_DIR_INSTALL) -ifndef USE_HOMEDIR - mkdir -p $(PERSONAL_DIR)/scenario - mkdir -p $(PERSONAL_DIR)/scenario/heightmap -else - mkdir -p $(DATA_DIR_INSTALL)/scenario - mkdir -p $(DATA_DIR_INSTALL)/scenario/heightmap -endif - install $(TTD) $(BINARY_DIR_INSTALL) - install -m 644 lang/*.lng $(DATA_DIR_INSTALL)/lang - install -m 644 data/*.grf $(DATA_DIR_INSTALL)/data - install -m 644 data/opntitle.dat $(DATA_DIR_INSTALL)/data - # Generic menu icon - install -m 644 media/openttd.64.png $(ICON_DIR_INSTALL) - # Debian menu icon - install -m 644 media/openttd.32.xpm $(ICON_DIR_INSTALL) - # Window icon - install -m 644 media/openttd.32.bmp $(ICON_DIR_INSTALL) -else #MorphOS -install: - $(error make install is not supported on MorphOS) -endif -else # OSX -install: - $(error make install is not supported on MacOSX) -endif - - -love: - @echo "YES! I thought you would never ask. We will have a great time. You can keep me turned on all night" - -.PHONY: clean all $(OSX) install love - - -### Automatic configuration --include $(CONFIG_WRITER) - - -# Export all variables set to subprocesses (a bit dirty) -.EXPORT_ALL_VARIABLES: -upgradeconf: $(MAKE_CONFIG) - $(Q)rm $(MAKE_CONFIG) - $(Q)$(MAKE) $(MAKE_CONFIG) - -.PHONY: upgradeconf - - -### Internal build rules - -# This makes sure the .deps dir is always around. -DEPS_MAGIC := $(shell mkdir -p $(sort $(dir $(DEPS)))) - -depend: - @true # The include handles this automagically - -# Introduce the dependencies -ifeq ($(findstring $(MAKECMDGOALS), clean info mrproper upgradeconf $(MAKE_CONFIG)),) --include $(DEPS) -endif - -# Silence stale header dependency errors -%.h: - @true - -.deps/%.d: %.c $(MAKE_CONFIG) table/strings.h endian_target.h - @echo '===> DEP $<' - $(Q)$(CC_TARGET) $(CFLAGS) $(CDEFS) -MM $< | sed 's#^$(@F:%.d=%.o):#$@ $(@:.deps/%.d=%.o):#' > $@ - -.deps/%.d: %.cpp $(MAKE_CONFIG) table/strings.h endian_target.h - @echo '===> DEP $<' - $(Q)$(CXX_TARGET) $(CFLAGS) $(CDEFS) -MM $< | sed 's#^$(@F:%.d=%.o):#$@ $(@:.deps/%.d=%.o):#' > $@ - -.deps/%.d: %.m $(MAKE_CONFIG) table/strings.h endian_target.h - @echo '===> DEP $<' - $(Q)$(CC_TARGET) $(OBJCFLAGS) $(CDEFS) -MM $< | sed 's#^$(@F:%.d=%.o):#$@ $(@:.deps/%.d=%.o):#' > $@ - - -ifndef MACOSX_BUILD -# OSX uses os/macosx/Makefile to compile files -%.o: %.c $(MAKE_CONFIG) - @echo '===> Compiling $<' - $(Q)$(CC_TARGET) $(CC_CFLAGS) $(CFLAGS) $(CDEFS) -c -o $@ $< - -%.o: %.cpp $(MAKE_CONFIG) - @echo '===> Compiling $<' - $(Q)$(CXX_TARGET) $(CFLAGS) $(CDEFS) -c -o $@ $< - -%.o: %.m $(MAKE_CONFIG) - @echo '===> Compiling $<' - $(Q)$(CC_TARGET) $(CC_CFLAGS) $(CFLAGS) $(CDEFS) -c -o $@ $< -endif - -%.o: %.rc - @echo '===> Compiling resource $<' - $(Q)$(WINDRES) -o $@ $< - - -info: - @echo 'CFLAGS = $(CFLAGS)' - @echo 'LDFLAGS = $(LDFLAGS)' - @echo 'LIBS = $(LIBS)' - @echo 'CDEFS = $(CDEFS)' diff --git a/Makefile.in b/Makefile.in new file mode 100644 index 0000000000..6c1131abf8 --- /dev/null +++ b/Makefile.in @@ -0,0 +1,249 @@ +# Auto-generated file -- DO NOT EDIT + +# Check if we want to show what we are doing +ifdef VERBOSE + Q = +else + Q = @ +endif + +include Makefile.am + +SOURCE_LIST = !!SOURCE_LIST!! +CONFIG_CACHE_SOURCE_LIST = !!CONFIG_CACHE_SOURCE_LIST!! +CONFIGURE_FILES = !!CONFIGURE_FILES!! +LIPO = !!LIPO!! +BIN_DIR = !!BIN_DIR!! +SRC_DIR = !!SRC_DIR!! +ROOT_DIR = !!ROOT_DIR!! +BUNDLE_DIR = "$(ROOT_DIR)/bundle" +BUNDLES_DIR = "$(ROOT_DIR)/bundles" +INSTALL_DIR = !!INSTALL_DIR!! +INSTALL_BINARY_DIR = "$(INSTALL_DIR)/"!!BINARY_DIR!! +INSTALL_ICON_DIR = "$(INSTALL_DIR)/"!!ICON_DIR!! +INSTALL_DATA_DIR = "$(INSTALL_DIR)/"!!DATA_DIR!! +INSTALL_PERSONAL_DIR = !!PERSONAL_DIR!! +# TODO: ENABLE_INSTALL should be removed when the search path patch has been applied +ENABLE_INSTALL = !!ENABLE_INSTALL!! +TTD = !!TTD!! +TTDS = $(SRC_DIRS:%=%/$(TTD)) +OS = !!OS!! +OSXAPP = !!OSXAPP!! + +RES := $(shell if ! [ -f $(CONFIG_CACHE_SOURCE_LIST) ] || [ -n "`cmp $(CONFIG_CACHE_SOURCE_LIST) $(SOURCE_LIST)`" ]; then cp $(SOURCE_LIST) $(CONFIG_CACHE_SOURCE_LIST); fi ) + +all: config.cache + @for dir in $(DIRS); do \ + $(MAKE) -C $$dir all; \ + done +ifdef LIPO +# Lipo is an OSX thing. If it is defined, it means we are building for universal, +# and so we have have to combine the binaries into one big binary + +# Remove the last binary made by the last compiled target + rm -f $(BIN_DIR)/$(TTD) +# Make all the binaries into one + $(LIPO) -create -output $(BIN_DIR)/$(TTD) $(TTDS) +endif + +config.cache: $(CONFIG_CACHE_SOURCE_LIST) $(CONFIGURE_FILES) +ifeq ($(shell if test -f config.cache; then echo 1; fi), 1) + @echo "----------------" + @echo "The system detected that source.list or any configure file is altered." + @echo " Going to reconfigure with last known settings..." + @echo "----------------" +# Make sure we don't lock config.cache + @$(shell cat config.cache) || exit 1 + @echo "----------------" + @echo "Reconfig done. Now compiling..." + @echo "----------------" +else + @echo "----------------" + @echo "Have not found a configuration, please run configure first." + @echo "----------------" + @exit 1 +endif + +clean: + @for dir in $(DIRS); do \ + $(MAKE) -C $$dir clean; \ + done + $(Q)rm -rf $(BUNDLE_TARGET) + +lang: + @for dir in $(LANG_DIRS); do \ + $(MAKE) -C $$dir all; \ + done + +mrproper: + @for dir in $(DIRS); do \ + $(MAKE) -C $$dir mrproper; \ + rm -f $$dir/Makefile; \ + done + $(Q)rm -rf objs + $(Q)rm -f Makefile Makefile.am + $(Q)rm -f $(CONFIG_CACHE_SOURCE_LIST) config.cache config.log + $(Q)rm -rf $(BUNDLE_DIR) + $(Q)rm -rf $(BUNDLES_DIR) + +depend: + @for dir in $(SRC_DIRS); do \ + $(MAKE) -C $$dir depend; \ + done + +run: all + $(Q)cd !!BIN_DIR!! && ./!!TTD!! + +%.o: + @for dir in $(SRC_DIRS); do \ + $(MAKE) -C $$dir $@; \ + done + +%.lng: + @for dir in $(LANG_DIRS); do \ + $(MAKE) -C $$dir $@; \ + done + +# +# Creation of bundles +# + +# The revision is needed for the bundle name and creating an OSX application bundle. +ifdef REVISION +REV := $(REVISION) +else +# Are we a SVN dir? +ifeq ($(shell if test -d $(SRC_DIR)/.svn; then echo 1; fi), 1) +# Find if the local source if modified +REV_MODIFIED := $(shell svnversion $(SRC_DIR) | sed -n 's/.*\(M\).*/\1/p' ) +# Find the revision like: rXXXX-branch +REV := $(shell LC_ALL=C svn info $(SRC_DIR) | awk '/^URL:.*branches/ { split($$2, a, "/"); BRANCH="-"a[5] } /^Last Changed Rev:/ { REV="r"$$4"$(REV_MODIFIED)" } END { print REV BRANCH }') +endif +endif +# Make sure we have something in REV +ifeq ($(REV),) +REV := norev000 +endif + +ifndef BUNDLE_NAME +BUNDLE_NAME = OTTD-$(OS)-custom-$(REV) +endif + +# An OSX application bundle needs the data files, lang files and openttd executable in a different location. +ifdef OSXAPP +DATA_DIR = $(BUNDLE_DIR)/$(OSXAPP)/Contents/Data +LANG_DIR = $(BUNDLE_DIR)/$(OSXAPP)/Contents/Lang +TTD_DIR = $(BUNDLE_DIR)/$(OSXAPP)/Contents/MacOS +else +DATA_DIR = $(BUNDLE_DIR)/data +LANG_DIR = $(BUNDLE_DIR)/lang +TTD_DIR = $(BUNDLE_DIR) +endif + +bundle: all + @echo '[BUNDLE] Constructing bundle' + $(Q)rm -rf "${BUNDLE_DIR}" + $(Q)mkdir -p "${BUNDLE_DIR}" + $(Q)mkdir -p "$(BUNDLE_DIR)/docs" + $(Q)mkdir -p "$(BUNDLE_DIR)/scenario" + $(Q)mkdir -p "$(BUNDLE_DIR)/scenario/heightmap" + $(Q)mkdir -p "$(BUNDLE_DIR)/media" + $(Q)mkdir -p "$(TTD_DIR)" + $(Q)mkdir -p "$(DATA_DIR)" + $(Q)mkdir -p "$(LANG_DIR)" +ifdef OSXAPP + $(Q)mkdir -p "$(BUNDLE_DIR)/$(OSXAPP)/Contents/Resources" + $(Q)echo "APPL????" > "$(BUNDLE_DIR)/$(OSXAPP)/Contents/PkgInfo" + $(Q)cp "$(ROOT_DIR)/os/macosx/openttd.icns" "$(BUNDLE_DIR)/$(OSXAPP)/Contents/Resources/openttd.icns" + $(Q)$(ROOT_DIR)/os/macosx/plistgen.sh "${BUNDLE_DIR}/$(OSXAPP)" "$(REV)" + $(Q)cp "$(ROOT_DIR)/docs/OSX_install_instructions.txt" "$(BUNDLE_DIR)/docs/" + $(Q)cp "$(ROOT_DIR)/docs/OSX_why_multiple_applications.txt" "$(BUNDLE_DIR)/docs/" + $(Q)cp "$(ROOT_DIR)/os/macosx/splash.png" "$(DATA_DIR)" +endif + $(Q)cp "$(BIN_DIR)/$(TTD)" "$(TTD_DIR)/" + $(Q)cp "$(BIN_DIR)/data/"*.grf "$(DATA_DIR)/" + $(Q)cp "$(BIN_DIR)/data/opntitle.dat" "$(DATA_DIR)/" + $(Q)cp "$(BIN_DIR)/lang/"*.lng "$(LANG_DIR)/" + $(Q)cp "$(ROOT_DIR)/readme.txt" "$(BUNDLE_DIR)/" + $(Q)cp "$(ROOT_DIR)/COPYING" "$(BUNDLE_DIR)/" + $(Q)cp "$(ROOT_DIR)/known-bugs.txt" "$(BUNDLE_DIR)/docs/" + $(Q)cp "$(ROOT_DIR)/docs/multiplayer.txt" "$(BUNDLE_DIR)/docs/" + $(Q)cp "$(ROOT_DIR)/changelog.txt" "$(BUNDLE_DIR)/docs/" + $(Q)cp "$(ROOT_DIR)/media/openttd.64.png" "$(BUNDLE_DIR)/media/" + $(Q)cp "$(ROOT_DIR)/media/openttd.32.xpm" "$(BUNDLE_DIR)/media/" + $(Q)cp "$(ROOT_DIR)/media/openttd.32.bmp" "$(BUNDLE_DIR)/media/" +ifeq ($(shell if test -d $(BIN_DIR)/scenario/*.scn; then echo 1; fi), 1) + $(Q)cp "$(BIN_DIR)/scenario/"*.scn "$(BUNDLE_DIR)/scenario/" +endif +ifeq ($(shell if test -d $(BIN_DIR)/scenario/heightmaps/*; then echo 1; fi), 1) + $(Q)cp "$(BIN_DIR)/scenario/heightmaps/"* "$(BUNDLE_DIR)/scenario/heightmap/" +endif + +### Packing the current bundle into several compressed file formats ### +# +# Zips & dmgs do not contain a root folder, i.e. they have files in the root of the zip/dmg. +# gzip, bzip2 and lha archives have a root folder, with the same name as the bundle. +# +# One can supply a custom name by adding BUNDLE_NAME:= to the make command. +# +bundle_zip: bundle + @echo '[BUNDLE] Creating $(BUNDLE_NAME).zip' + $(Q)mkdir -p "$(BUNDLES_DIR)" + $(Q)cd "$(BUNDLE_DIR)" && zip -r $(shell if test -z "$(VERBOSE)"; then echo '-q'; fi) "$(BUNDLES_DIR)/$(BUNDLE_NAME).zip" . + +bundle_gzip: bundle + @echo '[BUNDLE] Creating $(BUNDLE_NAME).tar.gz' + $(Q)mkdir -p "$(BUNDLES_DIR)/.gzip/$(BUNDLE_NAME)" + $(Q)cp -R "$(BUNDLE_DIR)/"* "$(BUNDLES_DIR)/.gzip/$(BUNDLE_NAME)/" + $(Q)cd "$(BUNDLES_DIR)/.gzip" && tar -zc$(shell if test -n "$(VERBOSE)"; then echo 'v'; fi)f "$(BUNDLES_DIR)/$(BUNDLE_NAME).tar.gz" "$(BUNDLE_NAME)" + $(Q)rm -rf "$(BUNDLES_DIR)/.gzip" + +bundle_bzip2: bundle + @echo '[BUNDLE] Creating $(BUNDLE_NAME).tar.bz2' + $(Q)mkdir -p "$(BUNDLES_DIR)/.bzip2/$(BUNDLE_NAME)" + $(Q)cp -R "$(BUNDLE_DIR)/"* "$(BUNDLES_DIR)/.bzip2/$(BUNDLE_NAME)/" + $(Q)cd "$(BUNDLES_DIR)/.bzip2" && tar -jc$(shell if test -n "$(VERBOSE)"; then echo 'v'; fi)f "$(BUNDLES_DIR)/$(BUNDLE_NAME).tar.bz2" "$(BUNDLE_NAME)" + $(Q)rm -rf "$(BUNDLES_DIR)/.bzip2" + +bundle_lha: bundle + @echo '[BUNDLE] Creating $(BUNDLE_NAME).lha' + $(Q)mkdir -p "$(BUNDLES_DIR)/.lha/$(BUNDLE_NAME)" + $(Q)cp -R "$(BUNDLE_DIR)/"* "$(BUNDLES_DIR)/.lha/$(BUNDLE_NAME)/" + $(Q)cd "$(BUNDLES_DIR)/.lha" && lha ao6 "$(BUNDLES_DIR)/$(BUNDLE_NAME).lha" "$(BUNDLE_NAME)" + $(Q)rm -rf "$(BUNDLES_DIR)/.lha" + +bundle_dmg: bundle + @echo '[BUNDLE] Creating $(BUNDLE_NAME).dmg' + $(Q)mkdir -p "$(BUNDLES_DIR)" + $(Q)hdiutil create -ov -format UDZO -srcfolder "$(BUNDLE_DIR)" "$(BUNDLES_DIR)/$(BUNDLE_NAME).dmg" + +# TODO: ENABLE_INSTALL should be removed when the search path patch has been applied +ifeq ($(ENABLE_INSTALL), 0) +install: + @echo '[INSTALL] Cannot install. Not compiled with installation paths' +else +ifdef OSXAPP +install: + @echo '[INSTALL] Cannot install the OSX Application Bundle' +else +install: bundle + @echo '[INSTALL] Installing OpenTTD' + $(Q)install -d "$(INSTALL_BINARY_DIR)" + $(Q)install -d "$(INSTALL_ICON_DIR)" + $(Q)install -d "$(INSTALL_DATA_DIR)/gm" + $(Q)install -d "$(INSTALL_DATA_DIR)/data" + $(Q)install -d "$(INSTALL_DATA_DIR)/lang" + $(Q)install -d "$(INSTALL_DATA_DIR)/docs" + $(Q)install -m 755 "$(BUNDLE_DIR)/$(TTD)" "$(INSTALL_BINARY_DIR)" + $(Q)install -m 644 "$(BUNDLE_DIR)/lang/"* "$(INSTALL_DATA_DIR)/lang" + $(Q)install -m 644 "$(BUNDLE_DIR)/data/"* "$(INSTALL_DATA_DIR)/data" + $(Q)install -m 644 "$(BUNDLE_DIR)/docs/"* "$(INSTALL_DATA_DIR)/docs" + $(Q)install -m 644 "$(BUNDLE_DIR)/media/"* "$(INSTALL_ICON_DIR)" +ifdef INSTALL_PERSONAL_DIR + $(Q)mkdir -p ~/"$(INSTALL_PERSONAL_DIR)" + $(Q)cp -R "$(BUNDLE_DIR)/scenario" ~/"$(INSTALL_PERSONAL_DIR)" +else + $(Q)cp -R "$(BUNDLE_DIR)/scenario" "$(INSTALL_DATA_DIR)" +endif # INSTALL_PERSONAL_DIR +endif # OSXAPP +endif # ENABLE_INSTALL diff --git a/Makefile.lang.in b/Makefile.lang.in new file mode 100644 index 0000000000..a12e696016 --- /dev/null +++ b/Makefile.lang.in @@ -0,0 +1,85 @@ +# Auto-generated file -- DO NOT EDIT + +STRGEN = !!STRGEN!! +ENDIAN_CHECK = !!ENDIAN_CHECK!! +SRC_DIR = !!SRC_DIR!! +LANG_DIR = !!LANG_DIR!! +BIN_DIR = !!BIN_DIR!! +LANGS_SRC = $(shell ls $(LANG_DIR)/*.txt) +LANGS = $(LANGS_SRC:$(LANG_DIR)/%.txt=%.lng) +CC_BUILD = !!CC_BUILD!! +CFLAGS_BUILD = !!CFLAGS_BUILD!! +STRGEN_FLAGS = !!STRGEN_FLAGS!! +STAGE = !!STAGE!! +LANG_SUPPRESS= !!LANG_SUPPRESS!! +LANG_OBJS_DIR= !!LANG_OBJS_DIR!! + +ifeq ($(LANG_SUPPRESS), yes) +LANG_ERRORS = >/dev/null 2>&1 +endif + +# Make sure endian_host.h is reasable as if it was in the src/ dir +CFLAGS_BUILD += -I $(LANG_OBJS_DIR) + +ENDIAN_TARGETS := endian_host.h endian_target.h $(ENDIAN_CHECK) + +# Check if we want to show what we are doing +ifdef VERBOSE + Q = + E = @true +else + Q = @ + E = @echo +endif + +RES := $(shell mkdir -p $(BIN_DIR)/lang ) + +all: table/strings.h $(LANGS) + +strgen.o: $(SRC_DIR)/strgen/strgen.c endian_host.h + $(E) '$(STAGE) Compiling $(<:$(SRC_DIR)/%.c=%.c)' + $(Q)$(CC_BUILD) $(CFLAGS_BUILD) -DSTRGEN -c -o $@ $< + +string.o: $(SRC_DIR)/string.c endian_host.h + $(E) '$(STAGE) Compiling $(<:$(SRC_DIR)/%.c=%.c)' + $(Q)$(CC_BUILD) $(CFLAGS_BUILD) -DSTRGEN -c -o $@ $< + +lang/english.txt: $(LANG_DIR)/english.txt + $(Q)mkdir -p lang + $(Q)cp $(LANG_DIR)/english.txt lang/english.txt + +$(STRGEN): string.o strgen.o + $(E) '$(STAGE) Compiling and Linking $@' + $(Q)$(CC_BUILD) string.o strgen.o -o $@ + +table/strings.h: lang/english.txt $(STRGEN) + $(E) '$(STAGE) Generating $@' + @mkdir -p table + $(Q)./$(STRGEN) -s $(LANG_DIR) -d table + +$(LANGS): %.lng: $(LANG_DIR)/%.txt $(STRGEN) lang/english.txt + $(E) '$(STAGE) Compiling language $(*F)' + $(Q)./$(STRGEN) $(STRGEN_FLAGS) -s $(LANG_DIR) -d $(LANG_OBJS_DIR) $< $(LANG_ERRORS) && cp $@ $(BIN_DIR)/lang + +# The targets to compile the endian-code + +endian_host.h: $(ENDIAN_CHECK) + $(E) '$(STAGE) Testing endianness for host' + $(Q)./$(ENDIAN_CHECK) > $@ + +$(ENDIAN_CHECK): $(SRC_DIR)/endian_check.c + $(E) '$(STAGE) Compiling and Linking $@' + $(Q)$(CC_BUILD) $(CFLAGS_BUILD) $< -o $@ + +depend: + +clean: + $(E) '$(STAGE) Cleaning up language files' + $(Q)rm -f strgen.o table/strings.h $(STRGEN) $(LANGS) $(LANGS:%=$(BIN_DIR)/lang/%) lang/english.* $(ENDIAN_TARGETS) + +mrproper: clean + +%.lng: + @echo '$(STAGE) No such language: $(@:%.lng=%)' + +.PHONY: all mrproper depend clean diff --git a/Makefile.src.in b/Makefile.src.in new file mode 100644 index 0000000000..1170e63527 --- /dev/null +++ b/Makefile.src.in @@ -0,0 +1,263 @@ +# Auto-generated file -- DO NOT EDIT + +CC_HOST = !!CC_HOST!! +CXX_HOST = !!CXX_HOST!! +CC_BUILD = !!CC_BUILD!! +WINDRES = !!WINDRES!! +STRIP = !!STRIP!! +CC_CFLAGS = !!CC_CFLAGS!! +CFLAGS = !!CFLAGS!! +CFLAGS_BUILD = !!CFLAGS_BUILD!! +LIBS = !!LIBS!! +LDFLAGS = !!LDFLAGS!! +BIN_DIR = !!BIN_DIR!! +LANG_DIR = !!LANG_DIR!! +SRC_OBJS_DIR = !!SRC_OBJS_DIR!! +LANG_OBJS_DIR= !!LANG_OBJS_DIR!! +SRC_DIR = !!SRC_DIR!! +MEDIA_DIR = !!MEDIA_DIR!! +TTD = !!TTD!! +STRGEN = !!STRGEN!! +ENDIAN_CHECK = !!ENDIAN_CHECK!! +ENDIAN_FORCE = !!ENDIAN_FORCE!! +OS = !!OS!! +STAGE = !!STAGE!! +MAKEDEPEND = !!MAKEDEPEND!! +CFLAGS_MAKEDEP= !!CFLAGS_MAKEDEP!! +SORT = !!SORT!! +CONFIG_CACHE_COMPILER = $(SRC_OBJS_DIR)/!!CONFIG_CACHE_COMPILER!! +CONFIG_CACHE_LINKER = $(SRC_OBJS_DIR)/!!CONFIG_CACHE_LINKER!! +CONFIG_CACHE_ENDIAN = $(SRC_OBJS_DIR)/!!CONFIG_CACHE_ENDIAN!! +CONFIG_CACHE_SOURCE = $(SRC_OBJS_DIR)/!!CONFIG_CACHE_SOURCE!! +CONFIG_CACHE_VERSION = $(SRC_OBJS_DIR)/!!CONFIG_CACHE_VERSION!! + +OBJS_C := !!OBJS_C!! +OBJS_CPP := !!OBJS_CPP!! +OBJS_M := !!OBJS_M!! +OBJS_RC := !!OBJS_RC!! +OBJS := $(OBJS_C) $(OBJS_CPP) $(OBJS_M) $(OBJS_RC) +SRCS := !!SRCS!! + +# All C-files depend on those 3 files +FILE_DEP := $(CONFIG_CACHE_COMPILER) $(LANG_OBJS_DIR)/table/strings.h endian_target.h +# Create all dirs and subdirs +RES := $(shell mkdir -p $(BIN_DIR) $(sort $(dir $(OBJS)))) + +# Make sure endian_target.h is reasable as if it was in the src/ dir +CFLAGS += -I $(SRC_OBJS_DIR) -I $(LANG_OBJS_DIR) + +ENDIAN_TARGETS := endian_target.h $(ENDIAN_CHECK) + +# Check if we want to show what we are doing +ifdef VERBOSE + Q = + E = @true +else + Q = @ + E = @echo +endif + +# Our default target +all: $(TTD) + +# This are 2 rules that are pointing back to STRGEN stuff. +# There is not really a need to have them here, but in case +# some weirdo wants to run 'make' in the 'src' dir and expects +# the languages to be recompiled, this catches that case and +# takes care of it nicely. +$(LANG_OBJS_DIR)/$(STRGEN): + $(MAKE) -C $(LANG_OBJS_DIR) $(STRGEN) + +$(LANG_OBJS_DIR)/table/strings.h: $(LANG_DIR)/english.txt $(LANG_OBJS_DIR)/$(STRGEN) + $(MAKE) -C $(LANG_OBJS_DIR) table/strings.h + +# Make the revision number +ifdef REVISION +REV := $(REVISION) +else +# Are we a SVN dir? +ifeq ($(shell if test -d $(SRC_DIR)/.svn; then echo 1; fi), 1) +# Find if the local source if modified +REV_MODIFIED := $(shell svnversion $(SRC_DIR) | sed -n 's/.*\(M\).*/\1/p' ) +# Find the revision like: rXXXX-branch +REV := $(shell LC_ALL=C svn info $(SRC_DIR) | awk '/^URL:.*branch/ { split($$2, a, "/"); BRANCH="-"a[5] } /^Last Changed Rev:/ { REV="r"$$4"$(REV_MODIFIED)" } END { print REV BRANCH }') +endif +endif +# Make sure we have something in REV +ifeq ($(REV),) +REV := norev000 +endif + +# This helps to recompile if flags change +RES := $(shell if [ "`cat $(CONFIG_CACHE_COMPILER) 2>/dev/null`" != "$(CC_CFLAGS) $(CFLAGS)" ]; then echo "$(CC_CFLAGS) $(CFLAGS)" > $(CONFIG_CACHE_COMPILER); fi ) +RES := $(shell if [ "`cat $(CONFIG_CACHE_LINKER) 2>/dev/null`" != "$(LDFLAGS) $(LIBS)" ]; then echo "$(LDFLAGS) $(LIBS)" > $(CONFIG_CACHE_LINKER); fi ) +RES := $(shell if [ "`cat $(CONFIG_CACHE_ENDIAN) 2>/dev/null`" != "$(ENDIAN_FORCE)" ]; then echo "$(ENDIAN_FORCE)" > $(CONFIG_CACHE_ENDIAN); fi ) + +# If there is a change in the source-file-list, make sure we recheck the deps +RES := $(shell if [ "`cat $(CONFIG_CACHE_SOURCE) 2>/dev/null`" != "$(SRCS)" ]; then echo "$(SRCS)" > $(CONFIG_CACHE_SOURCE); fi ) +# If there is a change in the revision, make sure we recompile rev.c +RES := $(shell if [ "`cat $(CONFIG_CACHE_VERSION) 2>/dev/null`" != "$(REV)" ]; then echo "$(REV)" > $(CONFIG_CACHE_VERSION); fi ) + +ifndef MAKEDEPEND +# The slow, but always correct, dep-check +DEP_MASK := %.d +DEPS := $(OBJS:%.o=%.d) + +# Only include the deps if we are compiling everything +ifeq ($(filter $(ENDIAN_TARGETS) %.o clean mrproper, $(MAKECMDGOALS)),) +-include $(DEPS) +else +# In case we want to compile a single target, include the .d file for it +ifneq ($(filter %.o, $(MAKECMDGOALS)),) +SINGLE_DEP := $(filter %.o, $(MAKECMDGOALS)) +-include $(SINGLE_DEP:%.o=%.d) +endif +endif + +# Find the deps via GCC. Rarely wrong, but a bit slow + +$(OBJS_C:%.o=%.d): %.d: $(SRC_DIR)/%.c $(FILE_DEP) + $(E) '$(STAGE) DEP $(<:$(SRC_DIR)/%.c=%.c)' + $(Q)$(CC_HOST) $(CC_CFLAGS) $(CFLAGS) -MM $< | sed 's#^$(@F:%.d=%.o):#$@ $(@:%.d=%.o):#' > $@ + +$(OBJS_CPP:%.o=%.d): %.d: $(SRC_DIR)/%.cpp $(FILE_DEP) + $(E) '$(STAGE) DEP $(<:$(SRC_DIR)/%.cpp=%.cpp)' + $(Q)$(CXX_HOST) $(CFLAGS) -MM $< | sed 's#^$(@F:%.d=%.o):#$@ $(@:%.d=%.o):#' > $@ + +$(OBJS_M:%.o=%.d): %.d: $(SRC_DIR)/%.m $(FILE_DEP) + $(E) '$(STAGE) DEP $(<:$(SRC_DIR)/%.m=%.m)' + $(Q)$(CC_HOST) $(CC_CFLAGS) $(CFLAGS) -MM $< | sed 's#^$(@F:%.d=%.o):#$@ $(@:%.d=%.o):#' > $@ + +else +# The much faster, but can be wrong, dep-check +DEP_MASK := +DEPS := Makefile.dep + +# Only include the deps if we are not cleaning +ifeq ($(filter $(ENDIAN_TARGETS) depend clean mrproper, $(MAKECMDGOALS)),) +-include Makefile.dep +endif + +# Make sure that only 'make depend' ALWAYS triggers a recheck +ifeq ($(filter depend, $(MAKECMDGOALS)),) +Makefile.dep: $(FILE_DEP) $(SRCS:%=$(SRC_DIR)/%) $(CONFIG_CACHE_SOURCE) +else +Makefile.dep: FORCE +endif + $(E) '$(STAGE) DEP CHECK (all files)' + $(Q)rm -f Makefile.dep.tmp + $(Q)touch Makefile.dep.tmp + +# Calculate the deps via makedepend + $(Q)$(MAKEDEPEND) -f$(SRC_OBJS_DIR)/Makefile.dep.tmp -o.o -Y -v -- $(CFLAGS_MAKEDEP) -- $(SRCS:%=$(SRC_DIR)/%) 2>/dev/null + +# Convert x:/... paths to /x/... for mingw +ifeq ($(OS), MINGW) + @cat Makefile.dep.tmp | sed 's@\([a-zA-Z]\):/@/\1/@g' > Makefile.dep.tmp.mingw + @cp Makefile.dep.tmp.mingw Makefile.dep.tmp + @rm -f Makefile.dep.tmp.mingw +endif + +# Remove all comments and includes that don't start with $(SRC_DIR) +# Remove $(SRC_DIR) from object-file-name + @awk ' \ + /^# DO NOT/ { print $$0 ; next} \ + /^#/ {next} \ + /:/ { \ + left = NF - 1; \ + for (n = 2; n <= NF; n++) { \ + if (match($$n, "^$(SRC_DIR)") == 0) { \ + $$n = ""; \ + left--; \ + } \ + } \ + gsub("$(SRC_DIR)/", "", $$1); \ + if (left > 0) { \ + print $$0; \ + $$1 = "Makefile.dep:"; \ + print $$0; \ + } \ + next \ + } \ + { \ + print $$0 \ + } \ + ' < Makefile.dep.tmp | sed 's/ */ /g;s/ $$//' | $(SORT) > Makefile.dep + + $(Q)rm -f Makefile.dep.tmp Makefile.dep.tmp.bak + +endif + +# Avoid problems with deps if a .h file is deleted without the deps +# being updated. Now the Makefile continues, the deps are recreated +# and all will be fine. +%.h: + @true + + +# Compile all the files according to the targets + +$(OBJS_C): %.o: $(SRC_DIR)/%.c $(DEP_MASK) $(FILE_DEP) + $(E) '$(STAGE) Compiling $(<:$(SRC_DIR)/%.c=%.c)' + $(Q)$(CC_HOST) $(CC_CFLAGS) $(CFLAGS) -c -o $@ $< + +$(OBJS_CPP): %.o: $(SRC_DIR)/%.cpp $(DEP_MASK) $(FILE_DEP) + $(E) '$(STAGE) Compiling $(<:$(SRC_DIR)/%.cpp=%.cpp)' + $(Q)$(CXX_HOST) $(CFLAGS) -c -o $@ $< + +$(OBJS_M): %.o: $(SRC_DIR)/%.m $(DEP_MASK) $(FILE_DEP) + $(E) '$(STAGE) Compiling $(<:$(SRC_DIR)/%.m=%.m)' + $(Q)$(CC_HOST) $(CC_CFLAGS) $(CFLAGS) -c -o $@ $< + +$(OBJS_RC): %.o: $(SRC_DIR)/%.rc $(FILE_DEP) + $(E) '$(STAGE) Compiling resource $(<:$(SRC_DIR)/%.rc=%.rc)' + $(Q)$(WINDRES) -o $@ -I $(MEDIA_DIR) $< + +$(TTD): rev.o $(OBJS) $(CONFIG_CACHE_LINKER) + $(E) '$(STAGE) Linking $@' + $(Q)$(CXX_HOST) $(LDFLAGS) rev.o $(OBJS) $(LIBS) -o $@ && cp $@ $(BIN_DIR)/ +ifdef STRIP + $(Q)$(STRIP) $@ +endif + +# The targets to compile the endian-code + +endian_target.h: $(ENDIAN_CHECK) $(CONFIG_CACHE_ENDIAN) + $(E) '$(STAGE) Testing endianness for target' + $(Q)./$(ENDIAN_CHECK) $(ENDIAN_FORCE) > $@ + +$(ENDIAN_CHECK): $(SRC_DIR)/endian_check.c + $(E) '$(STAGE) Compiling and Linking $@' + $(Q)$(CC_BUILD) $(CFLAGS_BUILD) $< -o $@ + +# Revision files + +rev.c: $(CONFIG_CACHE_VERSION) +# setting the revision number in a place, there the binary can read it + @echo 'const char _openttd_revision[] = "$(REV)";' > rev.c +# Some additions for MorphOS versions tag +ifeq ($(OS),MORPHOS) + @echo '#ifdef __MORPHOS__' >> rev.c + @echo 'const char morphos_versions_tag[] = "\\0$$VER: OpenTTD $(REV) ('`date +%d.%m.%y`') (C) OpenTTD Team [MorphOS, PowerPC]";' >> rev.c + @echo '#endif' >> rev.c +endif + +rev.o: rev.c $(FILE_DEP) + $(E) '$(STAGE) Compiling $(<:$(SRC_DIR)/%.c=%.c)' + $(Q)$(CC_HOST) $(CC_CFLAGS) $(CFLAGS) -c -o $@ $< + +FORCE: + +depend: $(DEPS) + +clean: + $(E) '$(STAGE) Cleaning up object files' + $(Q)rm -f $(DEPS) $(OBJS) $(TTD) $(TTD:%=$(BIN_DIR)/%) $(CONFIG_CACHE_COMPILER) $(CONFIG_CACHE_LINKER) $(CONFIG_CACHE_ENDIAN) $(CONFIG_CACHE_SOURCE) $(ENDIAN_TARGETS) rev.o + +mrproper: clean + $(Q)rm -f rev.c + +%.o: + @echo '$(STAGE) No such source-file: $(@:%.o=%).[c|cpp|m|rc]' + +.PHONY: all mrproper depend clean FORCE diff --git a/data/2ccmap.grf b/bin/data/2ccmap.grf similarity index 100% rename from data/2ccmap.grf rename to bin/data/2ccmap.grf diff --git a/data/airports.grf b/bin/data/airports.grf similarity index 100% rename from data/airports.grf rename to bin/data/airports.grf diff --git a/data/autorail.grf b/bin/data/autorail.grf similarity index 100% rename from data/autorail.grf rename to bin/data/autorail.grf diff --git a/data/canalsw.grf b/bin/data/canalsw.grf similarity index 100% rename from data/canalsw.grf rename to bin/data/canalsw.grf diff --git a/data/dosdummy.grf b/bin/data/dosdummy.grf similarity index 100% rename from data/dosdummy.grf rename to bin/data/dosdummy.grf diff --git a/data/elrailsw.grf b/bin/data/elrailsw.grf similarity index 100% rename from data/elrailsw.grf rename to bin/data/elrailsw.grf diff --git a/data/nsignalsw.grf b/bin/data/nsignalsw.grf similarity index 100% rename from data/nsignalsw.grf rename to bin/data/nsignalsw.grf diff --git a/data/openttd.grf b/bin/data/openttd.grf similarity index 100% rename from data/openttd.grf rename to bin/data/openttd.grf diff --git a/data/opntitle.dat b/bin/data/opntitle.dat similarity index 100% rename from data/opntitle.dat rename to bin/data/opntitle.dat diff --git a/data/trkfoundw.grf b/bin/data/trkfoundw.grf similarity index 100% rename from data/trkfoundw.grf rename to bin/data/trkfoundw.grf diff --git a/scenario/README b/bin/scenario/README similarity index 100% rename from scenario/README rename to bin/scenario/README diff --git a/scripts/autoexec.scr.example b/bin/scripts/autoexec.scr.example similarity index 100% rename from scripts/autoexec.scr.example rename to bin/scripts/autoexec.scr.example diff --git a/scripts/on_client.scr.example b/bin/scripts/on_client.scr.example similarity index 100% rename from scripts/on_client.scr.example rename to bin/scripts/on_client.scr.example diff --git a/scripts/on_dedicated.scr.example b/bin/scripts/on_dedicated.scr.example similarity index 100% rename from scripts/on_dedicated.scr.example rename to bin/scripts/on_dedicated.scr.example diff --git a/scripts/on_server.scr.example b/bin/scripts/on_server.scr.example similarity index 100% rename from scripts/on_server.scr.example rename to bin/scripts/on_server.scr.example diff --git a/scripts/pre_dedicated.scr.example b/bin/scripts/pre_dedicated.scr.example similarity index 100% rename from scripts/pre_dedicated.scr.example rename to bin/scripts/pre_dedicated.scr.example diff --git a/scripts/pre_server.scr.example b/bin/scripts/pre_server.scr.example similarity index 100% rename from scripts/pre_server.scr.example rename to bin/scripts/pre_server.scr.example diff --git a/scripts/readme.txt b/bin/scripts/readme.txt similarity index 100% rename from scripts/readme.txt rename to bin/scripts/readme.txt diff --git a/config.lib b/config.lib new file mode 100644 index 0000000000..bbbaf0d9f8 --- /dev/null +++ b/config.lib @@ -0,0 +1,2212 @@ + +log() { + if [ $1 = "1" ]; then echo "$2"; fi + echo "$2" >> $config_log +} + +set_default() { + ignore_extra_parameters="0" + # We set all kinds of defaults for params. Later on the user can override + # most of them; but if they don't, this default is used. + build="" + host="" + cc_build="" + cc_host="" + cxx_host="" + windres="" + strip="" + lipo="" + os="DETECT" + endian="AUTO" + revision="" + config_log="config.log" + prefix_dir="/usr/local" + binary_dir="games" + data_dir="share/games/openttd" + icon_dir="share/pixmaps" + personal_dir="" + custom_lang_dir="" + second_data_dir="" + install_dir="/" + enable_install="0" + enable_debug="0" + enable_profiling="0" + enable_dedicated="0" + enable_network="1" + enable_static="1" + enable_translator="0" + enable_assert="1" + enable_strip="1" + enable_universal="1" + enable_osx_g5="0" + with_osx_sysroot="1" + with_application_bundle="1" + with_sdl="1" + with_cocoa="1" + with_zlib="1" + with_png="1" + with_makedepend="1" + with_direct_music="1" + with_sort="1" + with_iconv="1" + with_midi="" + with_midi_arg="" + with_freetpye="1" + with_fontconfig="1" + + save_params_array="build host cc_build cc_host cxx_host windres strip lipo os revision endian config_log prefix_dir binary_dir data_dir icon_dir personal_dir install_dir custom_lang_dir second_data_dir enable_install enable_debug enable_profiling enable_dedicated enable_network enable_static enable_translator enable_assert enable_strip with_osx_sysroot enable_universal enable_osx_g5 with_application_bundle with_sdl with_cocoa with_zlib with_png with_makedepend with_direct_music with_sort with_iconv with_midi with_midi_arg with_freetype with_fontconfig CC CXX CFLAGS LDFLAGS" +} + +detect_params() { + # Walk over all params from the user and override any default settings if + # needed. This also handles any invalid option. + for p in "$@" + do + if [ -n "$prev_p" ] + then + eval "$prev_p=\$p" + prev_p= + continue + fi + + optarg=`expr "x$p" : 'x[^=]*=\(.*\)'` + + case "$p" in + --help | -h) + showhelp + exit 0 + ;; + + --config-log) + prev_p="config_log" + ;; + --config-log=*) + config_log="$optarg" + ;; + + --build) + prev_p="build" + ;; + --build=*) + build="$optarg" + ;; + + --host) + prev_p="host" + ;; + --host=*) + host="$optarg" + ;; + + --os) + prev_p="os" + ;; + --os=*) + os="$optarg" + ;; + + --revision=*) + revision="$optarg" + ;; + + --cc-build) + prevp_p="cc_build" + ;; + --cc-build=*) + cc_build="$optarg" + ;; + --cc-host) + prevp_p="cc_host" + ;; + --cc-host=*) + cc_host="$optarg" + ;; + --cxx-host) + prevp_p="cxx_host" + ;; + --cxx-host=*) + cxx_host="$optarg" + ;; + --windres) + prevp_p="windres" + ;; + --windres=*) + windres="$optarg" + ;; + --strip) + prevp_p="strip" + ;; + --strip=*) + strip="$optarg" + ;; + --lipo) + prevp_p="lipo" + ;; + --lipo=*) + lipo="$optarg" + ;; + + --endian) + prev_p="endian" + ;; + --endian=*) + endian="$optarg" + ;; + + + + --prefix-dir) + prevp_p="prefix-dir" + ;; + --prefix-dir=*) + prefix_dir="$optarg" + ;; + + --binary-dir) + prevp_p="binary-dir" + ;; + --binary-dir=*) + binary_dir="$optarg" + ;; + + --data-dir) + prevp_p="data-dir" + ;; + --data-dir=*) + data_dir="$optarg" + ;; + + --icon-dir) + prevp_p="icon-dir" + ;; + --icon-dir=*) + icon_dir="$optarg" + ;; + + --personal-dir) + prevp_p="personal-dir" + ;; + --personal-dir=*) + personal_dir="$optarg" + ;; + + --install-dir) + prevp_p="install-dir" + ;; + --install-dir=*) + install_dir="$optarg" + ;; + +# TODO: The next few cases will be removed when the search path patch is applied + --custom-lang-dir) + prevp_p="custom-lang-dir" + ;; + --custom-lang-dir=*) + custom_lang_dir="$optarg" + ;; + + --second-data-dir) + prevp_p="second-data-dir" + ;; + --second-data-dir=*) + second_data_dir="$optarg" + ;; + + --enable-install) + enable_install="1" + ;; + --enable-install=*) + enable_install="$optarg" + ;; +# TODO: End of to be removed cases + + + --enable-debug) + enable_debug="1" + ;; + --enable-debug=*) + enable_debug="$optarg" + ;; + --enable-profiling) + enable_profiling="1" + ;; + --enable-profiling=*) + enable_profiling="$optarg" + ;; + --enable-dedicated) + enable_dedicated="1" + ;; + --enable-dedicated=*) + enable_dedicated="$optarg" + ;; + --enable-network=*) + enable_network="$optarg" + ;; + --disable-network) + enable_network="0" + ;; + --disable-static) + enable_static="0" + ;; + --enable-static) + enable_static="2" + ;; + --enable-static=*) + enable_static="$optarg" + ;; + --disable-translator) + enable_translator="0" + ;; + --enable-translator) + enable_translator="2" + ;; + --enable-translator=*) + enable_translator="$optarg" + ;; + --disable-assert) + enable_assert="0" + ;; + --enable-assert) + enable_assert="2" + ;; + --enable-assert=*) + enable_assert="$optarg" + ;; + --disable-strip) + enable_strip="0" + ;; + --enable-strip) + enable_strip="2" + ;; + --enable-strip=*) + enable_strip="$optarg" + ;; + --disable-universal) + enable_universal="0" + ;; + --enable-universal) + enable_universal="2" + ;; + --enable-universal=*) + enable_universal="$optarg" + ;; + --disable-osx-g5) + enable_osx_g5="0" + ;; + --enable-osx-g5) + enable_osx_g5="2" + ;; + --enable-osx-g5=*) + enable_osx_g5="$optarg" + ;; + + --with-sdl) + with_sdl="2" + ;; + --without-sdl) + with_sdl="0" + ;; + --with-sdl=*) + with_sdl="$optarg" + ;; + + --with-cocoa) + with_cocoa="2" + ;; + --without-cocoa) + with_cocoa="0" + ;; + --with-cocoa=*) + with_cocoa="$optarg" + ;; + + --with-zlib) + with_zlib="2" + ;; + --without-zlib) + with_zlib="0" + ;; + --with-zlib=*) + with_zlib="$optarg" + ;; + + --with-png) + with_png="2" + ;; + --without-png) + with_png="0" + ;; + --with-png=*) + with_png="$optarg" + ;; + --with-libpng) + with_png="2" + ;; + --without-libpng) + with_png="0" + ;; + --with-libpng=*) + with_png="$optarg" + ;; + + --with-freetype) + with_freetype="2" + ;; + --without-freetype) + with_freetype="0" + ;; + --with-freetype=*) + with_freetype="$optarg" + ;; + --with-libfreetype) + with_freetype="2" + ;; + --without-libfreetype) + with_freetype="0" + ;; + --with-libfreetype=*) + with_freetype="$optarg" + ;; + + --with-fontconfig) + with_fontconfig="2" + ;; + --without-fontconfig) + with_fontconfig="0" + ;; + --with-fontconfig=*) + with_fontconfig="$optarg" + ;; + --with-libfontconfig) + with_fontconfig="2" + ;; + --without-libfontconfig) + with_fontconfig="0" + ;; + --with-libfontconfig=*) + with_fontconfig="$optarg" + ;; + + --with-makedepend) + with_makedepend="2" + ;; + --without-makedepend) + with_makedepend="0" + ;; + --with-makedepend=*) + with_makedepend="$optarg" + ;; + + --with-direct-music) + with_direct_music="2" + ;; + --without-direct-music) + with_direct_music="0" + ;; + --with-direct-music=*) + with_direct_music="$optarg" + ;; + + --with-sort) + with_sort="2" + ;; + --without-sort) + with_sort="0" + ;; + --with-sort=*) + with_sort="$optarg" + ;; + + --with-iconv) + with_iconv="2" + ;; + --without-iconv) + with_iconv="0" + ;; + --with-iconv=*) + with_iconv="$optarg" + ;; + + --with-midi=*) + with_midi="$optarg" + ;; + --with-midi-arg=*) + with_midi_arg="$optarg" + ;; + + --without-osx-sysroot) + with_osx_sysroot="0" + ;; + --with-osx-sysroot) + with_osx_sysroot="2" + ;; + --with-osx-sysroot=*) + with_osx_sysroot="$optarg" + ;; + + --without-application-bundle) + with_applicant_bundle="0" + ;; + --with-application-bundle) + with_applicant_bundle="1" + ;; + --with-application-bundle=*) + with_applicant_bundle="$optarg" + ;; + + CC=* | --CC=*) + CC="$optarg" + ;; + CXX=* | --CXX=*) + CXX="$optarg" + ;; + CFLAGS=* | --CFLAGS=*) + CFLAGS="$optarg" + ;; + LDFLAGS=* | --LDFLAGS=*) + LDFLAGS="$optarg" + ;; + + --ignore-extra-parameters) + ignore_extra_parameters="1" + ;; + + --*) + if [ "$ignore_extra_parameters" = "0" ] + then + echo "Unknown option $p" + exit 1 + else + echo "Unknown option $p ignored" + fi + ;; + esac + done + + if [ -n "$prev_p" ] + then + echo "configure: error: missing argument to --$prev_p" + exit 1 + fi + + # Clean the logfile + echo "" > $config_log +} + +save_params() { + # Here we save all params, so we can later on do an exact redo of this + # configuration, without having the user to re-input stuff + + echo "Running configure with following options:" >> $config_log + echo "" >> $config_log + + configure="$0 --ignore-extra-parameters" + for p in $save_params_array + do + eval "v=\$$p" + p=`echo "$p" | sed 's/_/-/g;s/\n//g;'` + # Only save those params that aren't empty + configure="$configure --$p=$v" + done + + echo "$configure" >> $config_log + echo "$configure" > config.cache + echo "" >> $config_log +} + +check_params() { + # Some params want to be in full uppercase, else they might not work as + # expected.. fix that here + + endian=`echo $endian | tr [:lower:] [:upper:]` + os=`echo $os | tr [:lower:] [:upper:]` + + # Check if all params have valid values + + # Endian only allows AUTO, LE and, BE + if ! echo $endian | grep -q "^AUTO$\|^LE$\|^BE$" + then + echo "configure: error: invalid option --endian=$endian" + echo " Available options are: --endian=[AUTO|LE|BE]" + exit 1 + fi + # OS only allows DETECT, UNIX, OSX, FREEBSD, MORPHOS, BEOS, SUNOS, CYGWIN, and MINGW, OS2 + if ! echo $os | grep -q "^DETECT$\|^UNIX$\|^OSX$\|^FREEBSD$\|^MORPHOS$\|^BEOS$\|^SUNOS$\|^CYGWIN$\|^MINGW$\|^OS2" + then + echo "configure: error: invalid option --os=$os" + echo " Available options are: --os=[DETECT|UNIX|OSX|FREEBSD|MORPHOS|BEOS|SUNOS|CYGWIN|MINGW|OS2]" + exit 1 + fi + # enable_debug should be between 0 and 4 + if ! echo $enable_debug | grep -q "^0$\|^1$\|^2$\|^3$" + then + echo "configure: error: invalid option --enable-debug=$enable_debug" + echo " Available options are: --enable-debug[=0123]" + exit 1 + fi + + check_build + check_host + + detect_os + +# We might enable universal builds always on OSX targets.. but currently we don't +# if [ "$enable_universal" = "1" ] && [ "$os" != "OSX" ] + if [ "$enable_universal" = "1" ] + then + enable_universal="0" + fi + if [ "$enable_universal" = "2" ] && [ "$os" != "OSX" ] + then + log 1 "configure: error: --enable-universal only works on OSX" + exit 1 + fi + if [ "$enable_universal" = "0" ] + then + log 1 "checking universal build... no" + else + log 1 "checking universal build... yes" + fi + + # Already detected by check_build + log 1 "checking for build gcc... $cc_build" + log 1 "checking for host gcc... $cc_host" + + check_cxx + check_windres + check_strip + check_lipo + check_makedepend + + if [ "$enable_static" = "1" ] + then + if [ "$os" = "MINGW" ] || [ "$os" = "CYGWIN" ] || [ "$os" = "MORPHOS" ] || [ "$os" = "OSX" ] + then + enable_static="2" + else + enable_static="0" + fi + fi + + if [ "$enable_static" != "0" ] + then + log 1 "checking for static... yes" + + if [ "$os" != "MINGW" ] && [ "$os" != "CYGWIN" ] && [ "$os" != "OSX" ] && [ "$os" != "MORPHOS" ] + then + log 1 "WARNING: static is only known to work on Windows, MacOSX and MorphOS" + log 1 "WARNING: use static at your own risk on this platform" + + sleep 5 + fi + else + log 1 "checking for static... no" + fi + + # Show what we configured + if [ "$enable_debug" = "0" ] + then + log 1 "using debug level... no" + elif [ "$enable_profiling" != "0" ] + then + log 1 "using debug level... profiling (debug level $enable_debug)" + else + log 1 "using debug level... level $enable_debug" + fi + + detect_sdl + detect_cocoa + + if [ "$enable_dedicated" != "0" ] + then + log 1 "checking GDI video driver... skipping" + log 1 "checking dedicated... found" + + if [ "$enable_network" != "0" ] + then + log 1 "WARNING: compiling a dedicated server without network is pointless" + sleep 5 + fi + else + if [ "$os" = "MINGW" ] || [ "$os" = "CYGWIN" ] + then + log 1 "checking GDI video driver... found" + else + log 1 "checking GDI video driver... not Windows, skipping" + fi + + if [ -z "$sdl_config" ] && [ "$with_cocoa" = 0 ] && [ "$os" != "MINGW" ] && [ "$os" != "CYGWIN" ] + then + log 1 "WARNING: no video driver found, building dedicated only" + enable_dedicated="1" + sleep 1 + + log 1 "checking dedicated... found" + else + log 1 "checking dedicated... not selected" + fi + fi + + if [ "$enable_network" != "0" ] + then + log 1 "checking network... found" + else + log 1 "checking network... disabled" + fi + + if [ "$enable_translator" != "0" ] + then + log 1 "checking translator... debug" + strgen_flags="" + else + log 1 "checking translator... no" + # -t shows TODO items, normally they are muted + strgen_flags="-t" + fi + + if [ "$enable_assert" != "0" ] + then + log 1 "checking assert... enabled" + else + log 1 "checking assert... disabled" + fi + + detect_zlib + detect_png + detect_freetype + detect_fontconfig + detect_iconv + + if [ "$with_direct_music" = "1" ] || [ "$with_direct_music" = "2" ] + then + if [ "$os" != "MINGW" ] && [ "$os" != "CYGWIN" ] + then + if [ "$with_direct_music" = "2" ] + then + log 1 "configure: error: direct-music is only supported on Win32 targets" + exit 1 + fi + with_direct_music="0" + + log 1 "checking direct-music... not Windows, skipping" + else + check_direct_music + fi + fi + + detect_sort + + if [ "$os" = "OSX" ] && [ "$endian" = "AUTO" ] + then + endian="PREPROCESSOR" + fi + + log 1 "checking endianess... $endian" + + # Suppress language errors when there is a version defined, indicating a release + # It just isn't pretty if any release produces warnings in the languages. + if [ -f "$ROOT_DIR/version" ] + then + lang_suppress="yes" + log 1 "suppress language errors... yes" + else + lang_suppress="" + log 1 "suppress language errors... no" + fi + + if [ "$enable_debug" = "0" ] && [ "$enable_profiling" = "0" ] && [ "$enable_strip" != "0" ] + then + if [ "$os" = "MORPHOS" ] + then + strip_arg="--strip-all --strip-unneeded --remove-section .comment" + elif [ "$os" = "OSX" ] + then + strip_arg="" + else + strip_arg="-s" + fi + + log 1 "checking stripping... $strip $strip_arg" + else + strip="" + log 1 "checking stripping... skipped" + fi + + if [ "$os" != "OSX" ] && [ "$with_osx_sysroot" != "0" ] + then + if [ "$with_osx_sysroot" = "1" ] + then + with_osx_sysroot="0" + + log 1 "checking OSX sysroot... not OSX, skipping" + else + log 1 "configure: error: --with-osx-sysroot only works if OSX is the target" + exit 1 + fi + fi + + if [ "$with_osx_sysroot" != "0" ] + then + if [ "$enable_universal" = "0" ] && [ "$with_osx_sysroot" != "1" ] && [ "$with_osx_sysroot" != "2" ] + then + log 1 "checking OSX sysroot... $with_osx_sysroot" + else + # If autodetect and no universal, use system default + if [ "$with_osx_sysroot" = "1" ] && [ "$enable_universal" = "0" ] + then + log 1 "checking OSX sysroot... no (use system default)" + with_osx_sysroot="0" + else + log 1 "checking OSX sysroot... automaticly" + with_osx_sysroot="3" + fi + fi + else + if [ "$os" = "OSX" ] + then + log 1 "checking OSX sysroot... no (use system default)" + fi + fi + + if [ "$os" != "OSX" ] && [ "$with_application_bundle" != "0" ] + then + if [ "$with_application_bundle" = "1" ] + then + with_application_bundle="0" + + log 1 "checking OSX application bundle... not OSX, skipping" + else + log 1 "configure: error: --with-application-bundle only works if OSX is the target" + exit 1 + fi + fi + + if [ "$os" = "OSX" ] && [ "$with_application_bundle" = "1" ] + then + OSXAPP="OpenTTD.app" + +# TODO: remove next few lines of code when the search path patch has been applied + if [ -n "$custom_lang_dir" ] && [ "$custom_lang_dir" != "$(OSXAPP)/Contents/Lang/" ] + then + log 1 "configure: error: --custom-lang-dir and --with-application-bundle are not compatible + exit 1 + fi + + if [ -n "$custom_lang_dir" ] && [ "$second_data_dir" != "$(OSXAPP)/Contents/Data/" ] + then + log 1 "configure: error: --second-data-dir and --with-application-bundle are not compatible + exit 1 + fi + + custom_lang_dir="${OSXAPP}/Contents/Lang/" + second_data_dir="${OSXAPP}/Contents/Data/" +# TODO: remove till here + else + OSXAPP="" + fi + + if [ "$os" = "OSX" ] + then + # Test on G5 + + if [ "$enable_osx_g5" != "0" ] + then + log 1 "detecting G5... yes (forced)" + else + # First, are we a real OSX system, else we can't detect it + native=`LC_ALL=C uname | tr [:upper:] [:lower:] | grep darwin` + # If $host doesn't match $build , we are cross-compiling + if [ -n "$native" ] && [ "$build" != "$host" ] + then + $cc_build $SRC_DIR/os/macosx/G5_detector.c -o G5_detector + res=`./G5_detector` + rm -f G5_detector + if [ -n "$res" ] + then + # This is G5, add flags for it + enable_osx_g5="2" + + log 1 "detecting G5... yes" + else + enable_osx_g5="0" + + log 1 "detecting G5... no" + fi + else + enable_osx_g5="0" + + log 1 "detecting G5... no (cross-compiling)" + fi + fi + else + if [ "$enable_osx_g5" != "0" ] + then + log 1 "configure: error: OSX G5 selected, but not compiling for OSX" + log 1 "configure: error: either select OSX as OS, or deselect OSX G5" + + exit 1 + fi + fi +} + +make_cflags_and_ldflags() { + # General CFlags for BUILD + CFLAGS_BUILD="" + # General CFlags for HOST + CFLAGS="$CFLAGS -D$os -DWITH_REV" + # CFlags for HOST and C-Compiler + CC_FLAGS="" + # Libs to compile. In fact this is just LDFLAGS + LIBS="-lstdc++" + # LDFLAGS used for HOST + LDFLAGS="$LDFLAGS" + + # Each debug level reduces the optimalization by a bit + if [ $enable_debug -ge 1 ] + then + CFLAGS="$CFLAGS -g -D_DEBUG" + OBJS_SUBDIR="debug" + else + OBJS_SUBDIR="release" + fi + if [ $enable_debug -ge 2 ] + then + CFLAGS="$CFLAGS -fno-inline" + fi + if [ $enable_debug -ge 3 ] + then + CFLAGS="$CFLAGS -O0" + fi + if [ $enable_debug = 0 ] + then + # No debug, add default stuff + if [ "$os" = "OSX" ] + then + # these compilerflags makes the app run as fast as possible without making the app unstable. It works on G3 or newer + CFLAGS="$CFLAGS -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" + else + if [ "$os" = "MORPHOS" ] + then + CFLAGS="$CFLAGS -I/gg/os-include -noixemul -fstrict-aliasing -fexpensive-optimizations" + CFLAGS="$CFLAGS -mcpu=604 -fno-inline -mstring -mmultiple" + fi + + CFLAGS="$CFLAGS -O2 -fomit-frame-pointer" + fi + + if [ "$enable_profiling" != "0" ] + then + CFLAGS="$CFLAGS -pg" + LDFLAGS="$LDFLAGS -pg" + fi + else + if [ "$enable_profiling" != "0" ] + then + CFLAGS="$CFLAGS -p" + LDFLAGS="$LDFLAGS -pg" + fi + fi + + # Enable some things only for certain GCC versions + cc_version=`$cc_host -dumpversion | cut -c 1,3` + + if [ $cc_version -ge 29 ] + then + CFLAGS="$CFLAGS -O -Wall -Wno-multichar -Wsign-compare -Wundef" + CFLAGS="$CFLAGS -Wwrite-strings -Wpointer-arith" + + CC_CFLAGS="$CC_CFLAGS -Wstrict-prototypes" + fi + + if [ $cc_version -ge 30 ] + then + CFLAGS="$CFLAGS -W -Wno-unused-parameter" + fi + + if [ $cc_version -ge 34 ] + then + CC_CFLAGS="$CC_CFLAGS -Wdeclaration-after-statement -Wold-style-definition" + fi + + if [ "$os" = "CYGWIN" ] + then + CFLAGS="$CFLAGS -mwin32" + LDFLAGS="$LDFLAGS -mwin32" + fi + if [ "$os" = "MINGW" ] + then + CFLAGS="$CFLAGS -mno-cygwin" + LDFLAGS="$LDFLAGS -mno-cygwin" + fi + + if [ "$os" = "CYGWIN" ] || [ "$os" = "MINGW" ] + then + LDFLAGS="$LDFLAGS -Wl,--subsystem,windows" + LIBS="$LIBS -lws2_32 -lwinmm -lgdi32 -ldxguid -lole32" + fi + + if [ "$os" != "CYGWIN" ] && [ "$os" != "MINGW" ] && [ "$os" != "MORPHOS" ] && [ "$os" != "OSX" ] + then + LIBS="$LIBS -lpthread" + LIBS="$LIBS -lrt" + fi + + if [ "$os" != "MINGW" ] + then + LIBS="$LIBS -lc" + fi + + if [ "$os" = "MORPHOS" ] + then + # -Wstrict-prototypes generates much noise because of system headers + CFLAGS="$CFLAGS -Wno-strict-prototypes" + fi + + if [ "$os" = "OSX" ] + then + LDFLAGS="$LDFLAGS -framework Cocoa" + if [ "$enable_dedicated" = "0" ] + then + LIBS="$LIBS -framework QuickTime" + fi + fi + + if [ "$os" = "BEOS" ] + then + LIBS="$LIBS -lmidi -lbe" + fi + + # Most targets act like UNIX, just with some additions + if [ "$os" = "BEOS" ] || [ "$os" = "OSX" ] || [ "$os" = "MORPHOS" ] || [ "$os" = "FREEBSD" ] || [ "$os" = "SUNOS" ] || [ "$os" = "OS2" ] + then + CFLAGS="$CFLAGS -DUNIX" + fi + # And others like Windows + if [ "$os" = "MINGW" ] || [ "$os" = "CYGWIN" ] + then + CFLAGS="$CFLAGS -DWIN" + fi + + if [ -n "$sdl_config" ] + then + CFLAGS="$CFLAGS -DWITH_SDL" + CFLAGS="$CFLAGS `$sdl_config --cflags`" + if [ "$enable_static" != "0" ] + then + LIBS="$LIBS `$sdl_config --static-libs`" + else + LIBS="$LIBS `$sdl_config --libs`" + fi + fi + + if [ "$with_cocoa" != "0" ] + then + CFLAGS="$CFLAGS -DWITH_COCOA" + LIBS="$LIBS -F/System/Library/Frameworks -framework Cocoa -framework Carbon -framework AudioUnit" + fi + + if [ "$with_zlib" != "0" ] + then + if [ "$enable_static" != "0" ] && [ "$os" != "OSX" ] + then + LIBS="$LIBS $zlib" + else + LIBS="$LIBS -lz" + fi + CFLAGS="$CFLAGS -DWITH_ZLIB" + fi + + if [ -n "$png_config" ] + then + CFLAGS="$CFLAGS -DWITH_PNG" + CFLAGS="$CFLAGS `$png_config --cppflags --I_opts | tr '\n\r' ' '`" + + # The extra flags are unneeded for latest libpng-config, but some versions are so broken... + if [ "$enable_static" != "0" ] + then + if [ "$os" = "OSX" ] + then + LIBS="$LIBS `$png_config --prefix`/lib/libpng.a" + else + LIBS="$LIBS `$png_config --static --ldflags --libs --L_opts | tr '\n\r' ' '`" + fi + else + LIBS="$LIBS `$png_config --ldflags --libs --L_opts | tr '\n\r' ' '`" + fi + fi + + if [ -n "$freetype_config" ] + then + CFLAGS="$CFLAGS -DWITH_FREETYPE" + CFLAGS="$CFLAGS `$freetype_config --cflags | tr '\n\r' ' '`" + + if [ "$enable_static" != "0" ] + then + if [ "$os" = "OSX" ] + then + LIBS="$LIBS `$freetype_config --prefix`/lib/libfreetype.a" + else + # Is it possible to do static with freetype, if so: how? + LIBS="$LIBS `$freetype_config --libs | tr '\n\r' ' '`" + fi + else + LIBS="$LIBS `$freetype_config --libs | tr '\n\r' ' '`" + fi + fi + + if [ -n "$fontconfig_config" ] + then + CFLAGS="$CFLAGS -DWITH_FONTCONFIG" + CFLAGS="$CFLAGS `$fontconfig_config --cflags | tr '\n\r' ' '`" + + if [ "$enable_static" != "0" ] + then + if [ "$os" = "OSX" ] + then + LIBS="$LIBS `$fontconfig_config --prefix`/lib/libfontconfig.a" + else + LIBS="$LIBS `$fontconfig_config --libs --static | tr '\n\r' ' '`" + fi + else + LIBS="$LIBS `$fontconfig_config --libs | tr '\n\r' ' '`" + fi + fi + + if [ "$with_direct_music" != "0" ] + then + CFLAGS="$CFLAGS -DWIN32_ENABLE_DIRECTMUSIC_SUPPORT" + fi + + if [ "$with_iconv" != "0" ] + then + CFLAGS="$CFLAGS -DWITH_ICONV" + LIBS="$LIBS -liconv" + if [ "$with_iconv" != "2" ] + then + CFLAGS="$CFLAGS -I$with_iconv/include" + LIBS="$LIBS -L$with_iconv/lib" + fi + fi + + if [ -n "$with_midi" ] + then + CFLAGS="$CFLAGS -DEXTERNAL_PLAYER=\"$with_midi\"" + fi + if [ -n "$with_midi_arg" ] + then + CFLAGS="$CFLAGS -DMIDI_ARG=\"$with_midi_arg\"" + fi + + if [ "$enable_dedicated" != "0" ] + then + CFLAGS="$CFLAGS -DDEDICATED" + fi + + if [ "$enable_network" != "0" ] + then + CFLAGS="$CFLAGS -DENABLE_NETWORK" + + if [ "$os" = "BEOS" ] + then + LDFLAGS="$LDFLAGS -lbind -lsocket" + fi + + if [ "$os" = "SUNOS" ] + then + LDFLAGS="$LDFLAGS -lnsl -lsocket" + fi + fi + + if [ "$enable_static" != "0" ] + then + # OSX can't handle -static in LDFLAGS + if [ "$os" != "OSX" ] + then + LDFLAGS="$LDFLAGS -static" + fi + fi + + if [ "$enable_assert" = "0" ] + then + CFLAGS="$CFLAGS -DNDEBUG" + fi + + if [ "$enable_osx_g5" != "0" ] + then + CFLAGS="$CFLAGS -mtune=970 -mcpu=970 -mpowerpc-gpopt" + fi + + if [ "$with_osx_sysroot" != "0" ] && [ "$with_osx_sysroot" != "3" ] + then + CFLAGS="$CFLAGS -isysroot /Developer/SDKs/MacOSX$with_osx_sysroot.sdk" + LDFLAGS="$LDFLAGS -Wl,-syslibroot,/Developer/SDKs/MacOSX$with_osx_sysroot.sdk" + fi + +# TODO: remove next few lines of code when the search path patch has been applied + if [ -n "$second_data_dir" ] + then + CFLAGS="$CFLAGS -DSECOND_DATA_DIR=\\\\\"$second_data_dir\\\\\"" + fi + + if [ -n "$custom_lang_dir" ] + then + CFLAGS="$CFLAGS -DCUSTOM_LANG_DIR=\\\\\"$custom_lang_dir\\\\\"" + fi +# TODO: remove till here + + if [ "$enable_install" = "1" ] + then + if [ -n "$personal_dir" ] + then + CFLAGS="$CFLAGS -DUSE_HOMEDIR=1 -DPERSONAL_DIR=\\\\\"$personal_dir/\\\\\"" + fi + + if [ -n "$data_dir" ] + then + CFLAGS="$CFLAGS -DGAME_DATA_DIR=\\\\\"$prefix_dir/$data_dir/\\\\\"" + fi + + if [ -n "$icon_dir" ] + then + CFLAGS="$CFLAGS -DICON_DIR=\\\\\"$prefix_dir/$icon_dir/\\\\\"" + fi + fi + + if [ -n "$revision" ] + then + log 1 "checking revision... $revision" + log 1 "WARNING: we do not advise you to use this setting" + log 1 "WARNING: in most cases it is not safe for network use" + log 1 "WARNING: USE WITH CAUTION!" + + sleep 5 + elif [ -f "$ROOT_DIR/version" ] + then + revision="`cat $ROOT_DIR/version`" + + log 1 "checking revision... $revision" + else + revision="" + + log 1 "checking revision... svn detection" + fi + + log 1 "using CFLAGS... $CFLAGS $CC_CFLAGS" + log 1 "using LDFLAGS... $LIBS $LDFLAGS" + + # Makedepend doesn't like something like: -isysroot /OSX/blabla + # so convert it to: -isysroot -OSX/blabla. makedepend just ignores + # any - command it doesn't know, so we are pretty save. + # Lovely hackish, not? + # Btw, this almost always comes from outside the configure, so it is + # not something we can control. + if [ "$with_makedepend" != "0" ] + then + cflags_makedep="` echo "$CFLAGS" | sed 's# /# -#g'`" + else + makedepend="" + fi +} + +check_compiler() { + # Params: + # $1 - Type for message (build / host) + # $2 - What to fill with the found compiler + # $3 - System to try + # $4 - Compiler to try + # $5 - Env-setting to try + # $6 - GCC alike to try + # $7 - CC alike to try + # $8 - "0" gcc, "1" g++, "2" windres, "3" strip, "4" lipo + # $9 - What the command is to check for + + if [ -n "$3" ] + then + # Check for system + machine=`$3-$6 $9 2>/dev/null` + ret=$? + eval "$2=$3-$6" + + log 2 "executing $3-$6 $9" + log 2 " returned $machine" + log 2 " exit code $ret" + + if ( [ -z "$machine" ] && [ "$8" != "3" ] ) || [ "$ret" != "0" ] + then + log 1 "checking $1... $3-$6 not found" + log 1 "I couldn't detect any $6 binary for $3" + exit 1 + fi + + if [ "$machine" != "$3" ] && ( [ "$8" = "0" ] || [ "$8" = "1" ] ) + then + log 1 "checking $1... expected $3, found $machine" + log 1 "the compiler suggests it doesn't build code for the machine you specified" + exit 1 + fi + elif [ -n "$4" ] + then + # Check for manual compiler + machine=`$4 $9 2>/dev/null` + ret=$? + eval "$2=$4" + + log 2 "executing $4 $9" + log 2 " returned $machine" + log 2 " exit code $ret" + + if ( [ -z "$machine" ] && [ "$8" != "3" ] ) || [ "$ret" != "0" ] + then + log 1 "checking $1... $4 not found" + log 1 "the selected binary doesn't seem to be a $6 binary" + exit 1 + fi + else + # Nothing given, autodetect + + if [ -n "$5" ] + then + machine=`$5 $9 2>/dev/null` + ret=$? + eval "$2=$5" + + log 2 "executing $5 $9" + log 2 " returned $machine" + log 2 " exit code $ret" + + # The user defined a GCC that doesn't reply to $9.. abort + if ( [ -z "$machine" ] && [ "$8" != "3" ] ) || [ "$ret" != "0" ] + then + log 1 "checking $1... $5 unusable" + log 1 "the CC environment variable is set, but it doesn't seem to be a $6 binary" + log 1 "please redefine the CC/CXX environment to a $6 binary" + exit 1 + fi + else + log 2 "checking $1... CC/CXX not set (skipping)" + + # No $5, so try '$6' + machine=`$6 $9 2>/dev/null` + ret=$? + eval "$2=$6" + + log 2 "executing $6 $9" + log 2 " returned $machine" + log 2 " exit code $ret" + + if ( [ -z "$machine" ] && [ "$8" != "3" ] ) || [ "$ret" != "0" ] + then + # Maybe '$7'? + machine=`$7 $9 2>/dev/null` + ret=$? + eval "$2=$7" + + log 2 "executing $7 $9" + log 2 " returned $machine" + log 2 " exit code $ret" + + # All failed, abort + if [ -z "$machine" ] + then + log 1 "checking $1... $6 not found" + log 1 "I couldn't detect any $6 binary on your system" + log 1 "please define the CC/CXX environment to where it is located" + + exit 1 + fi + fi + fi + fi + + if [ "$8" != "0" ] + then + eval "res=\$$2" + log 1 "checking $1... $res" + else + log 1 "checking $1... $machine" + fi +} + +check_build() { + check_compiler "build system type" "cc_build" "$build" "$cc_build" "$CC" "gcc" "cc" "0" "-dumpmachine" +} + +check_host() { + # By default the host is the build + if [ -z "$host" ]; then host="$build"; fi + check_compiler "host system type" "cc_host" "$host" "$cc_host" "$CC" "gcc" "cc" "0" "-dumpmachine" +} + +check_cxx() { + check_compiler "host g++" "cxx_host" "$host" "$cxx_host" "$CXX" "g++" "c++" 1 "-dumpmachine" +} + +check_windres() { + if [ "$os" = "MINGW" ] || [ "$os" = "CYGWIN" ] + then + check_compiler "host windres" "windres" "$host" "$windres" "$WINDRES" "windres" "windres" "2" "-V" + fi +} + +check_strip() { + if [ "$os" = "OSX" ] + then + # Most targets have -V in strip, to see if they exists... OSX doesn't.. so execute something + echo "int main(int argc, char *argv[]) { }" > strip.test.c + $cc_host strip.test.c -o strip.test + check_compiler "host strip" "strip" "$host" "$strip" "$STRIP" "strip" "strip" "3" "strip.test" + rm -f strip.test.c strip.test + else + check_compiler "host strip" "strip" "$host" "$strip" "$STRIP" "strip" "strip" "3" "-V" + fi +} + +check_lipo() { + if [ "$os" = "OSX" ] && [ "$enable_universal" != "0" ] + then + echo "int main(int argc, char *argv[]) { }" > lipo.test.c + $cc_host lipo.test.c -o lipo.test + check_compiler "host lipo" "lipo" "$host" "$lipo" "$LIPO" "lipo" "lipo" "4" "-info lipo.test" + rm -f lipo.test.c lipo.test + fi +} + +check_direct_music() { + echo " + #include + #include + #include + #include + #include + int main(int argc, char *argv[]) { }" > direct_music.test.c + $cxx_host $CFLAGS direct_music.test.c -o direct_music.test 2> /dev/null + res=$? + rm -f direct_music.test.c direct_music.test + + if [ "$res" != "0" ] + then + if [ "$with_direct_music" = "2" ] + then + log 1 "configure: error: direct-music is not available on this system" + exit 1 + fi + with_direct_music="0" + + log 1 "checking direct-music... not found" + else + log 1 "checking direct-music... found" + fi +} + +check_makedepend() { + if [ "$with_makedepend" = "0" ] + then + log 1 "checking makedepend... disabled" + return + fi + + if [ "$with_makedepend" = "1" ] || [ "$with_makedepend" = "2" ] + then + makedepend="makedepend" + else + makedepend="$with_makedepend" + fi + + rm -f makedepend.tmp + touch makedepend.tmp + res=`$makedepend -fmakedepend.tmp 2>/dev/null` + res=$? + log 2 "executing $makedepend -f makedepend.tmp" + log 2 " returned `cat makedepend.tmp`" + log 2 " exit code $ret" + + if [ -z "`cat makedepend.tmp`" ] + then + rm -f makedepend.tmp makedepend.tmp.bak + + if [ "$with_makedepend" = "2" ] + then + log 1 "checking makedepend... not found" + + log 1 "I couldn't detect any makedepend on your system" + log 1 "please locate it via --makedepend=[binary]" + + exit 1 + elif [ "$with_makedepend" != "1" ] + then + log 1 "checking makedepend... $makedepend not found" + + log 1 "the selected file doesn't seem to be a valid makedepend binary" + + exit 1 + else + log 1 "checking makedepend... not found" + + with_makedepend="0" + return + fi + fi + + rm -f makedepend.tmp makedepend.tmp.bak + + log 1 "checking makedepend... $makedepend" +} + +detect_os() { + if [ $os = "DETECT" ] + then + # Detect UNIX, OSX, FREEBSD, MORPHOS, BEOS, SUNOS, CYGWIN, MINGW and OS2 + + # Try first via dumpmachine, then via uname + os=`echo "$host" | tr [:upper:] [:lower:] | awk ' + /linux/ { print "UNIX"; exit} + /darwin/ { print "OSX"; exit} + /freebsd/ { print "FREEBSD"; exit} + /morphos/ { print "MORPHOS"; exit} + /beos/ { print "BEOS"; exit} + /sunos/ { print "SUNOS"; exit} + /cygwin/ { print "CYGWIN"; exit} + /mingw/ { print "MINGW"; exit} + /os\/2/ { print "OS2"; exit} + '` + + if [ -z "$os" ] + then + os=`LC_ALL=C uname | tr [:upper:] [:lower:] | awk ' + /linux/ { print "UNIX"; exit} + /darwin/ { print "OSX"; exit} + /freebsd/ { print "FREEBSD"; exit} + /morphos/ { print "MORPHOS"; exit} + /beos/ { print "BEOS"; exit} + /sunos/ { print "SUNOS"; exit} + /cygwin/ { print "CYGWIN"; exit} + /mingw/ { print "MINGW"; exit} + /os\/2/ { print "OS2"; exit} + '` + fi + + if [ -z "$os" ] + then + log 1 "detecting OS... none detected" + log 1 "I couldn't detect your OS. Please use --with-os=OS to force one" + log 1 "Allowed values are: UNIX, OSX, FREEBSD, MORPHOS, BEOS, SUNOS, CYGWIN, and MINGW" + exit 1 + fi + + log 1 "detecting OS... $os" + else + log 1 "forcing OS... $os" + fi +} + +detect_sdl() { + # 0 means no, 1 is auto-detect, 2 is force + if [ "$with_sdl" = "0" ] + then + log 1 "checking SDL... disabled" + + sdl_config="" + return 0 + fi + + if [ "$with_sdl" = "2" ] && [ "$with_cocoa" = "2" ] + then + log 1 "configure: error: it is impossible to compile both SDL and COCOA" + log 1 "configure: error: please deselect one of them and try again" + exit 1 + fi + + if [ "$with_sdl" = "2" ] && [ "$enable_dedicated" != "0" ] + then + log 1 "configure: error: it is impossible to compile a dedicated with SDL" + log 1 "configure: error: please deselect one of them and try again" + exit 1 + fi + + if [ "$enable_dedicated" != "0" ] + then + log 1 "checking SDL... skipping" + + sdl_config="" + return 0 + fi + + # By default on OSX we don't use SDL. The rest is auto-detect + if [ "$with_sdl" = "1" ] && [ "$os" = "OSX" ] && [ "$with_cocoa" != "0" ] + then + log 1 "checking SDL... OSX, skipping" + + sdl_config="" + return 0 + fi + + if [ "$with_sdl" = "1" ] || [ "$with_sdl" = "" ] || [ "$with_sdl" = "2" ] + then + if [ "$os" = "FREEBSD" ] + then + sdl_config="sdl11-config" + else + sdl_config="sdl-config" + fi + else + sdl_config="$with_sdl" + fi + + version=`$sdl_config --version 2>/dev/null` + ret=$? + log 2 "executing $sdl_config --version" + log 2 " returned $version" + log 2 " exit code $ret" + + if [ -z $version ] || [ "$ret" != "0" ] + then + log 1 "checking SDL... not found" + + # It was forced, so it should be found. + if [ "$with_sdl" != "1" ] + then + log 1 "configure: error: sdl-config couldn't be found" + log 1 "configure: error: you supplied '$with_sdl', but it seems invalid" + exit 1 + fi + + sdl_config="" + return 0 + fi + + log 1 "checking SDL... found" +} + +detect_cocoa() { + # 0 means no, 1 is auto-detect, 2 is force + if [ "$with_cocoa" = "0" ] + then + log 1 "checking COCOA... disabled" + + return 0 + fi + + if [ "$with_cocoa" = "2" ] && [ "$enable_dedicated" != "0" ] + then + log 1 "configure: error: it is impossible to compile a dedicated with COCOA" + log 1 "configure: error: please deselect one of them and try again" + exit 1 + fi + + if [ "$enable_dedicated" != "0" ] + then + log 1 "checking COCOA... skipping" + + with_cocoa="0" + return 0 + fi + + # By default on OSX we use COCOA. The rest doesn't support it + if [ "$with_cocoa" = "1" ] && [ "$os" != "OSX" ] + then + log 1 "checking COCOA... not OSX, skipping" + + with_cocoa="0" + return 0 + fi + + if [ "$os" != "OSX" ] + then + log 1 "checking COCOA... not OSX" + + log 1 "configure: error: COCOA video driver is only supported for OSX" + exit 1 + fi + + log 1 "checking COCOA... found" +} + +detect_zlib() { + # 0 means no, 1 is auto-detect, 2 is force + if [ "$with_zlib" = "0" ] + then + log 1 "checking zlib... disabled" + + zlib="" + return 0 + fi + + log 2 "detecting zlib" + + if [ "$with_zlib" = "1" ] || [ "$with_zlib" = "" ] || [ "$with_zlib" = "2" ] + then + zlib=`ls -1 /usr/include/*.h 2>/dev/null | grep "\/zlib.h$"` + if [ -z "$zlib" ] + then + log 2 " trying /usr/include/zlib.h... no" + zlib=`ls -1 /usr/local/include/*.h 2>/dev/null | grep "\/zlib.h$"` + fi + if [ -z "$zlib" ] + then + log 2 " trying /usr/local/include/zlib.h... no" + fi + + if [ -n "$zlib" ] && [ "$enable_static" != "0" ] && [ "$os" != "OSX" ] + then + log 2 " trying $zlib... found" + # Now find the static lib, if needed + zlib=`ls /lib/*.a 2>/dev/null | grep "\/libz.a$"` + if [ -z "$zlib" ] + then + log 2 " trying /lib/libz.a... no" + zlib=`ls /usr/lib/*.a 2>/dev/null | grep "\/libz.a$"` + fi + if [ -z "$zlib" ] + then + log 2 " trying /usr/lib/libz.a... no" + zlib=`ls /usr/local/lib/*.a 2>/dev/null | grep "\/libz.a$"` + fi + if [ -z "$zlib" ] + then + log 2 " trying /usr/local/lib/libz.a... no" + log 1 "configure: error: zlib couldn't be found" + log 1 "configure: error: you requested a static link, but I can't find zlib.a" + + exit 1 + fi + fi + else + # Make sure it exists + zlib=`ls $with_zlib 2>/dev/null` + fi + + if [ -z "$zlib" ] + then + log 1 "checking zlib... not found" + if [ "$with_zlib" = "2" ] + then + log 1 "configure: error: zlib couldn't be found" + + exit 1 + elif [ "$with_zlib" != "1" ] + then + log 1 "configure: error: zlib couldn't be found" + log 1 "configure: error: you supplied '$with_zlib', but it seems invalid" + + exit 1 + fi + + return 0 + fi + + log 2 " trying $zlib... found" + + log 1 "checking zlib... found" +} + +detect_png() { + # 0 means no, 1 is auto-detect, 2 is force + if [ "$with_png" = "0" ] + then + log 1 "checking libpng... disabled" + + png_config="" + return 0 + fi + + if [ "$with_zlib" = "0" ] || [ "$zlib" = "" ] + then + log 1 "configure: error: libpng depends on zlib, which couldn't be found / was disabled" + log 1 "configure: error: please supply --with-zlib, with a valid zlib location" + exit 1 + fi + + if [ "$with_png" = "1" ] || [ "$with_png" = "" ] || [ "$with_png" = "2" ] + then + png_config="libpng-config" + else + png_config="$with_png" + fi + + version=`$png_config --version 2>/dev/null` + ret=$? + log 2 "executing $png_config --version" + log 2 " returned $version" + log 2 " exit code $ret" + + if [ -z "$version" ] || [ "$ret" != "0" ] + then + log 1 "checking libpng... not found" + + # It was forced, so it should be found. + if [ "$with_png" != "1" ] + then + log 1 "configure: error: libpng-config couldn't be found" + log 1 "configure: error: you supplied '$with_png', but it seems invalid" + exit 1 + fi + + png_config="" + return 0 + fi + + log 1 "checking libpng... found" +} + +detect_freetype() { + # 0 means no, 1 is auto-detect, 2 is force + if [ "$with_freetype" = "0" ] + then + log 1 "checking libfreetype... disabled" + + freetype_config="" + return 0 + fi + + if [ "$with_zlib" = "0" ] || [ "$zlib" = "" ] + then + log 1 "configure: error: libfreetype depends on zlib, which couldn't be found / was disabled" + log 1 "configure: error: please supply --with-zlib, with a valid zlib location" + exit 1 + fi + + if [ "$with_freetype" = "1" ] || [ "$with_freetype" = "" ] || [ "$with_freetype" = "2" ] + then + freetype_config="freetype-config" + else + freetype_config="$with_freetype" + fi + + version=`$freetype_config --version 2>/dev/null` + ret=$? + log 2 "executing freetype_config --version" + log 2 " returned $version" + log 2 " exit code $ret" + + if [ -z "$version" ] || [ "$ret" != "0" ] + then + log 1 "checking libfreetype... not found" + + # It was forced, so it should be found. + if [ "$with_freetype" != "1" ] + then + log 1 "configure: error: freetype-config couldn't be found" + log 1 "configure: error: you supplied '$with_freetype', but it seems invalid" + exit 1 + fi + + freetype_config="" + return 0 + fi + + log 1 "checking libfreetype... found" +} + +detect_fontconfig() { + # 0 means no, 1 is auto-detect, 2 is force + if [ "$with_fontconfig" = "0" ] + then + log 1 "checking libfontconfig... disabled" + + fontconfig_config="" + return 0 + fi + + if [ "$with_fontconfig" = "1" ] || [ "$with_fontconfig" = "" ] || [ "$with_fontconfig" = "2" ] + then + fontconfig_config="pkg-config fontconfig" + else + fontconfig_config="$with_fontconfig" + fi + + version=`$fontconfig_config --modversion 2>/dev/null` + ret=$? + shortversion=`echo $version | cut -c 1,3` + log 2 "executing $fontconfig_config --modversion" + log 2 " returned $version" + log 2 " exit code $ret" + + if [ -z "$version" ] || [ "$ret" != "0" ] || [ "$shortversion" -le "22" ] + then + if [ -n "$shortversion" ] && [ "$shortversion" -le "22" ] + then + log 1 "checking libfontconfig... needs at least version 2.3.0, fontconfig NOT enabled" + else + log 1 "checking libfontconfig... not found" + fi + + # It was forced, so it should be found. + if [ "$with_fontconfig" != "1" ] + then + log 1 "configure: error: fontconfig-config couldn't be found" + log 1 "configure: error: you supplied '$with_fontconfig', but it seems invalid" + exit 1 + fi + + fontconfig_config="" + return 0 + fi + + log 1 "checking libfontconfig... found" +} + +detect_iconv() { + # 0 means no, 1 is auto-detect, 2 is force + if [ "$with_iconv" = "0" ] + then + log 1 "checking iconv... disabled" + + return 0 + fi + + if [ "$with_iconv" = "1" ] && [ "$os" != "OSX" ] + then + log 1 "checking iconv... not OSX, skipping" + with_iconv="0" + + return 0 + fi + + # Try to find iconv.h, seems to only thing to detect iconv with + + if [ "$with_iconv" = "1" ] || [ "$with_iconv" = "" ] || [ "$with_iconv" = "2" ] + then + iconv=`ls -1 /usr/include 2>/dev/null | grep "iconv.h"` + if [ -z "$iconv" ] + then + iconv=`ls -1 /usr/local/include 2>/dev/null | grep "iconv.h"` + fi + else + # Make sure it exists + iconv=`ls $with_iconv/include/iconv.h 2>/dev/null` + fi + + if [ -z "$iconv" ] + then + log 1 "checking iconv... not found" + if [ "$with_iconv" = "2" ] + then + log 1 "configure: error: iconv couldn't be found" + + exit 1 + elif [ "$with_iconv" != "1" ] + then + log 1 "configure: error: iconv couldn't be found" + log 1 "configure: error: you supplied '$with_iconv', but I couldn't detect iconv in it" + + exit 1 + fi + + return 0 + fi + + if [ "$with_iconv" = "1" ] + then + with_iconv="2" + fi + + log 2 "found iconv in $iconv" + + log 1 "checking iconv... found" +} + +_detect_sort() { + sort_test_in="d +a +c +b" + + sort_test_out="a +b +c +d" + + log 2 "running echo | $1" + + if [ "`echo \"$sort_test_in\" | $1 2>/dev/null`" = "$sort_test_out" ] + then + sort="$1" + log 2 " result was valid" + else + log 2 " result was invalid" + fi +} + +detect_sort() { + if [ "$with_sort" = "0" ] + then + log 1 "checking sort... disabled" + + return + fi + + if [ "$with_sort" = "1" ] || [ "$with_sort" = "2" ] + then + _detect_sort "sort" + if [ -z "$sort" ]; then _detect_sort "/sbin/sort"; fi + if [ -z "$sort" ]; then _detect_sort "/usr/sbin/sort"; fi + if [ -z "$sort" ]; then _detect_sort "/usr/local/sbin/sort"; fi + if [ -z "$sort" ]; then _detect_sort "/bin/sort"; fi + if [ -z "$sort" ]; then _detect_sort "/usr/bin/sort"; fi + if [ -z "$sort" ]; then _detect_sort "/usr/local/bin/sort"; fi + else + _detect_sort "$with_sort" + fi + + if [ -z "$sort" ] + then + if [ "$with_sort" = "2" ] + then + log 1 "checking sort... not found" + + log 1 "configure: error: couldn't detect sort on your system" + exit 1 + elif [ "$with_sort" != "1" ] + then + log 1 "checking sort... $with_sort not found" + + log 1 "configure: error: '$with_sort' doesn't look like a sort to me" + log 1 "configure: error: please verify its location and function and try again" + + exit 1 + else + log 1 "checking sort... not found" + fi + else + log 1 "checking sort... $sort" + fi +} + +make_sed() { + # We check here if we are PPC, because then we need to enable FOUR_BYTE_BOOL + # We do this here, and not sooner, so universal builds also have this + # automaticly correct + # FOUR_BYTE_BOOL is needed, because C++ uses 4byte for a bool on PPC, where + # we use 1 byte per bool normally in C part. So convert that last one to 4 + # bytes too, but only for PPC. + ppc=`$cc_host -dumpmachine | grep "powerpc\|ppc"` + if [ -n "$ppc" ] + then + T_CFLAGS="$CFLAGS -DFOUR_BYTE_BOOL" + osx_sysroot_version=10.3.9 + else + T_CFLAGS="$CFLAGS" + osx_sysroot_version=10.4u + fi + + T_LDFLAGS="$LDFLAGS" + if [ "$with_osx_sysroot" = "3" ] + then + T_CFLAGS="$T_CFLAGS -isysroot /Developer/SDKs/MacOSX$osx_sysroot_version.sdk" + T_LDFLAGS="$T_LDFLAGS -Wl,-syslibroot,/Developer/SDKs/MacOSX$osx_sysroot_version.sdk" + fi + + SRC_OBJS_DIR="$BASE_SRC_OBJS_DIR/$OBJS_SUBDIR" + + # All the data needed to compile a single target + # Make sure if you compile multiple targets to + # use multiple OBJS_DIR, because all in-between + # binaries are stored in there, and nowhere else. + SRC_REPLACE=" + s#!!CC_HOST!!#$cc_host#g; + s#!!CXX_HOST!!#$cxx_host#g; + s#!!CC_BUILD!!#$cc_build#g; + s#!!WINDRES!!#$windres#g; + s#!!STRIP!!#$strip $strip_arg#g; + s#!!LIPO!!#$lipo#g; + s#!!CC_CFLAGS!!#$CC_CFLAGS#g; + s#!!CFLAGS!!#$T_CFLAGS#g; + s#!!CFLAGS_BUILD!!#$CFLAGS_BUILD#g; + s#!!STRGEN_FLAGS!!#$strgen_flags#g; + s#!!LIBS!!#$LIBS#g; + s#!!LDFLAGS!!#$T_LDFLAGS#g; + s#!!BIN_DIR!!#$BIN_DIR#g; + s#!!ROOT_DIR!!#$ROOT_DIR#g; + s#!!MEDIA_DIR!!#$MEDIA_DIR#g; + s#!!SOURCE_LIST!!#$SOURCE_LIST#g; + s#!!SRC_OBJS_DIR!!#$SRC_OBJS_DIR#g; + s#!!LANG_OBJS_DIR!!#$LANG_OBJS_DIR#g; + s#!!SRC_DIR!!#$SRC_DIR#g; + s#!!OSXAPP!!#$OSXAPP#g; + s#!!LANG_DIR!!#$LANG_DIR#g; + s#!!TTD!!#$TTD#g; + s#!!BINARY_DIR!!#$prefix_dir/$binary_dir#g; + s#!!DATA_DIR!!#$prefix_dir/$data_dir#g; + s#!!ICON_DIR!!#$prefix_dir/$icon_dir#g; + s#!!PERSONAL_DIR!!#$personal_dir#g; + s#!!INSTALL_DIR!!#$install_dir#g; + s#!!STRGEN!!#$STRGEN#g; + s#!!ENDIAN_CHECK!!#$ENDIAN_CHECK#g; + s#!!ENDIAN_FORCE!!#$endian#g; + s#!!STAGE!!#$STAGE#g; + s#!!MAKEDEPEND!!#$makedepend#g; + s#!!CFLAGS_MAKEDEP!!#$cflags_makedep#g; + s#!!SORT!!#$sort#g; + s#!!CONFIG_CACHE_COMPILER!!#config.cache.compiler#g; + s#!!CONFIG_CACHE_LINKER!!#config.cache.linker#g; + s#!!CONFIG_CACHE_ENDIAN!!#config.cache.endian#g; + s#!!CONFIG_CACHE_SOURCE!!#config.cache.source#g; + s#!!CONFIG_CACHE_VERSION!!#config.cache.version#g; + s#!!CONFIG_CACHE_SOURCE_LIST!!#config.cache.source.list#g; + s#!!LANG_SUPPRESS!!#$lang_suppress#g; + s#!!OBJS_C!!#$OBJS_C#g; + s#!!OBJS_CPP!!#$OBJS_CPP#g; + s#!!OBJS_M!!#$OBJS_M#g; + s#!!OBJS_RC!!#$OBJS_RC#g; + s#!!SRCS!!#$SRCS#g; + s#!!OS!!#$os#g; + s#!!CONFIGURE_FILES!!#$CONFIGURE_FILES#g; + s#!!REVISION!!#$revision#g; + s#!!ENABLE_INSTALL!!#$enable_install#g; + " +} + +generate_main() { + STAGE="[MAIN]" + + make_sed + + # Create the main Makefile + echo "Generating Makefile..." + cat $ROOT_DIR/Makefile.in | sed "$SRC_REPLACE" > Makefile + echo "# Auto-generated file -- DO NOT EDIT" > Makefile.am + echo "" > Makefile.am + # Make the copy of the source-list, so we don't trigger an unwanted recompile + cp $SOURCE_LIST config.cache.source.list + # Make sure config.cache is OLDER then config.cache.source.list + touch config.cache +} + +generate_lang() { + STAGE="[LANG]" + + make_sed + + # Create the language file + mkdir -p $LANG_OBJS_DIR + + echo "Generating lang/Makefile..." + cat $ROOT_DIR/Makefile.lang.in | sed "$SRC_REPLACE" > $LANG_OBJS_DIR/Makefile + echo "DIRS += $LANG_OBJS_DIR" >> Makefile.am + echo "LANG_DIRS += $LANG_OBJS_DIR" >> Makefile.am +} + +generate_src_normal() { + STAGE=$1 + + make_sed + + # Create the source file + mkdir -p $SRC_OBJS_DIR + + echo "Generating $2/Makefile..." + cat $ROOT_DIR/Makefile.src.in | sed "$SRC_REPLACE" > $SRC_OBJS_DIR/Makefile + echo "DIRS += $SRC_OBJS_DIR" >> Makefile.am + echo "SRC_DIRS += $SRC_OBJS_DIR" >> Makefile.am +} + +generate_src_osx() { + cc_host_orig="$cc_host" + cxx_host_orig="$cxx_host" + + BASE_SRC_OBJS_DIR="$OBJS_DIR/ppc" + cc_host="$cc_host_orig -arch ppc" + cxx_host="$cxx_host_orig -arch ppc" + generate_src_normal "[PowerPC]" "objs/ppc" + + BASE_SRC_OBJS_DIR="$OBJS_DIR/i386" + cc_host="$cc_host_orig -arch i386" + cxx_host="$cxx_host_orig -arch i386" + generate_src_normal "[i386]" "objs/i386" + + BASE_SRC_OBJS_DIR="$OBJS_DIR/ppc970" + cc_host="$cc_host_orig -arch ppc970" + cxx_host="$cxx_host_orig -arch ppc970" + CFLAGS="$CFLAGS -mtune=970 -mcpu=970 -mpowerpc-gpopt" + generate_src_normal "[PowerPC G5]" "objs/ppc970" +} + +generate_src() { + if [ "$os" = "OSX" ] && [ "$enable_universal" != "0" ] + then + generate_src_osx + else + generate_src_normal "[SRC]" "objs" + fi +} + +showhelp() { + echo "'configure' configures OpenTTD." + echo "" + echo "Usage: $0 [OPTION]... [VAR=VALUE]..." + echo "" + echo "To assign environment variables (e.g., CC, CFLAGS...), specify them as" + echo "VAR=VALUE. See below for descriptions of some of the useful variables." + echo "" + echo "Defaults for the options are specified in brackets." + echo "" + echo "Configuration:" + echo " -h, --help display this help and exit" + echo "" + echo "System types:" + echo " --build=BUILD configure for building on BUILD [guessed]" + echo " --host=HOST cross-compile to build programs to run on HOST [BUILD]" + echo " --windres=WINDRES the windres to use [HOST-windres]" + echo " --strip=STRIP the strip to use [HOST-strip]" + echo " --lipo=LIPO the lipo to use (OSX ONLY) [HOST-lipo]" + echo " --os=OS the OS we are compiling for [DETECT]" + echo " DETECT/UNIX/OSX/FREEBSD/MORPHOS/BEOS/SUNOS/CYGWIN/MINGW" + echo " --endian=ENDIAN set the endian of the HOST (AUTO/LE/BE) [AUTO]" + echo " --revision=rXXXX overwrite the revision detection. Use with care!" + echo "" + echo "Paths:" + echo " --prefix-dir=dir specifies the prefix for all installed files [/usr/local]" + echo " --binary-dir=dir location of the binary. Will be prefixed with the" + echo " prefix-dir [games]" + echo " --data-dir=dir location of data files (lang, data, gm, scenario)." + echo " Will be prefixed with the prefix-dir [share/games/openttd]" + echo " --icon-dir=dir location of icons. Will be prefixed with the" + echo " prefix-dir [share/pixmaps]" + echo " --personal-dir=dir location of the personal directory []" + echo " --install-dir=dir specifies the root to install to. Useful to install" + echo " into jails [/]" + echo "" +# TODO: The Following 3 tags will be removed when the 'search path patch' is applied + echo " --second-data-dir=dir specifies a second directory for the data files" + echo " --custom-lang-dir=dir specifies a custom directory for the language files" + echo " --enable-install make a binary that uses the specified data-dir and icon-dir" + echo "" + echo "Features and packages:" + echo " --enable-debug[=LVL] enable debug-mode (LVL=[0123], 0 is release) [LVL=0]" + echo " --enable-profiling enables profiling (can be mixed with --enable-debug)" + echo " --enable-dedicated compile a dedicated server (without video-drivers)" + echo " --enable-static enable static compile (doesn't work for all HOSTs)" + echo " --enable-translator enable extra output for translators" + echo " --enable-universal enable universal builds (OSX ONLY)" + echo " --enable-osx-g5 enables optimalizations for G5 (OSX ONLY)" + echo " --disable-network disable network support" + echo " --disable-assert disable asserts (on error, program just continues)" + echo " --disable-strip disable any possible stripping" + echo " --without-osx-sysroot disable the automatic adding of sysroot (OSX ONLY)" + echo " --without-application-bundle disable generation of application bundle (OSX ONLY)" + echo " --with-direct-music enable direct music support (Win32 ONLY)" + echo " --with-sort=sort define a non-default location for sort" + echo " --with-midi=midi define which midi-player to use" + echo " --with-midi-arg=arg define which args to use for the midi-player" + echo " --with-cocoa enables COCOA video driver (OSX ONLY) support" + echo " --with-sdl[=sdl-config] enables SDL video driver support" + echo " --with-zlib[=zlib.a] enables zlib support" + echo " --with-png[=libpng-config] enables libpng support" + echo " --with-freetype[=freetype-config]" + echo " enables libfreetype support" + echo " --with-fontconfig[=pkg-config fontconfig]" + echo " enables fontconfig support" + echo " --with-iconv[=iconv-path] enables iconv support" + echo " --with-makedepend[=makedepend] enables makedepend support" + echo "" + echo "Some influential environment variables:" + echo " CC C compiler command" + echo " CXX C++ compiler command" + echo " CFLAGS C compiler flags" + echo " WINDRES windres command" + echo " LDFLAGS linker flags, e.g. -L if you have libraries" + echo " in a nonstandard directory " + echo "" + echo "Use these variables to override the choices made by 'configure' or to help" + echo "it to find libraries and programs with nonstandard names/locations." +} diff --git a/configure b/configure index 2fd2939547..49f26b682a 100755 --- a/configure +++ b/configure @@ -1,323 +1,121 @@ #!/bin/sh -# This 'configure' script is a very easy wrapper around 'make updateconf' -# It allows cross-compilers to do their job much more easy. +# Find out where configure is (in what dir) +ROOT_DIR="`dirname $0`" +ROOT_DIR="`cd $ROOT_DIR && pwd`" -function showhelp() { - echo "Configure for OpenTTD" - echo "" - echo "Usage:" - echo " $0 --your_options" - echo "" - echo "Params:" - echo " --debug Create debug-release [no]" - echo " --profile Create profile-release [no]" - echo " --dedicated Make a dedicated build [no]" - echo " --revision Set the revision of the compilation [detected]" - echo " --target-cc Sets the target-compiler [\$CC]" - echo " --target-cxx Sets the C++ target-compiler []" - echo " --host-cc Sets the host-compiler [\$CC]" - echo " --host-cxx Sets the C++ host-compiler []" - echo " --os Sets the OS. Listens to: [detected]" - echo " UNIX, OSX, FREEBSD, MORPHOS" - echo " BEOS, SUNOS, CYGWIN, MINGW, OS2" - echo " --windres Sets the windres (Windows) [windres]" - echo " --force-le Force LE platform [no]" - echo " --force-be Force BE platform [no]" - echo "" - echo "Params that can be used with --with or --without" - echo " (e.g.: --without-static disables static (default))" - echo " static Do you want a static build? [no]" - echo " directmusic Do you want direct-music? [no]" - echo " zlib Do you want zlib-support? [yes]" - echo " sdl Do you want SDL-support? [yes]" - echo " png Do you want PNG-support? [yes]" - echo " iconv Do you want iconv-support? [no]" - echo " network Do you want network-support? [yes]" - echo " cocoa Do you want cocoa-support? (MacOSX) [no]" - echo " freetype Do you want freetype-support? [yes]" - echo " fontconfig Do you want fontconfig-support? [yes]" - echo "" - echo "Params used to configure external libs:" - echo " --static-zlib-path Set the path to your static zlib []" - echo " --sdl-config Where is your sdl-config [sdl-config]" - echo " --libpng-config Where is your libpng-config [libpng-config]" - echo " --freetype-config Where is your freetype-config [freetype-config]" - echo " --fontconfig-config Where is your fontconfig-config [pkg-config fontconfig]" - echo " --with-iconv Set the path to your iconv headers []" - echo " " -} +PWD="`pwd`" +PREFIX="`pwd`/bin" -function handle() { - PARAM="$PARAM \"$1=`awk 'BEGIN { FS="="; $0="'"$2"'"; print $2;}'`\"" -} +. $ROOT_DIR/config.lib -# The things you can use inside this case: -# handle NAME VALUE - Sets the value to give the 'make upgradeconf' -# Value is in form: tag=REAL_VALUE -# ITEM="NAME" - Will set the value as above, only with the next param -# SITEM="NAME" - Will set the var $NAME to the next param -for n in "$@" -do - case "$n" in - --help | -h) - showhelp - exit 0 - ;; +# Set default dirs +OBJS_DIR="$PWD/objs" +BASE_SRC_OBJS_DIR="$OBJS_DIR" +LANG_OBJS_DIR="$OBJS_DIR/lang" +BIN_DIR="$PREFIX" +SRC_DIR="$ROOT_DIR/src" +LANG_DIR="$SRC_DIR/lang" +MEDIA_DIR="$ROOT_DIR/media" +SOURCE_LIST="$ROOT_DIR/source.list" - --debug) - DEBUG_SET=1 - ITEM="DEBUG" - ;; - --debug=*) - handle "DEBUG" "$n" - ;; - --profile) - PARAM="$PARAM PROFILE=1" - ;; - --dedicated) - PARAM="$PARAM DEDICATED=1" - ;; - --revision=*) - RELEASE=`awk 'BEGIN { FS="="; $0="'"$n"'"; print $2;}'` - ;; - --revision) - SITEM="RELEASE" - ;; - --target-cc=*) - handle "CC_TARGET" "$n" - ;; - --target-cc) - ITEM="CC_TARGET" - ;; - --target-cxx=*) - handle "CXX_TARGET" "$n" - ;; - --target-cxx) - SITEM="CXX_TARGET" - ;; - --host-cc=*) - handle "CC_HOST" "$n" - ;; - --host-cc) - ITEM="CC_HOST" - ;; - --host-cxx=*) - handle "CXX_HOST" "$n" - ;; - --host-cxx) - ITEM="CXX_HOST" - ;; - --host-cflags=*) - handle CFLAGS_HOST "$n" - ;; - --host-cflags) - ITEM="CFLAGS_HOST" - ;; - --os=*) - TARGET_OS=`awk 'BEGIN { FS="="; $0="'"$n"'"; print $2;}'` - ;; - --os) - SITEM="TARGET_OS" - ;; - --windres=*) - handle WINDRES "$n" - ;; - --windres) - ITEM="WINDRES" - ;; - --force-le) - PARAM="$PARAM ENDIAN_FORCE=LE" - ;; - --force-be) - PARAM="$PARAM ENDIAN_FORCE=BE" - ;; +if [ "$1" = "--reconfig" ] +then + if ! [ -f "config.cache" ] + then + echo "can't reconfigure, because never configured before" + exit 1 + fi + # Make sure we don't lock config.cache + configure=`cat config.cache` + $configure + exit $? +fi - --with-static) - PARAM="$PARAM STATIC=1" - ;; - --without-static) - PARAM="$PARAM STATIC=" - ;; - --with-directmusic) - PARAM="$PARAM WITH_DIRECTMUSIC=1" - ;; - --without-directmusic) - PARAM="$PARAM WITH_DIRECTMUSIC=" - ;; - --with-zlib) - PARAM="$PARAM WITH_ZLIB=1" - ;; - --without-zlib) - PARAM="$PARAM WITH_ZLIB=" - ;; - --with-sdl) - PARAM="$PARAM WITH_SDL=1" - ;; - --without-sdl) - PARAM="$PARAM WITH_SDL=" - ;; - --with-png) - PARAM="$PARAM WITH_PNG=1" - ;; - --without-png) - PARAM="$PARAM WITH_PNG=" - ;; - --with-iconv) - PARAM="$PARAM WITH_ICONV=1" - ;; - --with-iconv=*) - PARAM="$PARAM WITH_ICONV=1" - handle WITH_ICONV_PATH "$n" - ;; - --without-iconv) - PARAM="$PARAM WITH_ICONV=" - ;; - --with-cocoa) - PARAM="$PARAM WITH_COCOA=1" - ;; - --with-network) - PARAM="$PARAM WITH_NETWORK=1" - ;; - --without-network) - PARAM="$PARAM WITH_NETWORK=" - ;; - --without-cocoa) - PARAM="$PARAM WITH_COCOA=" - ;; - --with-freetype) - PARAM="$PARAM WITH_FREETYPE=1" - ;; - --without-freetype) - PARAM="$PARAM WITH_FREETYPE=" - ;; - --with-fontconfig) - PARAM="$PARAM WITH_FONTCONFIG=1" - ;; - --without-fontconfig) - PARAM="$PARAM WITH_FONTCONFIG=" - ;; - --static-zlib-path=*) - handle STATIC_ZLIB_PATH "$n" - ;; - --static-zlib-path) - ITEM="STATIC_ZLIB_PATH" - ;; - --sdl-config=*) - handle SDL_CONFIG "$n" - ;; - --sdl-config) - ITEM="SDL_CONFIG" - ;; - --libpng-config=*) - handle LIBPNG_CONFIG "$n" - ;; - --libpng-config) - ITEM="LIBPNG_CONFIG" - ;; - --freetype-config=*) - handle FREETYPE_CONFIG "$n" - ;; - --freetype-config) - ITEM="FREETYPE_CONFIG" - ;; - --fontconfig-config=*) - handle FONTCONFIG_CONFIG "$n" - ;; - --fontconfig-config) - ITEM="FONTCONFIG_CONFIG" - ;; +set_default +detect_params $@ +save_params +check_params +make_cflags_and_ldflags - --*=*) - echo -n "Unknown switch " - echo `awk 'BEGIN { FS="="; $0="'"$n"'"; print $1;}'` - exit 1 - ;; - -*) - echo "Unknown switch $n" - exit 1 - ;; +EXE="" +if [ "$os" = "MINGW" ] || [ "$os" = "CYGWIN" ] || [ "$os" = "OS2" ] +then + EXE=".exe" +fi - *) - if ! test -z "$ITEM" - then - PARAM="$PARAM $ITEM=\"$n\"" - ITEM=""; - elif ! test -z "$SITEM" - then - export $SITEM="$n" - SITEM="" - else - echo "Unknown switch $n" - exit 1 - fi - ;; - esac -done +TTD="openttd$EXE" +STRGEN="strgen$EXE" +ENDIAN_CHECK="endian_check$EXE" -if ! test -z "$TARGET_OS" +if [ -z "$sort" ] then - TARGET_OS=`echo $TARGET_OS | tr '[:lower:]' '[:upper:]'` - case "$TARGET_OS" in - WIN32) - PARAM="$PARAM WIN32=1" - ;; - UNIX) - PARAM="$PARAM UNIX=1" - ;; - OSX) - PARAM="$PARAM OSX=1 UNIX=1" - ;; - FREEBSD) - PARAM="$PARAM FREEBSD=1" - ;; - MORPHOS) - PARAM="$PARAM MORPHOS=1 UNIX=1" - ;; - BEOS) - PARAM="$PARAM BEOS=1 UNIX=1" - ;; - OS2) - PARAM="$PARAM OS2=1 UNIX=1" - ;; - SUNOS) - PARAM="$PARAM SUNOS=1 UNIX=1" - ;; - CYGWIN) - PARAM="$PARAM CYGWIN=1 WIN32=1" - ;; - MINGW) - PARAM="$PARAM MINGW=1 WIN32=1" - ;; - *) - echo "Unknown OS: $TARGET_OS" - exit 1 - ;; - esac - PARAM="$PARAM BYPASS_OS_DETECT=1" + PIPE_SORT="sed s/a/a/" +else + PIPE_SORT="$sort" fi -if ! test -z "$DEBUG_SET" +if ! [ -f "$LANG_DIR/english.txt" ] then - if test -z "`echo $PARAM | grep "DEBUG="`" - then - # Someone did --debug, without assigning a value, assume 1 - PARAM="$PARAM DEBUG=1" - fi + echo "Languages not found in $LANG_DIR. Can't continue without it." + echo "Please make sure the dir exists and contains at least english.txt" fi -# First remove the Makefile.config, else you can have double entries -rm -f Makefile.config +# Read the source.list and process it +SRCS="`cat $ROOT_DIR/source.list | tr '\r' '\n' | awk ' + { } + /^( *)#end/ { if (deep == skip) { skip -= 1; } deep -= 1; next; } + /^( *)#else/ { if (deep == skip) { skip -= 1; } else if (deep - 1 == skip) { skip += 1; } next; } + /^( *)#if/ { + gsub(" ", "", $0); + gsub("^#if ", "", $0); + + if (deep != skip) { deep += 1; next; } + + deep += 1; -echo "make upgradeconf $PARAM" > Makefile.run -. Makefile.run -rm -f Makefile.run + if ($0 == "SDL" && "'$sdl_config'" == "") { next; } + if ($0 == "OSX" && "'$os'" != "OSX") { next; } + if ($0 == "DEDICATED" && "'$enable_dedicated'" != "1") { next; } + if ($0 == "COCOA" && "'$with_cocoa'" == "0") { next; } + if ($0 == "BEOS" && "'$os'" != "BEOS") { next; } + if ($0 == "WIN32" && "'$os'" != "MINGW" && + "'$os'" != "CYGWIN" && "'$os'" != "MSVC" ) { next; } + if ($0 == "MSVC" && "'$os'" != "MSVC") { next; } + if ($0 == "DIRECTMUSIC" && "'$with_direct_music'" != "1") { next; } -# Makefile.config currently doesn't support custom RELEASE (revision), so, we add the line -# yourself! + skip += 1; -if ! test -z "$RELEASE" + next; + } + /^( *)#/ { next } + /^$/ { next } + /\.h$/ { next } + /\.hpp$/ { next } + { + if (deep == skip) { + gsub(" ", "", $0); + print $0; + } + } +' | $PIPE_SORT`" + +OBJS_C="` echo \"$SRCS\" | awk ' { ORS = " " } /\.c$/ { gsub(".c$", ".o", $0); print $0; }'`" +OBJS_CPP="`echo \"$SRCS\" | awk ' { ORS = " " } /\.cpp$/ { gsub(".cpp$", ".o", $0); print $0; }'`" +OBJS_M="` echo \"$SRCS\" | awk ' { ORS = " " } /\.m$/ { gsub(".m$", ".o", $0); print $0; }'`" +OBJS_RC="` echo \"$SRCS\" | awk ' { ORS = " " } /\.rc$/ { gsub(".rc$", ".o", $0); print $0; }'`" +SRCS="` echo \"$SRCS\" | awk ' { ORS = " " } { print $0; }'`" + +# In makefiles, we always use -u for sort +if [ -z "$sort" ] then - echo "RELEASE=$RELEASE" >> Makefile.config + sort="sed s/a/a/" +else + sort="$sort -u" fi +CONFIGURE_FILES="$ROOT_DIR/configure $ROOT_DIR/config.lib $ROOT_DIR/Makefile.in $ROOT_DIR/Makefile.lang.in $ROOT_DIR/Makefile.src.in" + +generate_main +generate_lang +generate_src diff --git a/docs/Manual.txt b/docs/Manual.txt index 7880d5f6a3..73124b0e60 100644 --- a/docs/Manual.txt +++ b/docs/Manual.txt @@ -13,7 +13,7 @@ Once you have obtained a recent copy of the source, you must build it. Windows b On UNIX platforms (including OS-X and BeOS), ensure you have a recent GCC (2.9 or above, or 3 and above).You will also need SDL development headers and libraries (libSDL 1.2 or higher). For PNG screenshot support and zlib compressed games, you will need libpng 1.0.12 or higher and zlib 1.2 or higher. Most UNIX platforms: -Use make or gmake to compile OpenTTD. You can adjust Makefile.config to compile with other options. +First run ./configure, them use make or gmake to compile OpenTTD. You can configure the different compile options via ./configure. BeOS: On BeOS, run ./configure and then use jam. There are a variaty of options you can pass to your build tool, these are reported by ./configure. diff --git a/langs.vcproj b/langs.vcproj deleted file mode 100644 index 27295ab906..0000000000 --- a/langs.vcproj +++ /dev/null @@ -1,392 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/langs_vs80.vcproj b/langs_vs80.vcproj deleted file mode 100644 index 7f0b224212..0000000000 --- a/langs_vs80.vcproj +++ /dev/null @@ -1,458 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/makefiledir/Makefile.config_writer b/makefiledir/Makefile.config_writer deleted file mode 100644 index a956d9e622..0000000000 --- a/makefiledir/Makefile.config_writer +++ /dev/null @@ -1,111 +0,0 @@ -# This file generates Makefile.config -# Create default config from autodetected values -# Magic at work, note that you can't use commas in arguments for this -CONFIG_LINE=@$(SHELL) -c 'echo $(1)' >> $(MAKE_CONFIG) 2> /dev/null - -$(MAKE_CONFIG): - - touch $(MAKE_CONFIG) - - $(call CONFIG_LINE,\# OpenTTD config file for makefile) - $(call CONFIG_LINE,\# Set your options here - 1 for use and empty for disable) - $(call CONFIG_LINE,) - - $(call CONFIG_LINE,\# User setup flags) - $(call CONFIG_LINE,\# Translator: adds TODO to any untranslated strings) - $(call CONFIG_LINE,\# MIDI: sets path to midi player) - $(call CONFIG_LINE,\# MIDI_ARG: sets an argument which is used when calling the midi player. Default off) - $(call CONFIG_LINE,\# SUPRESS_LANG_ERRORS: supresses output about missing and mismatched strings) - $(call CONFIG_LINE,\# WITH_NETWORK: makes OpenTTD able to play multiplayer using TCP and UDP) - $(call CONFIG_LINE,\# DEDICATED: compiles a dedicated server. This one can only host using a CLI, but do not need SDL) - $(call CONFIG_LINE,STATIC:=$(STATIC)) - $(call CONFIG_LINE,TRANSLATOR:=$(TRANSLATOR)) - $(call CONFIG_LINE,DEBUG:=$(DEBUG)) - $(call CONFIG_LINE,PROFILE:=$(PROFILE)) - $(call CONFIG_LINE,MIDI:=$(MIDI)) - $(call CONFIG_LINE,MIDI_ARG:=$(MIDI_ARG)) - $(call CONFIG_LINE,SUPRESS_LANG_ERRORS:=$(SUPRESS_LANG_ERRORS)) - $(call CONFIG_LINE,WITH_DIRECTMUSIC:=$(WITH_DIRECTMUSIC)) - $(call CONFIG_LINE,WITH_NETWORK:=$(WITH_NETWORK)) - $(call CONFIG_LINE,DEDICATED:=$(DEDICATED)) - $(call CONFIG_LINE,) - - $(call CONFIG_LINE,\# Disable asserts. Leave them on for easier bug finding) - $(call CONFIG_LINE,DISABLE_ASSERTS:=$(DISABLE_ASSERTS)) - $(call CONFIG_LINE,\# Disable threads. Useful if you do not like it and for testing) - $(call CONFIG_LINE,NO_THREADS:=$(NO_THREADS)) - $(call CONFIG_LINE,) - - $(call CONFIG_LINE,\# See Makefile for details on these paths) - $(call CONFIG_LINE,\# Folders should not end with /) - $(call CONFIG_LINE,INSTALL:=$(INSTALL)) - $(call CONFIG_LINE,PREFIX:=$(PREFIX)) - $(call CONFIG_LINE,BINARY_DIR:=$(BINARY_DIR)) - $(call CONFIG_LINE,DATA_DIR:=$(DATA_DIR)) - $(call CONFIG_LINE,ICON_DIR:=$(ICON_DIR)) - $(call CONFIG_LINE,USE_HOMEDIR:=$(USE_HOMEDIR)) - $(call CONFIG_LINE,PERSONAL_DIR:=$(PERSONAL_DIR)) - $(call CONFIG_LINE,SECOND_DATA_PATH:=$(SECOND_DATA_PATH)) - $(call CONFIG_LINE,CUSTOM_LANG_PATH:=$(CUSTOM_LANG_PATH)) - $(call CONFIG_LINE,) - - $(call CONFIG_LINE,\# Flag to skip test for OS when building static) - $(call CONFIG_LINE,\# OpenTTD have only been succesfully tested with static builds on MorphOS and MacOSX) - $(call CONFIG_LINE,\# If you want to try anyway on other OSes, set this flag) - $(call CONFIG_LINE,\# Inform us if you have success) - $(call CONFIG_LINE,SKIP_STATIC_CHECK:=$(SKIP_STATIC_CHECK)) - $(call CONFIG_LINE,) - $(call CONFIG_LINE,) - - $(call CONFIG_LINE,\# Everything below this line is autogenerated) - $(call CONFIG_LINE,\#) - $(call CONFIG_LINE,\# If you need to change anything below, you should run "make upgradeconf") - $(call CONFIG_LINE,\# If that does not fix the problem, you should make a bug report.) - $(call CONFIG_LINE,\# It would really help if you could tell how to autodetect the missing setting) - $(call CONFIG_LINE,\# That info could be where the missing lib is placed) - $(call CONFIG_LINE,) - - $(call CONFIG_LINE,\# Libs) - $(call CONFIG_LINE,WITH_ZLIB:=$(WITH_ZLIB)) - $(call CONFIG_LINE,WITH_SDL:=$(WITH_SDL)) - $(call CONFIG_LINE,WITH_PNG:=$(WITH_PNG)) - $(call CONFIG_LINE,WITH_ICONV:=$(WITH_ICONV)) - $(call CONFIG_LINE,WITH_ICONV_PATH:=$(WITH_ICONV_PATH)) - $(call CONFIG_LINE,STATIC_ZLIB_PATH:=$(STATIC_ZLIB_PATH)) - $(call CONFIG_LINE,WITH_COCOA:=$(WITH_COCOA)) - $(call CONFIG_LINE,WITH_FREETYPE:=$(WITH_FREETYPE)) - $(call CONFIG_LINE,WITH_FONTCONFIG:=$(WITH_FONTCONFIG)) - $(call CONFIG_LINE,) - - $(call CONFIG_LINE,\# OS flags) - $(call CONFIG_LINE,WIN32:=$(WIN32)) - $(call CONFIG_LINE,UNIX:=$(UNIX)) - $(call CONFIG_LINE,OSX:=$(OSX)) - $(call CONFIG_LINE,FREEBSD:=$(FREEBSD)) - $(call CONFIG_LINE,MORPHOS:=$(MORPHOS)) - $(call CONFIG_LINE,BEOS:=$(BEOS)) - $(call CONFIG_LINE,OS2:=$(OS2)) - $(call CONFIG_LINE,SUNOS:=$(SUNOS)) - $(call CONFIG_LINE,CYGWIN:=$(CYGWIN)) - $(call CONFIG_LINE,MINGW:=$(MINGW)) - $(call CONFIG_LINE,) - - $(call CONFIG_LINE,\# For cross-compiling) - $(call CONFIG_LINE,CC_TARGET:=$(CC_TARGET)) - $(call CONFIG_LINE,CC_HOST:=$(CC_HOST)) - $(call CONFIG_LINE,CXX_TARGET:=$(CXX_TARGET)) - $(call CONFIG_LINE,CXX_HOST:=$(CXX_HOST)) - $(call CONFIG_LINE,CFLAGS_HOST:=$(CFLAGS_HOST)) - $(call CONFIG_LINE,WINDRES:=$(WINDRES)) - $(call CONFIG_LINE,ENDIAN_FORCE:=$(ENDIAN_FORCE)) - $(call CONFIG_LINE,) - - $(call CONFIG_LINE,\# misc) - $(call CONFIG_LINE,SDL_CONFIG:=$(SDL_CONFIG)) - $(call CONFIG_LINE,LIBPNG_CONFIG:=$(LIBPNG_CONFIG)) - $(call CONFIG_LINE,FREETYPE_CONFIG:=$(FREETYPE_CONFIG)) - $(call CONFIG_LINE,FONTCONFIG_CONFIG:=$(FONTCONFIG_CONFIG)) - $(call CONFIG_LINE,BEOS_NET_SERVER:=$(BEOS_NET_SERVER)) - $(call CONFIG_LINE,CONFIG_INCLUDED:=yes) - $(call CONFIG_LINE,PATH_SET:=$(PATH_SET)) - $(call CONFIG_LINE,CONFIG_VERSION:=$(MAKEFILE_VERSION)) diff --git a/makefiledir/Makefile.libdetection b/makefiledir/Makefile.libdetection deleted file mode 100644 index eb38ffd474..0000000000 --- a/makefiledir/Makefile.libdetection +++ /dev/null @@ -1,149 +0,0 @@ -# this file detects what OS and libs the computer have/are running - -ifndef CONFIG_VERSION -CONFIG_VERSION:=0 -endif - -ifeq ($(shell expr $(CONFIG_VERSION) \< 9), 1) - -ifndef BYPASS_OS_DETECT - -# Automatically recognize if building on Win32 -ifdef WINDIR -ifndef UNIX -WIN32:=1 -CYGWIN:=1 -MINGW:=1 -STATIC:=1 -SKIP_STATIC_CHECK:=1 -endif -else -UNIX:=1 -endif - -# Automatically recognize if building on FreeBSD -ifeq ($(shell uname),FreeBSD) -FREEBSD:=1 -endif - -# Automatically recognize if building on MacOSX -ifeq ($(shell uname), Darwin) -OSX:=1 -# OSX uses the unix setup too -UNIX:=1 -endif - -# Automatically recognize if building on MorphOS -ifeq ($(shell uname), MorphOS) -MORPHOS:=1 -# MorphOS uses UNIX setup too -UNIX:=1 -endif - -# Automatically recognize if building on BeOS -ifeq ($(shell uname), BeOS) -BEOS:=1 -# BeOS uses UNIX setup too -UNIX:=1 -# Except that in BeOS 5.0 we need to use net_server, not BONE networking -ifeq ($(shell uname -r), 5.0) -BEOS_NET_SERVER:=1 -endif -endif - -# Automatically recognize if building on SunOS/Solaris -ifeq ($(shell uname), SunOS) -SUNOS:=1 -# SunOS uses UNIX setup too -UNIX:=1 -endif - -# END BYPASS_OS_DETECT -endif - -SDL_CONFIG:=sdl-config - -# set libpng-config to the default value -LIBPNG_CONFIG :=libpng-config - -# set freetype-config to the default value -FREETYPE_CONFIG:=freetype-config - -# set pkg-config to the default value -FONTCONFIG_CONFIG:=pkg-config fontconfig - -# Networking, enabled by default -WITH_NETWORK:=1 - -# Library detections -WITH_SDL:=$(shell $(SDL_CONFIG) --version 2>/dev/null) - -# libpng detection -WITH_PNG:=$(shell $(LIBPNG_CONFIG) --version 2>/dev/null) - -# Freetype detection -WITH_FREETYPE:=$(shell $(FREETYPE_CONFIG) --ftversion 2>/dev/null) - -# fontconfig detection -WITH_FONTCONFIG:=$(shell $(FONTCONFIG_CONFIG) --modversion 2>/dev/null) - -ifdef WITH_PNG - # LibPNG depends on Zlib - WITH_ZLIB:=1 -else -# We go looking for zlib with a little hack -WITH_ZLIB:=$(shell ls /usr/include | grep "zlib.h" 2>/dev/null) \ -$(shell ls /usr/local/include | grep "zlib.h" 2>/dev/null) -ifdef WITH_ZLIB -WITH_ZLIB:=1 -endif -endif - -ifdef WITH_ZLIB - TEMP:=$(shell ls /lib 2>/dev/null | grep "zlib.a")$(shell ls /lib 2>/dev/null | grep "libz.a") - ifdef TEMP - STATIC_ZLIB_PATH:=/lib/$(TEMP) - else - TEMP:=$(shell ls /usr/lib 2>/dev/null | grep "zlib.a")$(shell ls /usr/lib 2>/dev/null | grep "libz.a") - ifdef TEMP - STATIC_ZLIB_PATH:=/usr/lib/$(TEMP) - else - TEMP:=$(shell ls /usr/local/lib 2>/dev/null | grep "zlib.a")$(shell ls /usr/local/lib 2>/dev/null | grep "libz.a") - ifdef TEMP - STATIC_ZLIB_PATH:=/usr/local/lib/$(TEMP) - endif - endif - endif -endif - -# sets the default paths -ifdef UNIX -ifndef OSX -ifndef MORPHOS -ifndef BIN_DIR -#BINARY_DIR:= -#DATA_DIR_PREFIX:= -#INSTALL_DIR:=/usr/local/ -#USE_HOMEDIR:= -endif -endif -endif -endif - -ifdef OSX -# we prefer to use cocoa drivers rather than SDL drivers -# if you really want SDL drivers, you can always modify Makefile.config -ifndef DEDICATED -WITH_COCOA:=1 -WITH_SDL:= -endif -endif - - -# workaround -# cygwin have problems with libpng, so we will just disable it for now until the problem is solved -ifdef CYGWIN -WITH_PNG:= -endif - -endif diff --git a/mainicon.ico b/media/mainicon.ico similarity index 100% rename from mainicon.ico rename to media/mainicon.ico diff --git a/openttd.ico b/media/openttd.ico similarity index 100% rename from openttd.ico rename to media/openttd.ico diff --git a/openttd.vcproj b/openttd.vcproj deleted file mode 100644 index a2b99aa1fc..0000000000 --- a/openttd.vcproj +++ /dev/null @@ -1,1227 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/openttd_vs80.vcproj b/openttd_vs80.vcproj deleted file mode 100644 index 11daa722ca..0000000000 --- a/openttd_vs80.vcproj +++ /dev/null @@ -1,2026 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/os/macosx/Makefile b/os/macosx/Makefile deleted file mode 100644 index d8afef98c5..0000000000 --- a/os/macosx/Makefile +++ /dev/null @@ -1,146 +0,0 @@ -# $Id: Makefile 3214 2005-11-17 19:43:37Z bjarni $ -# This makefile is not a standalone makefile, but is called from the general one -# it contains targets specific to MacOS X - -ifdef MACOSX_BUILD - -DEPS_MAGIC := $(shell mkdir -p $(sort $(dir $(OBJS:%.o=.OSX/%)))) - -ifdef OTTD_PPC -OTTD_PPC :=.OSX/openttd.ppc -OBJS_ppc := $(OBJS:%.o=.OSX/%.o.ppc) -ifndef CC_PPC -CC_PPC := $(CC) -arch ppc -endif -ifndef CXX_PPC -CXX_PPC := $(CXX) -arch ppc -endif -endif - -ifdef OTTD_i386 -OTTD_i386 :=.OSX/openttd.i386 -OBJS_i386 := $(OBJS:%.o=.OSX/%.o.i386) -ifndef CC_I386 -CC_I386 := $(CC) -arch i386 -endif -ifndef CXX_I386 -CXX_I386 := $(CXX) -arch i386 -endif -endif - -ifdef OTTD_PPC970 -OTTD_PPC970 :=.OSX/openttd.ppc970 -OBJS_ppc970 := $(OBJS:%.o=.OSX/%.o.ppc970) -ifndef CC_PPC970 -CC_PPC970 := $(CC) -arch ppc970 -endif -ifndef CXX_PPC970 -CXX_PPC970 := $(CXX) -arch ppc970 -endif -endif - -ifndef LIPO -LIPO := lipo -endif -ifndef STRIP -STRIP := strip -endif - -# targets to link OpenTTD -$(TTD): $(OTTD_PPC) $(OTTD_i386) $(OTTD_PPC970) - @echo '===> Linking $@ into a single file' - $(Q)$(LIPO) -create -output $@ $(OTTD_PPC) $(OTTD_i386) $(OTTD_PPC970) - -$(OTTD_PPC): $(MAKE_CONFIG) $(OBJS_ppc) - @echo '[PowerPC] Linking $(TTD)' - $(Q)$(CXX_PPC) $(LDFLAGS) $(TTDLDFLAGS) $(OBJS_ppc) $(LIBS) $(LDFLAGS_PPC) -o $@ - -$(OTTD_i386): $(MAKE_CONFIG) $(OBJS_i386) - @echo '[i386] Linking $(TTD)' - $(Q)$(CXX_I386) $(LDFLAGS) $(TTDLDFLAGS) $(OBJS_i386) $(LIBS) $(LDFLAGS_i386) -o $@ - -$(OTTD_PPC970): $(MAKE_CONFIG) $(OBJS_ppc970) - @echo '[PowerPC G5] Linking $(TTD)' - $(Q)$(CXX_PPC970) $(LDFLAGS) $(TTDLDFLAGS) $(OBJS_ppc970) $(LIBS) $(LDFLAGS_PPC) $(G5_FLAGS) -o $@ - -# targets to compile each c, m and cpp file -.OSX/%.o.ppc: %.c .deps/%.d - @echo '[PowerPC] Compiling $<' - $(Q)$(CC_PPC) $(CC_CFLAGS) $(CFLAGS) $(CFLAGS_PPC) $(CDEFS) -c -o $@ $< - -.OSX/%.o.ppc: %.cpp .deps/%.d - @echo '[PowerPC] Compiling $<' - $(Q)$(CXX_PPC) $(CFLAGS) $(CFLAGS_PPC) $(CDEFS) -c -o $@ $< - -.OSX/%.o.ppc: %.m .deps/%.d - @echo '[PowerPC] Compiling $<' - $(Q)$(CC_PPC) $(CC_CFLAGS) $(CFLAGS) $(CFLAGS_PPC) $(CDEFS) -c -o $@ $< - -.OSX/%.o.i386: %.c .deps/%.d - @echo '[i386] Compiling $<' - $(Q)$(CC_I386) $(CC_CFLAGS) $(CFLAGS) $(CFLAGS_i386) $(CDEFS) -c -o $@ $< - -.OSX/%.o.i386: %.cpp .deps/%.d - @echo '[i386] Compiling $<' - $(Q)$(CXX_I386) $(CFLAGS) $(CFLAGS_i386) $(CDEFS) -c -o $@ $< - -.OSX/%.o.i386: %.m .deps/%.d - @echo '[i386] Compiling $<' - $(Q)$(CC_I386) $(CC_CFLAGS) $(CFLAGS) $(CFLAGS_i386) $(CDEFS) -c -o $@ $< - -.OSX/%.o.ppc970: %.c .deps/%.d - @echo '[PowerPC G5] Compiling $<' - $(Q)$(CC_PPC970) $(CC_CFLAGS) $(CFLAGS) $(CFLAGS_PPC) $(G5_FLAGS) $(CDEFS) -c -o $@ $< - -.OSX/%.o.ppc970: %.cpp .deps/%.d - @echo '[PowerPC G5] Compiling $<' - $(Q)$(CXX_PPC970) $(CFLAGS) $(CFLAGS_PPC) $(G5_FLAGS) $(CDEFS) -c -o $@ $< - -.OSX/%.o.ppc970: %.m .deps/%.d - @echo '[PowerPC G5] Compiling $<' - $(Q)$(CC_PPC970) $(CC_CFLAGS) $(CFLAGS) $(CFLAGS_PPC) $(G5_FLAGS) $(CDEFS) -c -o $@ $< - -endif - -# manual strip, as the -s option fails -$(OSX_STRIP): $(TTD) - $(Q)$(STRIP) openttd - - -# build the bundle. OSX wants to keep apps in bundles, so we will give it one -# the good thing about bundles is that you can keep extra files in them, so we keep lng files and a data dir in it - -BUILD_OSX_BUNDLE: $(TTD) $(OSX_STRIP) - @echo '===> Building application bundle' - $(Q)rm -fr "$(OSXAPP)" - $(Q)mkdir -p "$(OSXAPP)"/Contents/MacOS - $(Q)mkdir -p "$(OSXAPP)"/Contents/Resources - $(Q)mkdir -p "$(OSXAPP)"/Contents/Data - $(Q)mkdir -p "$(OSXAPP)"/Contents/Lang - $(Q)echo "APPL????" > "$(OSXAPP)"/Contents/PkgInfo - $(Q)cp os/macosx/openttd.icns "$(OSXAPP)"/Contents/Resources/openttd.icns - $(Q)os/macosx/plistgen.sh "$(OSXAPP)" "$(REV)" - $(Q)cp -R data/* "$(OSXAPP)"/Contents/Data/ - $(Q)cp os/macosx/splash.png "$(OSXAPP)"/Contents/Data/ - $(Q)cp lang/*.lng "$(OSXAPP)"/Contents/Lang/ - $(Q)cp $(TTD) "$(OSXAPP)"/Contents/MacOS/$(TTD) - -# make the release disk image. Should only be used with releases and is a good and fast way to make sure to remember all the needed files -release: all - @echo '===> Building release disk image' - $(Q)mkdir -p "OpenTTD $(REV)" - $(Q)mkdir -p "OpenTTD $(REV)/docs" - $(Q)mkdir -p "OpenTTD $(REV)/scenario" - $(Q)cp -R $(OSXAPP) "OpenTTD $(REV)/" - $(Q)cp docs/OSX_install_instructions.txt "OpenTTD $(REV)/How to install (please read).txt" - $(Q)cp readme.txt "OpenTTD $(REV)/docs/" - $(Q)cp COPYING "OpenTTD $(REV)/docs/" - $(Q)cp changelog.txt "OpenTTD $(REV)/docs/" - $(Q)cp known-bugs.txt "OpenTTD $(REV)/known-bugs.txt" - $(Q)cp -R scenario/* "OpenTTD $(REV)/scenario/" - $(Q)hdiutil create -ov -format UDZO -srcfolder "OpenTTD $(REV)" openttd-"$(REV)"-osx.dmg - $(Q)rm -fr "OpenTTD $(REV)" - -$(OSX): $(TTD) $(OSX_STRIP) BUILD_OSX_BUNDLE - -.PHONY: release BUILD_OSX_BUNDLE diff --git a/os/macosx/Makefile.setup b/os/macosx/Makefile.setup deleted file mode 100644 index 38565ced3c..0000000000 --- a/os/macosx/Makefile.setup +++ /dev/null @@ -1,131 +0,0 @@ -# $Id: Makefile 3214 2005-11-17 19:43:37Z bjarni $ -# This makefile is not a standalone makefile, but is called from the general one -# it contains code specific to MacOS X - -ifdef RELEASE -ifndef STATIC -# all OSX releases needs to be static -# end users don't tend to have the dynamic libs installed -$(warning Compiling a dynamic release. It should be static unless you really know what you are doing!!!) -endif -endif - -ifdef RELEASE -ifndef UNIVERSAL_BINARY -$(warning Compiling a release build, that is not a universal binary) -endif -endif - -ifdef TRIPLE_BINARY -ifdef DEBUG -$(error no G5 optimisation is made in debug builds, so triple binaries aren't possible. Use UNIVERSAL_BINARY instead if you really want a universal debug build) -endif -UNIVERSAL_BINARY:=1 -endif - -ifdef UNIVERSAL_BINARY -ifndef STATIC -$(warning Compiling a universal binary, that is not static. Adding static flag) -STATIC:=1 -endif -endif - -ifdef RELEASE -ifdef DEBUG -$(warning Compiling a release build, that is a debug build) -endif -endif - -ifeq ($(shell uname), Darwin) - # it's a hardware mac, not crosscompiling - ifeq ($(shell uname -r), 6.8) - # OSX 10.2.8 uses Darwin 6.8, so we better set JAGUAR so we avoid the stuff that was added in 10.3 or later -$(error OpenTTD can not run or compile on MacOS X 10.2. 10.3.9 or newer is needed) - endif - NATIVE_OSX:=1 -endif - -ifndef PPC_OSX_TARGET -PPC_OSX_TARGET:=10.3.9 -endif -ifndef i386_OSX_TARGET -i386_OSX_TARGET:=10.4u -endif - -# 4-byte bools to make YAPF happy -CFLAGS_PPC += -DFOUR_BYTE_BOOL - -ifndef G5_FLAGS -G5_FLAGS := -mtune=970 -mcpu=970 -mpowerpc-gpopt -endif - -ifdef UNIVERSAL_BINARY - OTTD_PPC:=1 - OTTD_i386:=1 - ifdef TRIPLE_BINARY - OTTD_PPC970:=1 - endif -endif - -# if any targets have been defined by now, we are crosscompiling and we will set up paths accordingly -ifdef OTTD_PPC - ifndef OSX_NO_SYSROOT - CFLAGS_PPC += -isysroot /Developer/SDKs/MacOSX$(PPC_OSX_TARGET).sdk - LDFLAGS_PPC += -Wl,-syslibroot,/Developer/SDKs/MacOSX$(PPC_OSX_TARGET).sdk - endif -endif - -ifdef OTTD_i386 - ifndef OSX_NO_SYSROOT - CFLAGS_i386 += -isysroot /Developer/SDKs/MacOSX$(i386_OSX_TARGET).sdk - LDFLAGS_i386 += -Wl,-syslibroot,/Developer/SDKs/MacOSX$(i386_OSX_TARGET).sdk - endif -endif - -ifdef OTTD_PPC970 - ifndef OTTD_PPC - CFLAGS_PPC += -isysroot /Developer/SDKs/MacOSX$(PPC_OSX_TARGET).sdk - LDFLAGS_PPC += -Wl,-syslibroot,/Developer/SDKs/MacOSX$(PPC_OSX_TARGET).sdk - endif -endif - -# setting up flags to make a binary, that fits the system it builds on -ifdef NATIVE_OSX - ifndef UNIVERSAL_BINARY - # we are not crosscompiling for other macs - # the next line fails if it got whitespace in front of it -$(shell $(CC) os/macosx/G5_detector.c -o os/macosx/G5_detector) - IS_G5:=$(shell os/macosx/G5_detector) - endif -endif - -ifdef NATIVE_OSX - ifndef OTTD_PPC - ifndef OTTD_i386 - ifndef OTTD_PPC970 - # no flags have been set for target versions of OSX, so we will set it to compile for the current host - ifeq ($(shell uname -p), powerpc) - ifdef IS_G5 - OTTD_PPC970:=1 - else - OTTD_PPC:=1 - endif - else - # we are not using a PowerPC CPU, so we assume that it's an Intel mac - OTTD_i386:=1 - endif - endif - endif - endif -endif - -ifdef OTTD_PPC -MACOSX_BUILD:=1 -endif -ifdef OTTD_i386 -MACOSX_BUILD:=1 -endif -ifdef OTTD_PPC970 -MACOSX_BUILD:=1 -endif - diff --git a/projects/generate b/projects/generate new file mode 100755 index 0000000000..da431a9011 --- /dev/null +++ b/projects/generate @@ -0,0 +1,158 @@ +#!/bin/bash + +# This file generates all project files based on sources.list, so everyone who +# can start a bash process, can update the project files. + +ROOT_DIR="`pwd`/.." +if ! [ -e "$ROOT_DIR/source.list" ] +then + ROOT_DIR="`pwd`" +fi +if ! [ -e "$ROOT_DIR/source.list" ] +then + echo "Can't find source.list, needed in order to make this run. Please go to either" + echo " the project dir, or the root dir of a clean SVN checkout." + exit 1 +fi + +# openttd_vs80.sln is for MSVC 2005 +# openttd_vs80.vcproj is for MSVC 2005 +# langs_vs80.vcproj is for MSVC 2005 +# strgen_vs80.vcprojc is vor MSVC 2005 + +# openttd.sln is for MSVC 2003 +# openttd.vcproj is for MSVC 2003 +# langs.vcproj is for MSVC 2003 +# strgen.vcproj is for MSVC 2003 + +# openttd.tgt is for WatCom + + + +# First, collect the list of Windows files +sdl_config="1" +os="MSVC" +enable_dedicated="0" +with_cocoa="0" +enable_directmusic="1" +file_prefix="..\\\\src\\\\" + +load_main_data() { + # Read the source.list and process it + RES="`awk ' + /^( *)#end/ { if (deep == skip) { skip -= 1; } deep -= 1; next; } + /^( *)#else/ { if (deep == skip) { skip -= 1; } else if (deep - 1 == skip) { skip += 1; } next; } + /^( *)#if/ { + gsub(" ", "", $0); + gsub("^#if", "", $0); + gsub("^ ", "", $0); + + if (deep != skip) { deep += 1; next; } + + deep += 1; + + if ($0 == "SDL" && "'$sdl_config'" == "") { next; } + if ($0 == "OSX" && "'$os'" != "OSX") { next; } + if ($0 == "DEDICATED" && "'$enable_dedicated'" != "1") { next; } + if ($0 == "COCOA" && "'$with_cocoa'" == "0") { next; } + if ($0 == "BEOS" && "'$os'" != "BEOS") { next; } + if ($0 == "WIN32" && "'$os'" != "MINGW" && + "'$os'" != "CYGWIN" && "'$os'" != "MSVC" ) { next; } + if ($0 == "MSVC" && "'$os'" != "MSVC") { next; } + if ($0 == "DIRECTMUSIC" && "'$enable_directmusic'" != "1") { next; } + + skip += 1; + + next; + } + /^( *)#/ { + if (deep == skip) { + gsub(" ", "", $0); + gsub("^#", "", $0); + gsub("^ ", "", $0); + + if (first_time != 0) { + print " "; + } else { + first_time = 1; + } + + print " "; + } + + next; + } + /^$/ { next } + { + if (deep == skip) { + gsub(" ", "", $0); + gsub("/", "\\\\", $0); + print " "; + print " "; + } + } + END { print " "; } + ' < $1`" + + eval "$2=\"\$RES\"" +} + +load_lang_data() { + RES="" + for i in `ls $1` + do + i=`basename $i | sed s/.txt$//g` + RES="$RES + + + + + " + done + + eval "$2=\"\$RES\"" +} + +generate() { + echo "Generating $2..." + # Everything above the !!FILES!! marker + RES="`awk ' + /!!FILES!!/ { stop = 1; } + { + if (stop == 0) { print $0 } + } + ' < \"$ROOT_DIR/projects/$2\".in > \"$ROOT_DIR/projects/$2\"`" + + # The files-list + echo "$1" >> "$ROOT_DIR/projects/$2" + + # Everything below the !!FILES!! marker + RES="`awk ' + BEGIN { stop = 1; } + /!!FILES!!/ { stop = 2; } + { + if (stop == 0) { print $0 } + if (stop == 2) { stop = 0 } + } + ' < \"$ROOT_DIR/projects/$2.in\" >> \"$ROOT_DIR/projects/$2\"`" +} + +load_main_data "$ROOT_DIR/source.list" openttd +load_lang_data "$ROOT_DIR/src/lang/*.txt" lang + +generate "$openttd" "openttd.vcproj" +generate "$openttd" "openttd_vs80.vcproj" +generate "$lang" "langs_vs80.vcproj" +generate "$lang" "langs.vcproj" diff --git a/projects/langs.vcproj b/projects/langs.vcproj new file mode 100644 index 0000000000..b2f2b90dd0 --- /dev/null +++ b/projects/langs.vcproj @@ -0,0 +1,436 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/projects/langs.vcproj.in b/projects/langs.vcproj.in new file mode 100644 index 0000000000..e1bcf36d54 --- /dev/null +++ b/projects/langs.vcproj.in @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + +!!FILES!! + + + + diff --git a/projects/langs_vs80.vcproj b/projects/langs_vs80.vcproj new file mode 100644 index 0000000000..dbcd37086c --- /dev/null +++ b/projects/langs_vs80.vcproj @@ -0,0 +1,444 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/projects/langs_vs80.vcproj.in b/projects/langs_vs80.vcproj.in new file mode 100644 index 0000000000..8cbc5467a4 --- /dev/null +++ b/projects/langs_vs80.vcproj.in @@ -0,0 +1,52 @@ + + + + + + + + + + + + + + + + + + +!!FILES!! + + + + diff --git a/openttd.sln b/projects/openttd.sln similarity index 82% rename from openttd.sln rename to projects/openttd.sln index c8072d9e9b..15c930e2a1 100644 --- a/openttd.sln +++ b/projects/openttd.sln @@ -1,5 +1,5 @@ Microsoft Visual Studio Solution File, Format Version 8.00 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "strgen", "strgen\strgen.vcproj", "{A133A442-BD0A-4ADE-B117-AD7545E4BDD1}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "strgen", "strgen.vcproj", "{A133A442-BD0A-4ADE-B117-AD7545E4BDD1}" ProjectSection(ProjectDependencies) = postProject EndProjectSection EndProject @@ -19,11 +19,13 @@ Global Debug = Debug Release = Release EndGlobalSection + GlobalSection(ProjectDependencies) = postSolution + EndGlobalSection GlobalSection(ProjectConfiguration) = postSolution - {A133A442-BD0A-4ADE-B117-AD7545E4BDD1}.Debug.ActiveCfg = Debug|Win32 - {A133A442-BD0A-4ADE-B117-AD7545E4BDD1}.Debug.Build.0 = Debug|Win32 - {A133A442-BD0A-4ADE-B117-AD7545E4BDD1}.Release.ActiveCfg = Debug|Win32 - {A133A442-BD0A-4ADE-B117-AD7545E4BDD1}.Release.Build.0 = Debug|Win32 + {A133A442-BD0A-4ADE-B117-AD7545E4BDD1}.Debug.ActiveCfg = Release|Win32 + {A133A442-BD0A-4ADE-B117-AD7545E4BDD1}.Debug.Build.0 = Release|Win32 + {A133A442-BD0A-4ADE-B117-AD7545E4BDD1}.Release.ActiveCfg = Release|Win32 + {A133A442-BD0A-4ADE-B117-AD7545E4BDD1}.Release.Build.0 = Release|Win32 {668328A0-B40E-4CDB-BD72-D0064424414A}.Debug.ActiveCfg = Debug|Win32 {668328A0-B40E-4CDB-BD72-D0064424414A}.Debug.Build.0 = Debug|Win32 {668328A0-B40E-4CDB-BD72-D0064424414A}.Release.ActiveCfg = Release|Win32 diff --git a/openttd.tgt b/projects/openttd.tgt similarity index 100% rename from openttd.tgt rename to projects/openttd.tgt diff --git a/projects/openttd.vcproj b/projects/openttd.vcproj new file mode 100644 index 0000000000..ce32fc9fe5 --- /dev/null +++ b/projects/openttd.vcproj @@ -0,0 +1,1138 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/projects/openttd.vcproj.in b/projects/openttd.vcproj.in new file mode 100644 index 0000000000..6a38fdeb48 --- /dev/null +++ b/projects/openttd.vcproj.in @@ -0,0 +1,173 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +!!FILES!! + + + + + + + + + + diff --git a/openttd.xcode/default.pbxuser b/projects/openttd.xcode/default.pbxuser similarity index 100% rename from openttd.xcode/default.pbxuser rename to projects/openttd.xcode/default.pbxuser diff --git a/openttd.xcode/project.pbxproj b/projects/openttd.xcode/project.pbxproj similarity index 100% rename from openttd.xcode/project.pbxproj rename to projects/openttd.xcode/project.pbxproj diff --git a/openttd_vs80.sln b/projects/openttd_vs80.sln similarity index 97% rename from openttd_vs80.sln rename to projects/openttd_vs80.sln index f6434f8a4c..7401d38246 100644 --- a/openttd_vs80.sln +++ b/projects/openttd_vs80.sln @@ -1,6 +1,6 @@ Microsoft Visual Studio Solution File, Format Version 9.00 # Visual Studio 2005 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "strgen", "strgen\strgen_vs80.vcproj", "{A133A442-BD0A-4ADE-B117-AD7545E4BDD1}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "strgen", "strgen_vs80.vcproj", "{A133A442-BD0A-4ADE-B117-AD7545E4BDD1}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "openttd", "openttd_vs80.vcproj", "{668328A0-B40E-4CDB-BD72-D0064424414A}" ProjectSection(ProjectDependencies) = postProject diff --git a/projects/openttd_vs80.vcproj b/projects/openttd_vs80.vcproj new file mode 100644 index 0000000000..c4e9d03d1f --- /dev/null +++ b/projects/openttd_vs80.vcproj @@ -0,0 +1,1464 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/projects/openttd_vs80.vcproj.in b/projects/openttd_vs80.vcproj.in new file mode 100644 index 0000000000..7ec0f03b9b --- /dev/null +++ b/projects/openttd_vs80.vcproj.in @@ -0,0 +1,499 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +!!FILES!! + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/projects/openttd_vs80.vcproj.user b/projects/openttd_vs80.vcproj.user new file mode 100644 index 0000000000..2d523a7cef --- /dev/null +++ b/projects/openttd_vs80.vcproj.user @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + + diff --git a/strgen/strgen.tgt b/projects/strgen.tgt similarity index 100% rename from strgen/strgen.tgt rename to projects/strgen.tgt diff --git a/strgen/strgen.vcproj b/projects/strgen.vcproj similarity index 62% rename from strgen/strgen.vcproj rename to projects/strgen.vcproj index 9ca9952971..cb53240c78 100644 --- a/strgen/strgen.vcproj +++ b/projects/strgen.vcproj @@ -3,6 +3,7 @@ ProjectType="Visual C++" Version="7.10" Name="strgen" + RootNamespace="strgen" SccProjectName="" SccLocalPath=""> @@ -11,23 +12,26 @@ + RelativePath="..\src\strgen\strgen.c"> + RelativePath="..\src\string.c"> + + + + + + + + + diff --git a/strgen/strgen_vs80.vcproj b/projects/strgen_vs80.vcproj similarity index 67% rename from strgen/strgen_vs80.vcproj rename to projects/strgen_vs80.vcproj index 67df2e0cea..db9f59f820 100644 --- a/strgen/strgen_vs80.vcproj +++ b/projects/strgen_vs80.vcproj @@ -4,6 +4,7 @@ Version="8.00" Name="strgen" ProjectGUID="{A133A442-BD0A-4ADE-B117-AD7545E4BDD1}" + RootNamespace="strgen" > @@ -110,13 +114,32 @@ Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" > - + RelativePath="..\src\string.c" + > + + + + + + + + + + diff --git a/readme.txt b/readme.txt index 25850aee45..bf27d27871 100644 --- a/readme.txt +++ b/readme.txt @@ -148,25 +148,29 @@ Windows: Unix: OpenTTD can be built with GNU "make". On non-GNU systems it's called "gmake". + However, for the first build one has to do a "./configure" first. Note that you need SDL-devel 1.2.5 (or higher) to compile OpenTTD. MacOS X: Use "make" or Xcode (which will then call make for you) This will give you a binary for your CPU type (PPC/Intel) - To make a universal binary type "make UNIVERSAL_BINARY:=1" + However, for the first build one has to do a "./configure" first. + To make a universal binary type "./configure --enabled-universal" + instead of "./configure". BeOS: - Use "make". + Use "make", but do a "./configure" before the first build. FreeBSD: You need the port devel/sdl12 for a non-dedicated build. graphics/png is optional for screenshots in the PNG format. - Use "gmake". + Use "gmake", but do a "./configure" before the first build. MorphOS: - Use "make". Note that you need the MorphOS SDK, latest libnix updates (else - C++ parts of OpenTTD will not build) and the powersdl.library SDK. Optionally - libz, libpng and freetype2 developer files. + Use "make". However, for the first build one has to do a "./configure" first. + Note that you need the MorphOS SDK, latest libnix updates (else C++ parts of + OpenTTD will not build) and the powersdl.library SDK. Optionally libz, + libpng and freetype2 developer files. OS/2: Open Watcom C/C++ 1.3 or later is required to build the OS/2 version. See the diff --git a/source.list b/source.list new file mode 100644 index 0000000000..b88dba0b13 --- /dev/null +++ b/source.list @@ -0,0 +1,372 @@ +# Source Files +airport.c +aystar.c +bmp.c +callback_table.c +command.c +console.c +console_cmds.c +currency.c +date.c +debug.c +dedicated.c +depot.c +driver.c +economy.c +elrail.c +engine.c +fileio.c +fios.c +fontcache.c +genworld.c +gfx.c +gfxinit.c +heightmap.c +helpers.cpp +landscape.c +map.c +md5.c +mersenne.c +minilzo.c +misc.c +mixer.c +music.c +namegen.c +network/core/packet.c +network/core/tcp.c +network/core/udp.c +network/network.c +network/network_client.c +network/network_data.c +network/network_gamelist.c +network/network_server.c +network/network_udp.c +npf.c +oldloader.c +oldpool.c +openttd.c +os_timer.c +#if WIN32 + ottdres.rc +#end +pathfind.c +players.c +queue.c +rail.c +saveload.c +screenshot.c +#if SDL + sdl.c +#end +settings.c +signs.c +sound.c +spritecache.c +string.c +strings.c +texteff.c +tgp.c +thread.c +tile.c +#if WIN32 +#else + unix.c +#end +vehicle.c +viewport.c +waypoint.c +widget.c +#if WIN32 + win32.c +#end +window.c + +# Header Files +airport.h +airport_movement.h +aystar.h +bmp.h +command.h +console.h +currency.h +date.h +debug.h +video/dedicated_v.h +depot.h +music/dmusic.h +driver.h +economy.h +engine.h +fontcache.h +fileio.h +fios.h +functions.h +genworld.h +gfx.h +gfxinit.h +gui.h +hal.h +heightmap.h +industry.h +livery.h +macros.h +map.h +md5.h +mixer.h +music.h +network/core/config.h +network/core/game.h +network/core/os_abstraction.h +network/core/packet.h +network/core/tcp.h +network/core/udp.h +network/network.h +network/network_client.h +network/network_data.h +network/network_gamelist.h +network/network_gui.h +network/network_server.h +network/network_udp.h +newgrf.h +newgrf_callbacks.h +newgrf_cargo.h +newgrf_config.h +newgrf_engine.h +newgrf_sound.h +newgrf_spritegroup.h +newgrf_station.h +newgrf_text.h +news.h +npf.h +music/null_m.h +sound/null_s.h +video/null_v.h +oldpool.h +openttd.h +pathfind.h +player.h +queue.h +rail.h +road_cmd.h +saveload.h +screenshot.h +sound/sdl_s.h +video/sdl_v.h +settings.h +signs.h +slope.h +sound.h +sprite.h +station.h +stdafx.h +string.h +tgp.h +thread.h +tile.h +town.h +train.h +variables.h +vehicle.h +vehicle_gui.h +viewport.h +waypoint.h +music/win32_m.h +sound/win32_s.h +video/win32_v.h +window.h + +# GUI Source Code +aircraft_gui.c +airport_gui.c +bridge_gui.c +build_vehicle_gui.c +depot_gui.c +dock_gui.c +engine_gui.c +genworld_gui.c +graph_gui.c +industry_gui.c +intro_gui.c +main_gui.c +misc_gui.c +music_gui.c +network/network_gui.c +newgrf_gui.c +news_gui.c +order_gui.c +player_gui.c +rail_gui.c +road_gui.c +roadveh_gui.c +settings_gui.c +ship_gui.c +smallmap_gui.c +station_gui.c +subsidy_gui.c +terraform_gui.c +town_gui.c +train_gui.c +vehicle_gui.c + +# Landscape +aircraft_cmd.c +clear_cmd.c +disaster_cmd.c +dummy_land.c +industry_cmd.c +misc_cmd.c +order_cmd.c +rail_cmd.c +road_cmd.c +roadveh_cmd.c +ship_cmd.c +station_cmd.c +town_cmd.c +train_cmd.c +tree_cmd.c +tunnelbridge_cmd.c +unmovable_cmd.c +water_cmd.c + +# Tables +table/ai_rail.h +table/allstrings.h +table/animcursors.h +table/autorail.h +table/build_industry.h +table/clear_land.h +table/elrail_data.h +table/engines.h +table/genland.h +table/industry_land.h +table/landscape_const.h +table/landscape_sprite.h +table/namegen.h +table/palettes.h +table/road_land.h +table/roadveh.h +table/sprites.h +table/station_land.h +table/strings.h +table/town_land.h +table/track_land.h +table/train_cmd.h +table/tree_land.h +table/tunnel_land.h +table/unmovable_land.h +table/water_land.h + +# AI Files +ai/ai.c +ai/default/default.c +ai/trolly/build.c +ai/trolly/pathfinder.c +ai/trolly/shared.c +ai/trolly/trolly.c + +# NewGRF +newgrf.c +newgrf_cargo.c +newgrf_config.c +newgrf_engine.c +newgrf_sound.c +newgrf_spritegroup.c +newgrf_station.c +newgrf_text.c + +# Map Accessors +bridge_map.c +bridge_map.h +clear_map.h +industry_map.h +rail_map.h +road_map.c +road_map.h +station_map.c +station_map.h +town_map.h +tree_map.h +tunnel_map.c +tunnel_map.h +unmovable_map.h +void_map.h +water_map.h + +# YAPF +yapf/array.hpp +yapf/autocopyptr.hpp +yapf/binaryheap.hpp +yapf/blob.hpp +yapf/countedptr.hpp +yapf/crc32.hpp +yapf/fixedsizearray.hpp +yapf/follow_track.cpp +yapf/follow_track.hpp +yapf/hashtable.hpp +yapf/nodelist.hpp +yapf/track_dir.hpp +yapf/yapf.h +yapf/yapf.hpp +yapf/yapf_base.hpp +yapf/yapf_common.cpp +yapf/yapf_common.hpp +yapf/yapf_costbase.hpp +yapf/yapf_costcache.hpp +yapf/yapf_costrail.hpp +yapf/yapf_destrail.hpp +yapf/yapf_node.hpp +yapf/yapf_node_rail.hpp +yapf/yapf_node_road.hpp +yapf/yapf_rail.cpp +yapf/yapf_road.cpp +yapf/yapf_settings.h +yapf/yapf_ship.cpp + +# Video +video/dedicated_v.c +video/null_v.c +#if SDL + video/sdl_v.c +#end +#if WIN32 + video/win32_v.c +#end + +# Music +#if DIRECTMUSIC + music/dmusic.cpp +#end +music/null_m.c +#if WIN32 + music/win32_m.c +#else + music/extmidi.c +#end +#if BEOS + music/bemidi.cpp +#end + +# Sound +sound/null_s.c +#if SDL + sound/sdl_s.c +#end +#if WIN32 + sound/win32_s.c +#end + +#if OSX +# OSX Files + os/macosx/macos.m + + #if DEDICATED + #else + music/qtmidi.c + #end + + #if COCOA + video/cocoa_v.m + sound/cocoa_s.c + os/macosx/splash.c + #end +#end diff --git a/ai/ai.c b/src/ai/ai.c similarity index 100% rename from ai/ai.c rename to src/ai/ai.c diff --git a/ai/ai.h b/src/ai/ai.h similarity index 100% rename from ai/ai.h rename to src/ai/ai.h diff --git a/ai/default/default.c b/src/ai/default/default.c similarity index 100% rename from ai/default/default.c rename to src/ai/default/default.c diff --git a/ai/default/default.h b/src/ai/default/default.h similarity index 100% rename from ai/default/default.h rename to src/ai/default/default.h diff --git a/ai/trolly/build.c b/src/ai/trolly/build.c similarity index 100% rename from ai/trolly/build.c rename to src/ai/trolly/build.c diff --git a/ai/trolly/pathfinder.c b/src/ai/trolly/pathfinder.c similarity index 100% rename from ai/trolly/pathfinder.c rename to src/ai/trolly/pathfinder.c diff --git a/ai/trolly/shared.c b/src/ai/trolly/shared.c similarity index 100% rename from ai/trolly/shared.c rename to src/ai/trolly/shared.c diff --git a/ai/trolly/trolly.c b/src/ai/trolly/trolly.c similarity index 99% rename from ai/trolly/trolly.c rename to src/ai/trolly/trolly.c index d67a064b4b..35115a8808 100644 --- a/ai/trolly/trolly.c +++ b/src/ai/trolly/trolly.c @@ -23,7 +23,7 @@ #include "../../functions.h" #include "../../road_map.h" #include "../../station_map.h" -#include "../../table/strings.h" +#include "table/strings.h" #include "../../map.h" #include "../../tile.h" #include "../../command.h" diff --git a/ai/trolly/trolly.h b/src/ai/trolly/trolly.h similarity index 100% rename from ai/trolly/trolly.h rename to src/ai/trolly/trolly.h diff --git a/aircraft.h b/src/aircraft.h similarity index 100% rename from aircraft.h rename to src/aircraft.h diff --git a/aircraft_cmd.c b/src/aircraft_cmd.c similarity index 100% rename from aircraft_cmd.c rename to src/aircraft_cmd.c diff --git a/aircraft_gui.c b/src/aircraft_gui.c similarity index 100% rename from aircraft_gui.c rename to src/aircraft_gui.c diff --git a/airport.c b/src/airport.c similarity index 100% rename from airport.c rename to src/airport.c diff --git a/airport.h b/src/airport.h similarity index 100% rename from airport.h rename to src/airport.h diff --git a/airport_gui.c b/src/airport_gui.c similarity index 100% rename from airport_gui.c rename to src/airport_gui.c diff --git a/airport_movement.h b/src/airport_movement.h similarity index 100% rename from airport_movement.h rename to src/airport_movement.h diff --git a/aystar.c b/src/aystar.c similarity index 100% rename from aystar.c rename to src/aystar.c diff --git a/aystar.h b/src/aystar.h similarity index 100% rename from aystar.h rename to src/aystar.h diff --git a/bmp.c b/src/bmp.c similarity index 100% rename from bmp.c rename to src/bmp.c diff --git a/bmp.h b/src/bmp.h similarity index 100% rename from bmp.h rename to src/bmp.h diff --git a/bridge.h b/src/bridge.h similarity index 100% rename from bridge.h rename to src/bridge.h diff --git a/bridge_gui.c b/src/bridge_gui.c similarity index 100% rename from bridge_gui.c rename to src/bridge_gui.c diff --git a/bridge_map.c b/src/bridge_map.c similarity index 100% rename from bridge_map.c rename to src/bridge_map.c diff --git a/bridge_map.h b/src/bridge_map.h similarity index 100% rename from bridge_map.h rename to src/bridge_map.h diff --git a/build_vehicle_gui.c b/src/build_vehicle_gui.c similarity index 100% rename from build_vehicle_gui.c rename to src/build_vehicle_gui.c diff --git a/callback_table.c b/src/callback_table.c similarity index 100% rename from callback_table.c rename to src/callback_table.c diff --git a/callback_table.h b/src/callback_table.h similarity index 100% rename from callback_table.h rename to src/callback_table.h diff --git a/clear_cmd.c b/src/clear_cmd.c similarity index 100% rename from clear_cmd.c rename to src/clear_cmd.c diff --git a/clear_map.h b/src/clear_map.h similarity index 100% rename from clear_map.h rename to src/clear_map.h diff --git a/command.c b/src/command.c similarity index 100% rename from command.c rename to src/command.c diff --git a/command.h b/src/command.h similarity index 100% rename from command.h rename to src/command.h diff --git a/src/configure b/src/configure new file mode 100755 index 0000000000..2fd2939547 --- /dev/null +++ b/src/configure @@ -0,0 +1,323 @@ +#!/bin/sh + +# This 'configure' script is a very easy wrapper around 'make updateconf' +# It allows cross-compilers to do their job much more easy. + +function showhelp() { + echo "Configure for OpenTTD" + echo "" + echo "Usage:" + echo " $0 --your_options" + echo "" + echo "Params:" + echo " --debug Create debug-release [no]" + echo " --profile Create profile-release [no]" + echo " --dedicated Make a dedicated build [no]" + echo " --revision Set the revision of the compilation [detected]" + echo " --target-cc Sets the target-compiler [\$CC]" + echo " --target-cxx Sets the C++ target-compiler []" + echo " --host-cc Sets the host-compiler [\$CC]" + echo " --host-cxx Sets the C++ host-compiler []" + echo " --os Sets the OS. Listens to: [detected]" + echo " UNIX, OSX, FREEBSD, MORPHOS" + echo " BEOS, SUNOS, CYGWIN, MINGW, OS2" + echo " --windres Sets the windres (Windows) [windres]" + echo " --force-le Force LE platform [no]" + echo " --force-be Force BE platform [no]" + echo "" + echo "Params that can be used with --with or --without" + echo " (e.g.: --without-static disables static (default))" + echo " static Do you want a static build? [no]" + echo " directmusic Do you want direct-music? [no]" + echo " zlib Do you want zlib-support? [yes]" + echo " sdl Do you want SDL-support? [yes]" + echo " png Do you want PNG-support? [yes]" + echo " iconv Do you want iconv-support? [no]" + echo " network Do you want network-support? [yes]" + echo " cocoa Do you want cocoa-support? (MacOSX) [no]" + echo " freetype Do you want freetype-support? [yes]" + echo " fontconfig Do you want fontconfig-support? [yes]" + echo "" + echo "Params used to configure external libs:" + echo " --static-zlib-path Set the path to your static zlib []" + echo " --sdl-config Where is your sdl-config [sdl-config]" + echo " --libpng-config Where is your libpng-config [libpng-config]" + echo " --freetype-config Where is your freetype-config [freetype-config]" + echo " --fontconfig-config Where is your fontconfig-config [pkg-config fontconfig]" + echo " --with-iconv Set the path to your iconv headers []" + echo " " +} + +function handle() { + PARAM="$PARAM \"$1=`awk 'BEGIN { FS="="; $0="'"$2"'"; print $2;}'`\"" +} + +# The things you can use inside this case: +# handle NAME VALUE - Sets the value to give the 'make upgradeconf' +# Value is in form: tag=REAL_VALUE +# ITEM="NAME" - Will set the value as above, only with the next param +# SITEM="NAME" - Will set the var $NAME to the next param +for n in "$@" +do + case "$n" in + --help | -h) + showhelp + exit 0 + ;; + + --debug) + DEBUG_SET=1 + ITEM="DEBUG" + ;; + --debug=*) + handle "DEBUG" "$n" + ;; + --profile) + PARAM="$PARAM PROFILE=1" + ;; + --dedicated) + PARAM="$PARAM DEDICATED=1" + ;; + --revision=*) + RELEASE=`awk 'BEGIN { FS="="; $0="'"$n"'"; print $2;}'` + ;; + --revision) + SITEM="RELEASE" + ;; + --target-cc=*) + handle "CC_TARGET" "$n" + ;; + --target-cc) + ITEM="CC_TARGET" + ;; + --target-cxx=*) + handle "CXX_TARGET" "$n" + ;; + --target-cxx) + SITEM="CXX_TARGET" + ;; + --host-cc=*) + handle "CC_HOST" "$n" + ;; + --host-cc) + ITEM="CC_HOST" + ;; + --host-cxx=*) + handle "CXX_HOST" "$n" + ;; + --host-cxx) + ITEM="CXX_HOST" + ;; + --host-cflags=*) + handle CFLAGS_HOST "$n" + ;; + --host-cflags) + ITEM="CFLAGS_HOST" + ;; + --os=*) + TARGET_OS=`awk 'BEGIN { FS="="; $0="'"$n"'"; print $2;}'` + ;; + --os) + SITEM="TARGET_OS" + ;; + --windres=*) + handle WINDRES "$n" + ;; + --windres) + ITEM="WINDRES" + ;; + --force-le) + PARAM="$PARAM ENDIAN_FORCE=LE" + ;; + --force-be) + PARAM="$PARAM ENDIAN_FORCE=BE" + ;; + + --with-static) + PARAM="$PARAM STATIC=1" + ;; + --without-static) + PARAM="$PARAM STATIC=" + ;; + --with-directmusic) + PARAM="$PARAM WITH_DIRECTMUSIC=1" + ;; + --without-directmusic) + PARAM="$PARAM WITH_DIRECTMUSIC=" + ;; + --with-zlib) + PARAM="$PARAM WITH_ZLIB=1" + ;; + --without-zlib) + PARAM="$PARAM WITH_ZLIB=" + ;; + --with-sdl) + PARAM="$PARAM WITH_SDL=1" + ;; + --without-sdl) + PARAM="$PARAM WITH_SDL=" + ;; + --with-png) + PARAM="$PARAM WITH_PNG=1" + ;; + --without-png) + PARAM="$PARAM WITH_PNG=" + ;; + --with-iconv) + PARAM="$PARAM WITH_ICONV=1" + ;; + --with-iconv=*) + PARAM="$PARAM WITH_ICONV=1" + handle WITH_ICONV_PATH "$n" + ;; + --without-iconv) + PARAM="$PARAM WITH_ICONV=" + ;; + --with-cocoa) + PARAM="$PARAM WITH_COCOA=1" + ;; + --with-network) + PARAM="$PARAM WITH_NETWORK=1" + ;; + --without-network) + PARAM="$PARAM WITH_NETWORK=" + ;; + --without-cocoa) + PARAM="$PARAM WITH_COCOA=" + ;; + --with-freetype) + PARAM="$PARAM WITH_FREETYPE=1" + ;; + --without-freetype) + PARAM="$PARAM WITH_FREETYPE=" + ;; + --with-fontconfig) + PARAM="$PARAM WITH_FONTCONFIG=1" + ;; + --without-fontconfig) + PARAM="$PARAM WITH_FONTCONFIG=" + ;; + --static-zlib-path=*) + handle STATIC_ZLIB_PATH "$n" + ;; + --static-zlib-path) + ITEM="STATIC_ZLIB_PATH" + ;; + --sdl-config=*) + handle SDL_CONFIG "$n" + ;; + --sdl-config) + ITEM="SDL_CONFIG" + ;; + --libpng-config=*) + handle LIBPNG_CONFIG "$n" + ;; + --libpng-config) + ITEM="LIBPNG_CONFIG" + ;; + --freetype-config=*) + handle FREETYPE_CONFIG "$n" + ;; + --freetype-config) + ITEM="FREETYPE_CONFIG" + ;; + --fontconfig-config=*) + handle FONTCONFIG_CONFIG "$n" + ;; + --fontconfig-config) + ITEM="FONTCONFIG_CONFIG" + ;; + + --*=*) + echo -n "Unknown switch " + echo `awk 'BEGIN { FS="="; $0="'"$n"'"; print $1;}'` + exit 1 + ;; + -*) + echo "Unknown switch $n" + exit 1 + ;; + + *) + if ! test -z "$ITEM" + then + PARAM="$PARAM $ITEM=\"$n\"" + ITEM=""; + elif ! test -z "$SITEM" + then + export $SITEM="$n" + SITEM="" + else + echo "Unknown switch $n" + exit 1 + fi + ;; + esac +done + +if ! test -z "$TARGET_OS" +then + TARGET_OS=`echo $TARGET_OS | tr '[:lower:]' '[:upper:]'` + case "$TARGET_OS" in + WIN32) + PARAM="$PARAM WIN32=1" + ;; + UNIX) + PARAM="$PARAM UNIX=1" + ;; + OSX) + PARAM="$PARAM OSX=1 UNIX=1" + ;; + FREEBSD) + PARAM="$PARAM FREEBSD=1" + ;; + MORPHOS) + PARAM="$PARAM MORPHOS=1 UNIX=1" + ;; + BEOS) + PARAM="$PARAM BEOS=1 UNIX=1" + ;; + OS2) + PARAM="$PARAM OS2=1 UNIX=1" + ;; + SUNOS) + PARAM="$PARAM SUNOS=1 UNIX=1" + ;; + CYGWIN) + PARAM="$PARAM CYGWIN=1 WIN32=1" + ;; + MINGW) + PARAM="$PARAM MINGW=1 WIN32=1" + ;; + *) + echo "Unknown OS: $TARGET_OS" + exit 1 + ;; + esac + PARAM="$PARAM BYPASS_OS_DETECT=1" +fi + +if ! test -z "$DEBUG_SET" +then + if test -z "`echo $PARAM | grep "DEBUG="`" + then + # Someone did --debug, without assigning a value, assume 1 + PARAM="$PARAM DEBUG=1" + fi +fi + +# First remove the Makefile.config, else you can have double entries +rm -f Makefile.config + +echo "make upgradeconf $PARAM" > Makefile.run +. Makefile.run +rm -f Makefile.run + +# Makefile.config currently doesn't support custom RELEASE (revision), so, we add the line +# yourself! + +if ! test -z "$RELEASE" +then + echo "RELEASE=$RELEASE" >> Makefile.config +fi + diff --git a/console.c b/src/console.c similarity index 100% rename from console.c rename to src/console.c diff --git a/console.h b/src/console.h similarity index 100% rename from console.h rename to src/console.h diff --git a/console_cmds.c b/src/console_cmds.c similarity index 100% rename from console_cmds.c rename to src/console_cmds.c diff --git a/currency.c b/src/currency.c similarity index 100% rename from currency.c rename to src/currency.c diff --git a/currency.h b/src/currency.h similarity index 100% rename from currency.h rename to src/currency.h diff --git a/date.c b/src/date.c similarity index 100% rename from date.c rename to src/date.c diff --git a/date.h b/src/date.h similarity index 100% rename from date.h rename to src/date.h diff --git a/debug.c b/src/debug.c similarity index 100% rename from debug.c rename to src/debug.c diff --git a/debug.h b/src/debug.h similarity index 100% rename from debug.h rename to src/debug.h diff --git a/dedicated.c b/src/dedicated.c similarity index 100% rename from dedicated.c rename to src/dedicated.c diff --git a/depot.c b/src/depot.c similarity index 100% rename from depot.c rename to src/depot.c diff --git a/depot.h b/src/depot.h similarity index 100% rename from depot.h rename to src/depot.h diff --git a/depot_gui.c b/src/depot_gui.c similarity index 100% rename from depot_gui.c rename to src/depot_gui.c diff --git a/direction.h b/src/direction.h similarity index 100% rename from direction.h rename to src/direction.h diff --git a/disaster_cmd.c b/src/disaster_cmd.c similarity index 100% rename from disaster_cmd.c rename to src/disaster_cmd.c diff --git a/dock_gui.c b/src/dock_gui.c similarity index 100% rename from dock_gui.c rename to src/dock_gui.c diff --git a/driver.c b/src/driver.c similarity index 100% rename from driver.c rename to src/driver.c diff --git a/driver.h b/src/driver.h similarity index 100% rename from driver.h rename to src/driver.h diff --git a/dummy_land.c b/src/dummy_land.c similarity index 100% rename from dummy_land.c rename to src/dummy_land.c diff --git a/economy.c b/src/economy.c similarity index 100% rename from economy.c rename to src/economy.c diff --git a/economy.h b/src/economy.h similarity index 100% rename from economy.h rename to src/economy.h diff --git a/elrail.c b/src/elrail.c similarity index 100% rename from elrail.c rename to src/elrail.c diff --git a/endian_check.c b/src/endian_check.c similarity index 100% rename from endian_check.c rename to src/endian_check.c diff --git a/engine.c b/src/engine.c similarity index 100% rename from engine.c rename to src/engine.c diff --git a/engine.h b/src/engine.h similarity index 100% rename from engine.h rename to src/engine.h diff --git a/engine_gui.c b/src/engine_gui.c similarity index 100% rename from engine_gui.c rename to src/engine_gui.c diff --git a/fileio.c b/src/fileio.c similarity index 100% rename from fileio.c rename to src/fileio.c diff --git a/fileio.h b/src/fileio.h similarity index 100% rename from fileio.h rename to src/fileio.h diff --git a/fios.c b/src/fios.c similarity index 100% rename from fios.c rename to src/fios.c diff --git a/fios.h b/src/fios.h similarity index 100% rename from fios.h rename to src/fios.h diff --git a/fontcache.c b/src/fontcache.c similarity index 100% rename from fontcache.c rename to src/fontcache.c diff --git a/fontcache.h b/src/fontcache.h similarity index 100% rename from fontcache.h rename to src/fontcache.h diff --git a/functions.h b/src/functions.h similarity index 100% rename from functions.h rename to src/functions.h diff --git a/genworld.c b/src/genworld.c similarity index 100% rename from genworld.c rename to src/genworld.c diff --git a/genworld.h b/src/genworld.h similarity index 100% rename from genworld.h rename to src/genworld.h diff --git a/genworld_gui.c b/src/genworld_gui.c similarity index 100% rename from genworld_gui.c rename to src/genworld_gui.c diff --git a/gfx.c b/src/gfx.c similarity index 100% rename from gfx.c rename to src/gfx.c diff --git a/gfx.h b/src/gfx.h similarity index 100% rename from gfx.h rename to src/gfx.h diff --git a/gfxinit.c b/src/gfxinit.c similarity index 100% rename from gfxinit.c rename to src/gfxinit.c diff --git a/gfxinit.h b/src/gfxinit.h similarity index 100% rename from gfxinit.h rename to src/gfxinit.h diff --git a/graph_gui.c b/src/graph_gui.c similarity index 100% rename from graph_gui.c rename to src/graph_gui.c diff --git a/gui.h b/src/gui.h similarity index 100% rename from gui.h rename to src/gui.h diff --git a/hal.h b/src/hal.h similarity index 100% rename from hal.h rename to src/hal.h diff --git a/heightmap.c b/src/heightmap.c similarity index 100% rename from heightmap.c rename to src/heightmap.c diff --git a/heightmap.h b/src/heightmap.h similarity index 100% rename from heightmap.h rename to src/heightmap.h diff --git a/helpers.cpp b/src/helpers.cpp similarity index 100% rename from helpers.cpp rename to src/helpers.cpp diff --git a/industry.h b/src/industry.h similarity index 100% rename from industry.h rename to src/industry.h diff --git a/industry_cmd.c b/src/industry_cmd.c similarity index 100% rename from industry_cmd.c rename to src/industry_cmd.c diff --git a/industry_gui.c b/src/industry_gui.c similarity index 100% rename from industry_gui.c rename to src/industry_gui.c diff --git a/industry_map.h b/src/industry_map.h similarity index 100% rename from industry_map.h rename to src/industry_map.h diff --git a/intro_gui.c b/src/intro_gui.c similarity index 100% rename from intro_gui.c rename to src/intro_gui.c diff --git a/landscape.c b/src/landscape.c similarity index 100% rename from landscape.c rename to src/landscape.c diff --git a/lang/american.txt b/src/lang/american.txt similarity index 100% rename from lang/american.txt rename to src/lang/american.txt diff --git a/lang/brazilian_portuguese.txt b/src/lang/brazilian_portuguese.txt similarity index 100% rename from lang/brazilian_portuguese.txt rename to src/lang/brazilian_portuguese.txt diff --git a/lang/bulgarian.txt b/src/lang/bulgarian.txt similarity index 100% rename from lang/bulgarian.txt rename to src/lang/bulgarian.txt diff --git a/lang/catalan.txt b/src/lang/catalan.txt similarity index 100% rename from lang/catalan.txt rename to src/lang/catalan.txt diff --git a/lang/czech.txt b/src/lang/czech.txt similarity index 100% rename from lang/czech.txt rename to src/lang/czech.txt diff --git a/lang/danish.txt b/src/lang/danish.txt similarity index 100% rename from lang/danish.txt rename to src/lang/danish.txt diff --git a/lang/dutch.txt b/src/lang/dutch.txt similarity index 100% rename from lang/dutch.txt rename to src/lang/dutch.txt diff --git a/lang/english.txt b/src/lang/english.txt similarity index 100% rename from lang/english.txt rename to src/lang/english.txt diff --git a/lang/esperanto.txt b/src/lang/esperanto.txt similarity index 100% rename from lang/esperanto.txt rename to src/lang/esperanto.txt diff --git a/lang/estonian.txt b/src/lang/estonian.txt similarity index 100% rename from lang/estonian.txt rename to src/lang/estonian.txt diff --git a/lang/finnish.txt b/src/lang/finnish.txt similarity index 100% rename from lang/finnish.txt rename to src/lang/finnish.txt diff --git a/lang/french.txt b/src/lang/french.txt similarity index 100% rename from lang/french.txt rename to src/lang/french.txt diff --git a/lang/galician.txt b/src/lang/galician.txt similarity index 100% rename from lang/galician.txt rename to src/lang/galician.txt diff --git a/lang/german.txt b/src/lang/german.txt similarity index 100% rename from lang/german.txt rename to src/lang/german.txt diff --git a/lang/hungarian.txt b/src/lang/hungarian.txt similarity index 100% rename from lang/hungarian.txt rename to src/lang/hungarian.txt diff --git a/lang/icelandic.txt b/src/lang/icelandic.txt similarity index 100% rename from lang/icelandic.txt rename to src/lang/icelandic.txt diff --git a/lang/italian.txt b/src/lang/italian.txt similarity index 100% rename from lang/italian.txt rename to src/lang/italian.txt diff --git a/lang/norwegian.txt b/src/lang/norwegian.txt similarity index 100% rename from lang/norwegian.txt rename to src/lang/norwegian.txt diff --git a/lang/origveh.txt b/src/lang/origveh.txt similarity index 100% rename from lang/origveh.txt rename to src/lang/origveh.txt diff --git a/lang/polish.txt b/src/lang/polish.txt similarity index 100% rename from lang/polish.txt rename to src/lang/polish.txt diff --git a/lang/portuguese.txt b/src/lang/portuguese.txt similarity index 100% rename from lang/portuguese.txt rename to src/lang/portuguese.txt diff --git a/lang/romanian.txt b/src/lang/romanian.txt similarity index 100% rename from lang/romanian.txt rename to src/lang/romanian.txt diff --git a/lang/russian.txt b/src/lang/russian.txt similarity index 100% rename from lang/russian.txt rename to src/lang/russian.txt diff --git a/lang/slovak.txt b/src/lang/slovak.txt similarity index 100% rename from lang/slovak.txt rename to src/lang/slovak.txt diff --git a/lang/spanish.txt b/src/lang/spanish.txt similarity index 100% rename from lang/spanish.txt rename to src/lang/spanish.txt diff --git a/lang/swedish.txt b/src/lang/swedish.txt similarity index 100% rename from lang/swedish.txt rename to src/lang/swedish.txt diff --git a/lang/turkish.txt b/src/lang/turkish.txt similarity index 100% rename from lang/turkish.txt rename to src/lang/turkish.txt diff --git a/lang/ukrainian.txt b/src/lang/ukrainian.txt similarity index 100% rename from lang/ukrainian.txt rename to src/lang/ukrainian.txt diff --git a/lang/unfinished/afrikaans.txt b/src/lang/unfinished/afrikaans.txt similarity index 100% rename from lang/unfinished/afrikaans.txt rename to src/lang/unfinished/afrikaans.txt diff --git a/lang/unfinished/croatian.txt b/src/lang/unfinished/croatian.txt similarity index 100% rename from lang/unfinished/croatian.txt rename to src/lang/unfinished/croatian.txt diff --git a/lang/unfinished/frisian.txt b/src/lang/unfinished/frisian.txt similarity index 100% rename from lang/unfinished/frisian.txt rename to src/lang/unfinished/frisian.txt diff --git a/lang/unfinished/greek.txt b/src/lang/unfinished/greek.txt similarity index 100% rename from lang/unfinished/greek.txt rename to src/lang/unfinished/greek.txt diff --git a/lang/unfinished/japanese.txt b/src/lang/unfinished/japanese.txt similarity index 100% rename from lang/unfinished/japanese.txt rename to src/lang/unfinished/japanese.txt diff --git a/lang/unfinished/latvian.txt b/src/lang/unfinished/latvian.txt similarity index 100% rename from lang/unfinished/latvian.txt rename to src/lang/unfinished/latvian.txt diff --git a/lang/unfinished/lithuanian.txt b/src/lang/unfinished/lithuanian.txt similarity index 100% rename from lang/unfinished/lithuanian.txt rename to src/lang/unfinished/lithuanian.txt diff --git a/lang/unfinished/serbian.txt b/src/lang/unfinished/serbian.txt similarity index 100% rename from lang/unfinished/serbian.txt rename to src/lang/unfinished/serbian.txt diff --git a/lang/unfinished/simplified_chinese.txt b/src/lang/unfinished/simplified_chinese.txt similarity index 100% rename from lang/unfinished/simplified_chinese.txt rename to src/lang/unfinished/simplified_chinese.txt diff --git a/lang/unfinished/slovenian.txt b/src/lang/unfinished/slovenian.txt similarity index 100% rename from lang/unfinished/slovenian.txt rename to src/lang/unfinished/slovenian.txt diff --git a/lang/unfinished/traditional_chinese.txt b/src/lang/unfinished/traditional_chinese.txt similarity index 100% rename from lang/unfinished/traditional_chinese.txt rename to src/lang/unfinished/traditional_chinese.txt diff --git a/livery.h b/src/livery.h similarity index 100% rename from livery.h rename to src/livery.h diff --git a/lzoconf.h b/src/lzoconf.h similarity index 100% rename from lzoconf.h rename to src/lzoconf.h diff --git a/macros.h b/src/macros.h similarity index 100% rename from macros.h rename to src/macros.h diff --git a/main_gui.c b/src/main_gui.c similarity index 100% rename from main_gui.c rename to src/main_gui.c diff --git a/map.c b/src/map.c similarity index 100% rename from map.c rename to src/map.c diff --git a/map.h b/src/map.h similarity index 100% rename from map.h rename to src/map.h diff --git a/masm64.rules b/src/masm64.rules similarity index 100% rename from masm64.rules rename to src/masm64.rules diff --git a/md5.c b/src/md5.c similarity index 100% rename from md5.c rename to src/md5.c diff --git a/md5.h b/src/md5.h similarity index 100% rename from md5.h rename to src/md5.h diff --git a/mersenne.c b/src/mersenne.c similarity index 100% rename from mersenne.c rename to src/mersenne.c diff --git a/minilzo.c b/src/minilzo.c similarity index 100% rename from minilzo.c rename to src/minilzo.c diff --git a/minilzo.h b/src/minilzo.h similarity index 100% rename from minilzo.h rename to src/minilzo.h diff --git a/misc.c b/src/misc.c similarity index 100% rename from misc.c rename to src/misc.c diff --git a/misc_cmd.c b/src/misc_cmd.c similarity index 100% rename from misc_cmd.c rename to src/misc_cmd.c diff --git a/misc_gui.c b/src/misc_gui.c similarity index 100% rename from misc_gui.c rename to src/misc_gui.c diff --git a/mixer.c b/src/mixer.c similarity index 100% rename from mixer.c rename to src/mixer.c diff --git a/mixer.h b/src/mixer.h similarity index 100% rename from mixer.h rename to src/mixer.h diff --git a/music.c b/src/music.c similarity index 100% rename from music.c rename to src/music.c diff --git a/music.h b/src/music.h similarity index 100% rename from music.h rename to src/music.h diff --git a/music/bemidi.cpp b/src/music/bemidi.cpp similarity index 100% rename from music/bemidi.cpp rename to src/music/bemidi.cpp diff --git a/music/bemidi.h b/src/music/bemidi.h similarity index 100% rename from music/bemidi.h rename to src/music/bemidi.h diff --git a/music/dmusic.cpp b/src/music/dmusic.cpp similarity index 100% rename from music/dmusic.cpp rename to src/music/dmusic.cpp diff --git a/music/dmusic.h b/src/music/dmusic.h similarity index 100% rename from music/dmusic.h rename to src/music/dmusic.h diff --git a/music/extmidi.c b/src/music/extmidi.c similarity index 100% rename from music/extmidi.c rename to src/music/extmidi.c diff --git a/music/extmidi.h b/src/music/extmidi.h similarity index 100% rename from music/extmidi.h rename to src/music/extmidi.h diff --git a/music/null_m.c b/src/music/null_m.c similarity index 100% rename from music/null_m.c rename to src/music/null_m.c diff --git a/music/null_m.h b/src/music/null_m.h similarity index 100% rename from music/null_m.h rename to src/music/null_m.h diff --git a/music/os2_m.c b/src/music/os2_m.c similarity index 100% rename from music/os2_m.c rename to src/music/os2_m.c diff --git a/music/os2_m.h b/src/music/os2_m.h similarity index 100% rename from music/os2_m.h rename to src/music/os2_m.h diff --git a/music/qtmidi.c b/src/music/qtmidi.c similarity index 100% rename from music/qtmidi.c rename to src/music/qtmidi.c diff --git a/music/qtmidi.h b/src/music/qtmidi.h similarity index 100% rename from music/qtmidi.h rename to src/music/qtmidi.h diff --git a/music/win32_m.c b/src/music/win32_m.c similarity index 100% rename from music/win32_m.c rename to src/music/win32_m.c diff --git a/music/win32_m.h b/src/music/win32_m.h similarity index 100% rename from music/win32_m.h rename to src/music/win32_m.h diff --git a/music_gui.c b/src/music_gui.c similarity index 100% rename from music_gui.c rename to src/music_gui.c diff --git a/namegen.c b/src/namegen.c similarity index 100% rename from namegen.c rename to src/namegen.c diff --git a/namegen.h b/src/namegen.h similarity index 100% rename from namegen.h rename to src/namegen.h diff --git a/network/core/config.h b/src/network/core/config.h similarity index 100% rename from network/core/config.h rename to src/network/core/config.h diff --git a/network/core/game.h b/src/network/core/game.h similarity index 100% rename from network/core/game.h rename to src/network/core/game.h diff --git a/network/core/os_abstraction.h b/src/network/core/os_abstraction.h similarity index 100% rename from network/core/os_abstraction.h rename to src/network/core/os_abstraction.h diff --git a/network/core/packet.c b/src/network/core/packet.c similarity index 100% rename from network/core/packet.c rename to src/network/core/packet.c diff --git a/network/core/packet.h b/src/network/core/packet.h similarity index 100% rename from network/core/packet.h rename to src/network/core/packet.h diff --git a/network/core/tcp.c b/src/network/core/tcp.c similarity index 99% rename from network/core/tcp.c rename to src/network/core/tcp.c index 493a97dfff..ec073c7ce2 100644 --- a/network/core/tcp.c +++ b/src/network/core/tcp.c @@ -6,7 +6,7 @@ #include "../../debug.h" #include "../../openttd.h" #include "../../variables.h" -#include "../../table/strings.h" +#include "table/strings.h" #include "../../functions.h" #include "os_abstraction.h" diff --git a/network/core/tcp.h b/src/network/core/tcp.h similarity index 100% rename from network/core/tcp.h rename to src/network/core/tcp.h diff --git a/network/core/udp.c b/src/network/core/udp.c similarity index 100% rename from network/core/udp.c rename to src/network/core/udp.c diff --git a/network/core/udp.h b/src/network/core/udp.h similarity index 100% rename from network/core/udp.h rename to src/network/core/udp.h diff --git a/network/network.c b/src/network/network.c similarity index 99% rename from network/network.c rename to src/network/network.c index 83f7eedcd7..c8cb85804a 100644 --- a/network/network.c +++ b/src/network/network.c @@ -25,7 +25,7 @@ #include "../variables.h" #include "../date.h" #include "../newgrf_config.h" -#include "../table/strings.h" +#include "table/strings.h" #include "network_client.h" #include "network_server.h" #include "network_udp.h" diff --git a/network/network.h b/src/network/network.h similarity index 100% rename from network/network.h rename to src/network/network.h diff --git a/network/network_client.c b/src/network/network_client.c similarity index 99% rename from network/network_client.c rename to src/network/network_client.c index ce2a71ac19..6e27eec562 100644 --- a/network/network_client.c +++ b/src/network/network_client.c @@ -9,7 +9,7 @@ #include "network_data.h" #include "core/tcp.h" #include "../date.h" -#include "../table/strings.h" +#include "table/strings.h" #include "../functions.h" #include "network_client.h" #include "network_gamelist.h" diff --git a/network/network_client.h b/src/network/network_client.h similarity index 100% rename from network/network_client.h rename to src/network/network_client.h diff --git a/network/network_data.c b/src/network/network_data.c similarity index 100% rename from network/network_data.c rename to src/network/network_data.c diff --git a/network/network_data.h b/src/network/network_data.h similarity index 100% rename from network/network_data.h rename to src/network/network_data.h diff --git a/network/network_gamelist.c b/src/network/network_gamelist.c similarity index 100% rename from network/network_gamelist.c rename to src/network/network_gamelist.c diff --git a/network/network_gamelist.h b/src/network/network_gamelist.h similarity index 100% rename from network/network_gamelist.h rename to src/network/network_gamelist.h diff --git a/network/network_gui.c b/src/network/network_gui.c similarity index 99% rename from network/network_gui.c rename to src/network/network_gui.c index 91c990bbca..dd865118ee 100644 --- a/network/network_gui.c +++ b/src/network/network_gui.c @@ -10,7 +10,7 @@ #include "../date.h" #include "../fios.h" -#include "../table/strings.h" +#include "table/strings.h" #include "../functions.h" #include "network_data.h" #include "network_client.h" diff --git a/network/network_gui.h b/src/network/network_gui.h similarity index 100% rename from network/network_gui.h rename to src/network/network_gui.h diff --git a/network/network_server.c b/src/network/network_server.c similarity index 99% rename from network/network_server.c rename to src/network/network_server.c index 2a75d15feb..5a71091050 100644 --- a/network/network_server.c +++ b/src/network/network_server.c @@ -11,7 +11,7 @@ #include "core/tcp.h" #include "../train.h" #include "../date.h" -#include "../table/strings.h" +#include "table/strings.h" #include "../functions.h" #include "network_server.h" #include "network_udp.h" diff --git a/network/network_server.h b/src/network/network_server.h similarity index 100% rename from network/network_server.h rename to src/network/network_server.h diff --git a/network/network_udp.c b/src/network/network_udp.c similarity index 100% rename from network/network_udp.c rename to src/network/network_udp.c diff --git a/network/network_udp.h b/src/network/network_udp.h similarity index 100% rename from network/network_udp.h rename to src/network/network_udp.h diff --git a/newgrf.c b/src/newgrf.c similarity index 100% rename from newgrf.c rename to src/newgrf.c diff --git a/newgrf.h b/src/newgrf.h similarity index 100% rename from newgrf.h rename to src/newgrf.h diff --git a/newgrf_callbacks.h b/src/newgrf_callbacks.h similarity index 100% rename from newgrf_callbacks.h rename to src/newgrf_callbacks.h diff --git a/newgrf_cargo.c b/src/newgrf_cargo.c similarity index 100% rename from newgrf_cargo.c rename to src/newgrf_cargo.c diff --git a/newgrf_cargo.h b/src/newgrf_cargo.h similarity index 100% rename from newgrf_cargo.h rename to src/newgrf_cargo.h diff --git a/newgrf_config.c b/src/newgrf_config.c similarity index 100% rename from newgrf_config.c rename to src/newgrf_config.c diff --git a/newgrf_config.h b/src/newgrf_config.h similarity index 100% rename from newgrf_config.h rename to src/newgrf_config.h diff --git a/newgrf_engine.c b/src/newgrf_engine.c similarity index 100% rename from newgrf_engine.c rename to src/newgrf_engine.c diff --git a/newgrf_engine.h b/src/newgrf_engine.h similarity index 100% rename from newgrf_engine.h rename to src/newgrf_engine.h diff --git a/newgrf_gui.c b/src/newgrf_gui.c similarity index 100% rename from newgrf_gui.c rename to src/newgrf_gui.c diff --git a/newgrf_sound.c b/src/newgrf_sound.c similarity index 100% rename from newgrf_sound.c rename to src/newgrf_sound.c diff --git a/newgrf_sound.h b/src/newgrf_sound.h similarity index 100% rename from newgrf_sound.h rename to src/newgrf_sound.h diff --git a/newgrf_spritegroup.c b/src/newgrf_spritegroup.c similarity index 100% rename from newgrf_spritegroup.c rename to src/newgrf_spritegroup.c diff --git a/newgrf_spritegroup.h b/src/newgrf_spritegroup.h similarity index 100% rename from newgrf_spritegroup.h rename to src/newgrf_spritegroup.h diff --git a/newgrf_station.c b/src/newgrf_station.c similarity index 100% rename from newgrf_station.c rename to src/newgrf_station.c diff --git a/newgrf_station.h b/src/newgrf_station.h similarity index 100% rename from newgrf_station.h rename to src/newgrf_station.h diff --git a/newgrf_text.c b/src/newgrf_text.c similarity index 100% rename from newgrf_text.c rename to src/newgrf_text.c diff --git a/newgrf_text.h b/src/newgrf_text.h similarity index 100% rename from newgrf_text.h rename to src/newgrf_text.h diff --git a/news.h b/src/news.h similarity index 100% rename from news.h rename to src/news.h diff --git a/news_gui.c b/src/news_gui.c similarity index 100% rename from news_gui.c rename to src/news_gui.c diff --git a/npf.c b/src/npf.c similarity index 100% rename from npf.c rename to src/npf.c diff --git a/npf.h b/src/npf.h similarity index 100% rename from npf.h rename to src/npf.h diff --git a/oldloader.c b/src/oldloader.c similarity index 100% rename from oldloader.c rename to src/oldloader.c diff --git a/oldpool.c b/src/oldpool.c similarity index 100% rename from oldpool.c rename to src/oldpool.c diff --git a/oldpool.h b/src/oldpool.h similarity index 100% rename from oldpool.h rename to src/oldpool.h diff --git a/openttd.c b/src/openttd.c similarity index 100% rename from openttd.c rename to src/openttd.c diff --git a/openttd.h b/src/openttd.h similarity index 100% rename from openttd.h rename to src/openttd.h diff --git a/order.h b/src/order.h similarity index 100% rename from order.h rename to src/order.h diff --git a/order_cmd.c b/src/order_cmd.c similarity index 100% rename from order_cmd.c rename to src/order_cmd.c diff --git a/order_gui.c b/src/order_gui.c similarity index 100% rename from order_gui.c rename to src/order_gui.c diff --git a/os/macosx/G5_detector.c b/src/os/macosx/G5_detector.c similarity index 100% rename from os/macosx/G5_detector.c rename to src/os/macosx/G5_detector.c diff --git a/os/macosx/macos.h b/src/os/macosx/macos.h similarity index 100% rename from os/macosx/macos.h rename to src/os/macosx/macos.h diff --git a/os/macosx/macos.m b/src/os/macosx/macos.m similarity index 100% rename from os/macosx/macos.m rename to src/os/macosx/macos.m diff --git a/os/macosx/osx_stdafx.h b/src/os/macosx/osx_stdafx.h similarity index 100% rename from os/macosx/osx_stdafx.h rename to src/os/macosx/osx_stdafx.h diff --git a/os/macosx/splash.c b/src/os/macosx/splash.c similarity index 100% rename from os/macosx/splash.c rename to src/os/macosx/splash.c diff --git a/os/macosx/splash.h b/src/os/macosx/splash.h similarity index 100% rename from os/macosx/splash.h rename to src/os/macosx/splash.h diff --git a/os2.c b/src/os2.c similarity index 100% rename from os2.c rename to src/os2.c diff --git a/os_timer.c b/src/os_timer.c similarity index 100% rename from os_timer.c rename to src/os_timer.c diff --git a/ottdres.rc b/src/ottdres.rc similarity index 100% rename from ottdres.rc rename to src/ottdres.rc diff --git a/pathfind.c b/src/pathfind.c similarity index 100% rename from pathfind.c rename to src/pathfind.c diff --git a/pathfind.h b/src/pathfind.h similarity index 100% rename from pathfind.h rename to src/pathfind.h diff --git a/player.h b/src/player.h similarity index 100% rename from player.h rename to src/player.h diff --git a/player_gui.c b/src/player_gui.c similarity index 100% rename from player_gui.c rename to src/player_gui.c diff --git a/players.c b/src/players.c similarity index 100% rename from players.c rename to src/players.c diff --git a/queue.c b/src/queue.c similarity index 100% rename from queue.c rename to src/queue.c diff --git a/queue.h b/src/queue.h similarity index 100% rename from queue.h rename to src/queue.h diff --git a/rail.c b/src/rail.c similarity index 100% rename from rail.c rename to src/rail.c diff --git a/rail.h b/src/rail.h similarity index 100% rename from rail.h rename to src/rail.h diff --git a/rail_cmd.c b/src/rail_cmd.c similarity index 100% rename from rail_cmd.c rename to src/rail_cmd.c diff --git a/rail_gui.c b/src/rail_gui.c similarity index 100% rename from rail_gui.c rename to src/rail_gui.c diff --git a/rail_map.h b/src/rail_map.h similarity index 100% rename from rail_map.h rename to src/rail_map.h diff --git a/railtypes.h b/src/railtypes.h similarity index 100% rename from railtypes.h rename to src/railtypes.h diff --git a/resource.h b/src/resource.h similarity index 100% rename from resource.h rename to src/resource.h diff --git a/road.h b/src/road.h similarity index 100% rename from road.h rename to src/road.h diff --git a/road_cmd.c b/src/road_cmd.c similarity index 100% rename from road_cmd.c rename to src/road_cmd.c diff --git a/road_cmd.h b/src/road_cmd.h similarity index 100% rename from road_cmd.h rename to src/road_cmd.h diff --git a/road_gui.c b/src/road_gui.c similarity index 100% rename from road_gui.c rename to src/road_gui.c diff --git a/road_map.c b/src/road_map.c similarity index 100% rename from road_map.c rename to src/road_map.c diff --git a/road_map.h b/src/road_map.h similarity index 100% rename from road_map.h rename to src/road_map.h diff --git a/roadveh.h b/src/roadveh.h similarity index 100% rename from roadveh.h rename to src/roadveh.h diff --git a/roadveh_cmd.c b/src/roadveh_cmd.c similarity index 100% rename from roadveh_cmd.c rename to src/roadveh_cmd.c diff --git a/roadveh_gui.c b/src/roadveh_gui.c similarity index 100% rename from roadveh_gui.c rename to src/roadveh_gui.c diff --git a/saveload.c b/src/saveload.c similarity index 100% rename from saveload.c rename to src/saveload.c diff --git a/saveload.h b/src/saveload.h similarity index 100% rename from saveload.h rename to src/saveload.h diff --git a/screenshot.c b/src/screenshot.c similarity index 100% rename from screenshot.c rename to src/screenshot.c diff --git a/screenshot.h b/src/screenshot.h similarity index 100% rename from screenshot.h rename to src/screenshot.h diff --git a/sdl.c b/src/sdl.c similarity index 100% rename from sdl.c rename to src/sdl.c diff --git a/sdl.h b/src/sdl.h similarity index 100% rename from sdl.h rename to src/sdl.h diff --git a/settings.c b/src/settings.c similarity index 100% rename from settings.c rename to src/settings.c diff --git a/settings.h b/src/settings.h similarity index 100% rename from settings.h rename to src/settings.h diff --git a/settings_gui.c b/src/settings_gui.c similarity index 100% rename from settings_gui.c rename to src/settings_gui.c diff --git a/ship.h b/src/ship.h similarity index 100% rename from ship.h rename to src/ship.h diff --git a/ship_cmd.c b/src/ship_cmd.c similarity index 100% rename from ship_cmd.c rename to src/ship_cmd.c diff --git a/ship_gui.c b/src/ship_gui.c similarity index 100% rename from ship_gui.c rename to src/ship_gui.c diff --git a/signs.c b/src/signs.c similarity index 100% rename from signs.c rename to src/signs.c diff --git a/signs.h b/src/signs.h similarity index 100% rename from signs.h rename to src/signs.h diff --git a/slope.h b/src/slope.h similarity index 100% rename from slope.h rename to src/slope.h diff --git a/smallmap_gui.c b/src/smallmap_gui.c similarity index 100% rename from smallmap_gui.c rename to src/smallmap_gui.c diff --git a/sound.c b/src/sound.c similarity index 100% rename from sound.c rename to src/sound.c diff --git a/sound.h b/src/sound.h similarity index 100% rename from sound.h rename to src/sound.h diff --git a/sound/cocoa_s.c b/src/sound/cocoa_s.c similarity index 100% rename from sound/cocoa_s.c rename to src/sound/cocoa_s.c diff --git a/sound/cocoa_s.h b/src/sound/cocoa_s.h similarity index 100% rename from sound/cocoa_s.h rename to src/sound/cocoa_s.h diff --git a/sound/null_s.c b/src/sound/null_s.c similarity index 100% rename from sound/null_s.c rename to src/sound/null_s.c diff --git a/sound/null_s.h b/src/sound/null_s.h similarity index 100% rename from sound/null_s.h rename to src/sound/null_s.h diff --git a/sound/sdl_s.c b/src/sound/sdl_s.c similarity index 100% rename from sound/sdl_s.c rename to src/sound/sdl_s.c diff --git a/sound/sdl_s.h b/src/sound/sdl_s.h similarity index 100% rename from sound/sdl_s.h rename to src/sound/sdl_s.h diff --git a/sound/win32_s.c b/src/sound/win32_s.c similarity index 100% rename from sound/win32_s.c rename to src/sound/win32_s.c diff --git a/sound/win32_s.h b/src/sound/win32_s.h similarity index 100% rename from sound/win32_s.h rename to src/sound/win32_s.h diff --git a/sprite.h b/src/sprite.h similarity index 100% rename from sprite.h rename to src/sprite.h diff --git a/spritecache.c b/src/spritecache.c similarity index 100% rename from spritecache.c rename to src/spritecache.c diff --git a/spritecache.h b/src/spritecache.h similarity index 100% rename from spritecache.h rename to src/spritecache.h diff --git a/station.h b/src/station.h similarity index 100% rename from station.h rename to src/station.h diff --git a/station_cmd.c b/src/station_cmd.c similarity index 100% rename from station_cmd.c rename to src/station_cmd.c diff --git a/station_gui.c b/src/station_gui.c similarity index 100% rename from station_gui.c rename to src/station_gui.c diff --git a/station_map.c b/src/station_map.c similarity index 100% rename from station_map.c rename to src/station_map.c diff --git a/station_map.h b/src/station_map.h similarity index 100% rename from station_map.h rename to src/station_map.h diff --git a/stdafx.h b/src/stdafx.h similarity index 100% rename from stdafx.h rename to src/stdafx.h diff --git a/strgen/strgen.c b/src/strgen/strgen.c similarity index 100% rename from strgen/strgen.c rename to src/strgen/strgen.c diff --git a/string.c b/src/string.c similarity index 100% rename from string.c rename to src/string.c diff --git a/string.h b/src/string.h similarity index 100% rename from string.h rename to src/string.h diff --git a/strings.c b/src/strings.c similarity index 100% rename from strings.c rename to src/strings.c diff --git a/strings.h b/src/strings.h similarity index 100% rename from strings.h rename to src/strings.h diff --git a/subsidy_gui.c b/src/subsidy_gui.c similarity index 100% rename from subsidy_gui.c rename to src/subsidy_gui.c diff --git a/table/ai_rail.h b/src/table/ai_rail.h similarity index 100% rename from table/ai_rail.h rename to src/table/ai_rail.h diff --git a/table/animcursors.h b/src/table/animcursors.h similarity index 100% rename from table/animcursors.h rename to src/table/animcursors.h diff --git a/table/autorail.h b/src/table/autorail.h similarity index 100% rename from table/autorail.h rename to src/table/autorail.h diff --git a/table/bridge_land.h b/src/table/bridge_land.h similarity index 100% rename from table/bridge_land.h rename to src/table/bridge_land.h diff --git a/table/build_industry.h b/src/table/build_industry.h similarity index 100% rename from table/build_industry.h rename to src/table/build_industry.h diff --git a/table/clear_land.h b/src/table/clear_land.h similarity index 100% rename from table/clear_land.h rename to src/table/clear_land.h diff --git a/table/control_codes.h b/src/table/control_codes.h similarity index 100% rename from table/control_codes.h rename to src/table/control_codes.h diff --git a/table/elrail_data.h b/src/table/elrail_data.h similarity index 100% rename from table/elrail_data.h rename to src/table/elrail_data.h diff --git a/table/engines.h b/src/table/engines.h similarity index 100% rename from table/engines.h rename to src/table/engines.h diff --git a/table/files.h b/src/table/files.h similarity index 100% rename from table/files.h rename to src/table/files.h diff --git a/table/genland.h b/src/table/genland.h similarity index 100% rename from table/genland.h rename to src/table/genland.h diff --git a/table/industry_land.h b/src/table/industry_land.h similarity index 100% rename from table/industry_land.h rename to src/table/industry_land.h diff --git a/table/landscape_const.h b/src/table/landscape_const.h similarity index 100% rename from table/landscape_const.h rename to src/table/landscape_const.h diff --git a/table/landscape_sprite.h b/src/table/landscape_sprite.h similarity index 100% rename from table/landscape_sprite.h rename to src/table/landscape_sprite.h diff --git a/table/namegen.h b/src/table/namegen.h similarity index 100% rename from table/namegen.h rename to src/table/namegen.h diff --git a/table/palettes.h b/src/table/palettes.h similarity index 100% rename from table/palettes.h rename to src/table/palettes.h diff --git a/table/road_land.h b/src/table/road_land.h similarity index 100% rename from table/road_land.h rename to src/table/road_land.h diff --git a/table/roadveh.h b/src/table/roadveh.h similarity index 100% rename from table/roadveh.h rename to src/table/roadveh.h diff --git a/table/sprites.h b/src/table/sprites.h similarity index 100% rename from table/sprites.h rename to src/table/sprites.h diff --git a/table/station_land.h b/src/table/station_land.h similarity index 100% rename from table/station_land.h rename to src/table/station_land.h diff --git a/table/town_land.h b/src/table/town_land.h similarity index 100% rename from table/town_land.h rename to src/table/town_land.h diff --git a/table/track_land.h b/src/table/track_land.h similarity index 100% rename from table/track_land.h rename to src/table/track_land.h diff --git a/table/train_cmd.h b/src/table/train_cmd.h similarity index 100% rename from table/train_cmd.h rename to src/table/train_cmd.h diff --git a/table/tree_land.h b/src/table/tree_land.h similarity index 100% rename from table/tree_land.h rename to src/table/tree_land.h diff --git a/table/unicode.h b/src/table/unicode.h similarity index 100% rename from table/unicode.h rename to src/table/unicode.h diff --git a/table/unmovable_land.h b/src/table/unmovable_land.h similarity index 100% rename from table/unmovable_land.h rename to src/table/unmovable_land.h diff --git a/table/water_land.h b/src/table/water_land.h similarity index 100% rename from table/water_land.h rename to src/table/water_land.h diff --git a/terraform_gui.c b/src/terraform_gui.c similarity index 100% rename from terraform_gui.c rename to src/terraform_gui.c diff --git a/texteff.c b/src/texteff.c similarity index 100% rename from texteff.c rename to src/texteff.c diff --git a/tgp.c b/src/tgp.c similarity index 100% rename from tgp.c rename to src/tgp.c diff --git a/tgp.h b/src/tgp.h similarity index 100% rename from tgp.h rename to src/tgp.h diff --git a/thread.c b/src/thread.c similarity index 100% rename from thread.c rename to src/thread.c diff --git a/thread.h b/src/thread.h similarity index 100% rename from thread.h rename to src/thread.h diff --git a/tile.c b/src/tile.c similarity index 100% rename from tile.c rename to src/tile.c diff --git a/tile.h b/src/tile.h similarity index 100% rename from tile.h rename to src/tile.h diff --git a/town.h b/src/town.h similarity index 100% rename from town.h rename to src/town.h diff --git a/town_cmd.c b/src/town_cmd.c similarity index 100% rename from town_cmd.c rename to src/town_cmd.c diff --git a/town_gui.c b/src/town_gui.c similarity index 100% rename from town_gui.c rename to src/town_gui.c diff --git a/town_map.h b/src/town_map.h similarity index 100% rename from town_map.h rename to src/town_map.h diff --git a/train.h b/src/train.h similarity index 100% rename from train.h rename to src/train.h diff --git a/train_cmd.c b/src/train_cmd.c similarity index 100% rename from train_cmd.c rename to src/train_cmd.c diff --git a/train_gui.c b/src/train_gui.c similarity index 100% rename from train_gui.c rename to src/train_gui.c diff --git a/tree_cmd.c b/src/tree_cmd.c similarity index 100% rename from tree_cmd.c rename to src/tree_cmd.c diff --git a/tree_map.h b/src/tree_map.h similarity index 100% rename from tree_map.h rename to src/tree_map.h diff --git a/tunnel_map.c b/src/tunnel_map.c similarity index 100% rename from tunnel_map.c rename to src/tunnel_map.c diff --git a/tunnel_map.h b/src/tunnel_map.h similarity index 100% rename from tunnel_map.h rename to src/tunnel_map.h diff --git a/tunnelbridge_cmd.c b/src/tunnelbridge_cmd.c similarity index 100% rename from tunnelbridge_cmd.c rename to src/tunnelbridge_cmd.c diff --git a/unix.c b/src/unix.c similarity index 100% rename from unix.c rename to src/unix.c diff --git a/unmovable.h b/src/unmovable.h similarity index 100% rename from unmovable.h rename to src/unmovable.h diff --git a/unmovable_cmd.c b/src/unmovable_cmd.c similarity index 100% rename from unmovable_cmd.c rename to src/unmovable_cmd.c diff --git a/unmovable_map.h b/src/unmovable_map.h similarity index 100% rename from unmovable_map.h rename to src/unmovable_map.h diff --git a/variables.h b/src/variables.h similarity index 100% rename from variables.h rename to src/variables.h diff --git a/vehicle.c b/src/vehicle.c similarity index 100% rename from vehicle.c rename to src/vehicle.c diff --git a/vehicle.h b/src/vehicle.h similarity index 100% rename from vehicle.h rename to src/vehicle.h diff --git a/vehicle_gui.c b/src/vehicle_gui.c similarity index 100% rename from vehicle_gui.c rename to src/vehicle_gui.c diff --git a/vehicle_gui.h b/src/vehicle_gui.h similarity index 100% rename from vehicle_gui.h rename to src/vehicle_gui.h diff --git a/video/cocoa_keys.h b/src/video/cocoa_keys.h similarity index 100% rename from video/cocoa_keys.h rename to src/video/cocoa_keys.h diff --git a/video/cocoa_v.h b/src/video/cocoa_v.h similarity index 100% rename from video/cocoa_v.h rename to src/video/cocoa_v.h diff --git a/video/cocoa_v.m b/src/video/cocoa_v.m similarity index 100% rename from video/cocoa_v.m rename to src/video/cocoa_v.m diff --git a/video/dedicated_v.c b/src/video/dedicated_v.c similarity index 100% rename from video/dedicated_v.c rename to src/video/dedicated_v.c diff --git a/video/dedicated_v.h b/src/video/dedicated_v.h similarity index 100% rename from video/dedicated_v.h rename to src/video/dedicated_v.h diff --git a/video/null_v.c b/src/video/null_v.c similarity index 100% rename from video/null_v.c rename to src/video/null_v.c diff --git a/video/null_v.h b/src/video/null_v.h similarity index 100% rename from video/null_v.h rename to src/video/null_v.h diff --git a/video/sdl_v.c b/src/video/sdl_v.c similarity index 100% rename from video/sdl_v.c rename to src/video/sdl_v.c diff --git a/video/sdl_v.h b/src/video/sdl_v.h similarity index 100% rename from video/sdl_v.h rename to src/video/sdl_v.h diff --git a/video/win32_v.c b/src/video/win32_v.c similarity index 100% rename from video/win32_v.c rename to src/video/win32_v.c diff --git a/video/win32_v.h b/src/video/win32_v.h similarity index 100% rename from video/win32_v.h rename to src/video/win32_v.h diff --git a/viewport.c b/src/viewport.c similarity index 100% rename from viewport.c rename to src/viewport.c diff --git a/viewport.h b/src/viewport.h similarity index 100% rename from viewport.h rename to src/viewport.h diff --git a/void_map.h b/src/void_map.h similarity index 100% rename from void_map.h rename to src/void_map.h diff --git a/water_cmd.c b/src/water_cmd.c similarity index 100% rename from water_cmd.c rename to src/water_cmd.c diff --git a/water_map.h b/src/water_map.h similarity index 100% rename from water_map.h rename to src/water_map.h diff --git a/waypoint.c b/src/waypoint.c similarity index 100% rename from waypoint.c rename to src/waypoint.c diff --git a/waypoint.h b/src/waypoint.h similarity index 100% rename from waypoint.h rename to src/waypoint.h diff --git a/widget.c b/src/widget.c similarity index 100% rename from widget.c rename to src/widget.c diff --git a/win32.c b/src/win32.c similarity index 100% rename from win32.c rename to src/win32.c diff --git a/win32.h b/src/win32.h similarity index 100% rename from win32.h rename to src/win32.h diff --git a/win64.asm b/src/win64.asm similarity index 100% rename from win64.asm rename to src/win64.asm diff --git a/window.c b/src/window.c similarity index 100% rename from window.c rename to src/window.c diff --git a/window.h b/src/window.h similarity index 100% rename from window.h rename to src/window.h diff --git a/yapf/array.hpp b/src/yapf/array.hpp similarity index 100% rename from yapf/array.hpp rename to src/yapf/array.hpp diff --git a/yapf/autocopyptr.hpp b/src/yapf/autocopyptr.hpp similarity index 100% rename from yapf/autocopyptr.hpp rename to src/yapf/autocopyptr.hpp diff --git a/yapf/binaryheap.hpp b/src/yapf/binaryheap.hpp similarity index 100% rename from yapf/binaryheap.hpp rename to src/yapf/binaryheap.hpp diff --git a/yapf/blob.hpp b/src/yapf/blob.hpp similarity index 100% rename from yapf/blob.hpp rename to src/yapf/blob.hpp diff --git a/yapf/countedptr.hpp b/src/yapf/countedptr.hpp similarity index 100% rename from yapf/countedptr.hpp rename to src/yapf/countedptr.hpp diff --git a/yapf/crc32.hpp b/src/yapf/crc32.hpp similarity index 100% rename from yapf/crc32.hpp rename to src/yapf/crc32.hpp diff --git a/yapf/fixedsizearray.hpp b/src/yapf/fixedsizearray.hpp similarity index 100% rename from yapf/fixedsizearray.hpp rename to src/yapf/fixedsizearray.hpp diff --git a/yapf/follow_track.cpp b/src/yapf/follow_track.cpp similarity index 100% rename from yapf/follow_track.cpp rename to src/yapf/follow_track.cpp diff --git a/yapf/follow_track.hpp b/src/yapf/follow_track.hpp similarity index 100% rename from yapf/follow_track.hpp rename to src/yapf/follow_track.hpp diff --git a/yapf/hashtable.hpp b/src/yapf/hashtable.hpp similarity index 100% rename from yapf/hashtable.hpp rename to src/yapf/hashtable.hpp diff --git a/yapf/nodelist.hpp b/src/yapf/nodelist.hpp similarity index 100% rename from yapf/nodelist.hpp rename to src/yapf/nodelist.hpp diff --git a/yapf/track_dir.hpp b/src/yapf/track_dir.hpp similarity index 100% rename from yapf/track_dir.hpp rename to src/yapf/track_dir.hpp diff --git a/yapf/yapf.h b/src/yapf/yapf.h similarity index 100% rename from yapf/yapf.h rename to src/yapf/yapf.h diff --git a/yapf/yapf.hpp b/src/yapf/yapf.hpp similarity index 100% rename from yapf/yapf.hpp rename to src/yapf/yapf.hpp diff --git a/yapf/yapf_base.hpp b/src/yapf/yapf_base.hpp similarity index 100% rename from yapf/yapf_base.hpp rename to src/yapf/yapf_base.hpp diff --git a/yapf/yapf_common.cpp b/src/yapf/yapf_common.cpp similarity index 100% rename from yapf/yapf_common.cpp rename to src/yapf/yapf_common.cpp diff --git a/yapf/yapf_common.hpp b/src/yapf/yapf_common.hpp similarity index 100% rename from yapf/yapf_common.hpp rename to src/yapf/yapf_common.hpp diff --git a/yapf/yapf_costbase.hpp b/src/yapf/yapf_costbase.hpp similarity index 100% rename from yapf/yapf_costbase.hpp rename to src/yapf/yapf_costbase.hpp diff --git a/yapf/yapf_costcache.hpp b/src/yapf/yapf_costcache.hpp similarity index 100% rename from yapf/yapf_costcache.hpp rename to src/yapf/yapf_costcache.hpp diff --git a/yapf/yapf_costrail.hpp b/src/yapf/yapf_costrail.hpp similarity index 100% rename from yapf/yapf_costrail.hpp rename to src/yapf/yapf_costrail.hpp diff --git a/yapf/yapf_destrail.hpp b/src/yapf/yapf_destrail.hpp similarity index 100% rename from yapf/yapf_destrail.hpp rename to src/yapf/yapf_destrail.hpp diff --git a/yapf/yapf_node.hpp b/src/yapf/yapf_node.hpp similarity index 100% rename from yapf/yapf_node.hpp rename to src/yapf/yapf_node.hpp diff --git a/yapf/yapf_node_rail.hpp b/src/yapf/yapf_node_rail.hpp similarity index 100% rename from yapf/yapf_node_rail.hpp rename to src/yapf/yapf_node_rail.hpp diff --git a/yapf/yapf_node_road.hpp b/src/yapf/yapf_node_road.hpp similarity index 100% rename from yapf/yapf_node_road.hpp rename to src/yapf/yapf_node_road.hpp diff --git a/yapf/yapf_rail.cpp b/src/yapf/yapf_rail.cpp similarity index 100% rename from yapf/yapf_rail.cpp rename to src/yapf/yapf_rail.cpp diff --git a/yapf/yapf_road.cpp b/src/yapf/yapf_road.cpp similarity index 100% rename from yapf/yapf_road.cpp rename to src/yapf/yapf_road.cpp diff --git a/yapf/yapf_settings.h b/src/yapf/yapf_settings.h similarity index 100% rename from yapf/yapf_settings.h rename to src/yapf/yapf_settings.h diff --git a/yapf/yapf_ship.cpp b/src/yapf/yapf_ship.cpp similarity index 100% rename from yapf/yapf_ship.cpp rename to src/yapf/yapf_ship.cpp