@@ -359,193 +359,200 @@ LDFLAGS += -mwin32
endif
ifdef MINGW
BASECFLAGS += -mno-cygwin
LDFLAGS += -mno-cygwin
CFLAGS += $(BASECFLAGS)
# See if we want to enable GPMI
ifdef GPMI
CFLAGS += -DGPMI
GPMI_STATIC_PATH = `gpmi-config --static`
LDFLAGS += -rdynamic `gpmi-config --libs`
# Static link paths into the game
LDFLAGS += $(GPMI_STATIC_PATH)/paths-static.o
ifdef UNIX
CDEFS += -DUNIX
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
ifdef MORPHOS
# -Wstrict-prototypes generates much noise because of system headers
CFLAGS += -Wno-strict-prototypes
ifdef SUNOS
CDEFS += -DSUNOS
LDFLAGS += -lnsl -lsocket
# tell the source that we are building a dedicated server
ifdef DEDICATED
CDEFS += -DDEDICATED
# SDL config
ifdef WITH_SDL
CDEFS += -DWITH_SDL
CFLAGS += $(shell $(SDL-CONFIG) --cflags)
ifdef STATIC
LIBS += $(shell $(SDL-CONFIG) --static-libs)
LIBS += $(shell $(SDL-CONFIG) --libs)
# zlib config
ifdef WITH_ZLIB
CDEFS += -DWITH_ZLIB
ifdef OSX
# zlib is default on OSX, so everybody have it. No need for static linking
LIBS += -lz
ifndef STATIC_ZLIB_PATH
ifndef MANUAL_CONFIG
# updates Makefile.config with the zlib path
UPDATECONFIG:=upgradeconf
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)
TEMP:=$(shell ls /usr/lib 2>/dev/null | grep "zlib.a")$(shell ls /usr/lib 2>/dev/null | grep "libz.a")
STATIC_ZLIB_PATH:=/usr/lib/$(TEMP)
TEMP:=$(shell ls /usr/local/lib 2>/dev/null | grep "zlib.a")$(shell ls /usr/local/lib 2>/dev/null | grep "libz.a")
STATIC_ZLIB_PATH:=/usr/local/lib/$(TEMP)
LIBS += $(STATIC_ZLIB_PATH)
# libpng config
ifdef WITH_PNG
CDEFS += -DWITH_PNG
CFLAGS += $(shell $(LIBPNG-CONFIG) --cppflags --I_opts)
# seems like older libpng versions are broken and need this
PNGCONFIG_FLAGS = --ldflags --libs
# Seems like we need a tiny hack for OSX static to work
LIBS += $(shell $(LIBPNG-CONFIG) --prefix)/lib/libpng.a
LIBS += $(shell $(LIBPNG-CONFIG) --static $(PNGCONFIG_FLAGS))
LIBS += $(shell $(LIBPNG-CONFIG) --L_opts $(PNGCONFIG_FLAGS))
# enables/disables assert()
ifdef DISABLE_ASSERTS
CFLAGS += -DNDEBUG
# automatically disables asserts for release
ifdef RELEASE
ifndef ENABLE_ASSERTS
ifdef TRANSLATOR
STRGEN_FLAGS=-t
STRGEN_FLAGS=
# MIDI setup
ifndef MIDI
MIDI:=$(OSXAPP)/Contents/MacOS/track_starter
ifndef SECOND_DATA_PATH
SECOND_DATA_PATH:="$(OSXAPP)/Contents/Data/"
ifndef CUSTOM_LANG_DIR
ifndef DEDICATED
CUSTOM_LANG_DIR:="$(OSXAPP)/Contents/Lang/"
ifdef MIDI
CDEFS += -DEXTERNAL_PLAYER=\"$(MIDI)\"
ifdef MIDI_ARG
CDEFS += -DMIDI_ARG=\"$(MIDI_ARG)\"
CDEFS += -DENABLE_NETWORK
ifdef QNX
LIBS += -lsocket
ifdef SECOND_DATA_PATH
CDEFS += -DSECOND_DATA_DIR=\"$(SECOND_DATA_PATH)/\"
ifdef CUSTOM_LANG_DIR
CDEFS += -DCUSTOM_LANG_DIR=\"$(CUSTOM_LANG_DIR)/\"
ifdef WITH_DIRECTMUSIC
CDEFS += -DWIN32_ENABLE_DIRECTMUSIC_SUPPORT
ifdef WIN32
LIBS += -lws2_32 -lwinmm -lgdi32 -ldxguid -lole32
LIBS += -lstdc++
TTDLDFLAGS += -Wl,--subsystem,windows
ifndef DEST_DIR
DEST_DIR = $(DESTDIR)
# 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)
# We use _INSTALL vars here, these vars are the locations where the files will
# be installed
@@ -667,98 +674,100 @@ C_SOURCES += town_cmd.c
C_SOURCES += town_gui.c
C_SOURCES += train_cmd.c
C_SOURCES += train_gui.c
C_SOURCES += tree_cmd.c
C_SOURCES += tunnelbridge_cmd.c
C_SOURCES += unmovable_cmd.c
C_SOURCES += vehicle.c
C_SOURCES += vehicle_gui.c
C_SOURCES += viewport.c
C_SOURCES += water_cmd.c
C_SOURCES += waypoint.c
C_SOURCES += widget.c
C_SOURCES += window.c
C_SOURCES += music/null_m.c
C_SOURCES += sound/null_s.c
C_SOURCES += video/dedicated_v.c
C_SOURCES += video/null_v.c
# AI related files
C_SOURCES += ai/ai.c
C_SOURCES += ai/default/default.c
C_SOURCES += ai/trolly/trolly.c
C_SOURCES += ai/trolly/build.c
C_SOURCES += ai/trolly/pathfinder.c
C_SOURCES += ai/trolly/shared.c
CXX_SOURCES =
OBJC_SOURCES =
C_SOURCES += sdl.c
C_SOURCES += sound/sdl_s.c
C_SOURCES += video/sdl_v.c
C_SOURCES += win32.c
C_SOURCES += music/win32_m.c
C_SOURCES += sound/win32_s.c
C_SOURCES += video/win32_v.c
C_SOURCES += unix.c
C_SOURCES += music/extmidi.c
OBJC_SOURCES += os/macosx/macos.m
C_SOURCES += music/qtmidi.c
OBJS = $(C_SOURCES:%.c=%.o) $(CXX_SOURCES:%.cpp=%.o) $(OBJC_SOURCES:%.m=%.o)
CXX_SOURCES += music/bemidi.cpp
# Resource file
OBJS += winres.o
CXX_SOURCES += music/dmusic.cpp
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 =
Q = @
# Targets
### Normal build rules
OSX:=OSX
@@ -7,97 +7,97 @@
#include "functions.h"
#include "hal.h"
#include "string.h"
#include "music/bemidi.h"
#include "music/dmusic.h"
#include "music/extmidi.h"
#include "music/null_m.h"
#include "music/os2_m.h"
#include "music/win32_m.h"
#include "music/qtmidi.h"
#include "sound/null_s.h"
#include "sound/sdl_s.h"
#include "sound/win32_s.h"
#include "video/dedicated_v.h"
#include "video/null_v.h"
#include "video/sdl_v.h"
#include "video/win32_v.h"
typedef struct DriverDesc {
const char* name;
const char* longname;
const HalCommonDriver* drv;
} DriverDesc;
typedef struct DriverClass {
const DriverDesc *descs;
const char *name;
const HalCommonDriver** drv;
} DriverClass;
#define M(x, y, z) { x, y, (const HalCommonDriver*)z }
static const DriverDesc _music_driver_descs[] = {
#ifdef __BEOS__
M("bemidi", "BeOS MIDI Driver", &_bemidi_music_driver),
#endif
#ifdef __OS2__
M("os2", "OS/2 Music Driver", &_os2_music_driver),
#ifdef WIN32_ENABLE_DIRECTMUSIC_SUPPORT
M("dmusic", "DirectMusic MIDI Driver", &_dmusic_midi_driver),
#ifdef WIN32
M("win32", "Win32 MIDI Driver", &_win32_music_driver),
#ifdef __APPLE__
#if defined(__APPLE__) && !defined(DEDICATED)
M("qt", "QuickTime MIDI Driver", &_qtime_music_driver),
#ifdef UNIX
#if !defined(__MORPHOS__) && !defined(__AMIGA__)
M("extmidi", "External MIDI Driver", &_extmidi_music_driver),
M("null", "Null Music Driver", &_null_music_driver),
M(NULL, NULL, NULL)
};
static const DriverDesc _sound_driver_descs[] = {
M("win32", "Win32 WaveOut Driver", &_win32_sound_driver),
#ifdef WITH_SDL
M("sdl", "SDL Sound Driver", &_sdl_sound_driver),
M("null", "Null Sound Driver", &_null_sound_driver),
static const DriverDesc _video_driver_descs[] = {
M("win32", "Win32 GDI Video Driver", &_win32_video_driver),
M("sdl", "SDL Video Driver", &_sdl_video_driver),
M("null", "Null Video Driver", &_null_video_driver),
#ifdef ENABLE_NETWORK
M("dedicated", "Dedicated Video Driver", &_dedicated_video_driver),
#undef M
#define M(x, y, z) { x, y, (const HalCommonDriver**)z }
static const DriverClass _driver_classes[] = {
M(_video_driver_descs, "video", &_video_driver),
M(_sound_driver_descs, "sound", &_sound_driver),
M(_music_driver_descs, "music", &_music_driver)
static const DriverDesc* GetDriverByName(const DriverDesc* dd, const char* name)
{
Status change: