0
|
1 |
# This Makefile is partially based on "a completely generic Makefile",
|
|
2 |
# originally created by Justin Husted <husted@cs>
|
|
3 |
#
|
|
4 |
# Rewrite and sane dependencies support by Petr Baudis <pasky@ucw.cz>
|
|
5 |
# Cygwin support and configuration by Jaen Saul <slowbyte@hot.ee>
|
|
6 |
# A lot of modifications by Bjarni Corfitzen <bjarni@openttd.com>
|
|
7 |
#
|
|
8 |
# Last modified by: $Author: strigeus $
|
|
9 |
# On: $Date: 2004/03/11 19:15:06 $
|
|
10 |
|
|
11 |
|
|
12 |
##############################################################################
|
|
13 |
#
|
|
14 |
# Usage
|
|
15 |
#
|
|
16 |
|
|
17 |
# Synopsis:
|
|
18 |
#
|
|
19 |
# make WITH_ZLIB=1 UNIX=1 MANUAL_CONFIG=1
|
|
20 |
#
|
|
21 |
# (See below for the list of possible options.)
|
|
22 |
#
|
|
23 |
# Alternately, you can run make without the MANUAL_CONFIG part. It then
|
|
24 |
# generates Makefile.config, where you can customize all the options.
|
|
25 |
# However beware that for all subsequent calls the option values from
|
|
26 |
# Makefile.config take precedence to the commandline options.
|
|
27 |
#
|
|
28 |
# (That means that you probably want to either specify the options on command
|
|
29 |
# line together with MANUAL_CONFIG=1 or you want to specify no commandline
|
|
30 |
# options at all.)
|
|
31 |
|
|
32 |
# Targets:
|
|
33 |
#
|
|
34 |
# Defaults to building binary
|
|
35 |
# clean: remove intermediate build files
|
|
36 |
# mrproper: remove intermediate files and makefile configuration
|
|
37 |
# upgradeconf: add new options to old Makefile.config
|
|
38 |
# osx: OS X application
|
|
39 |
|
|
40 |
# Options:
|
|
41 |
#
|
|
42 |
# Summary of OS choice defines
|
|
43 |
# WIN32: building on Windows
|
|
44 |
# UNIX: building on *nix derivate (Linux, FreeBSD)
|
|
45 |
# OSX: building on Mac OS X
|
|
46 |
# MORPHOS: building on MorphOS
|
|
47 |
#
|
|
48 |
# Summary of library choice defines
|
|
49 |
# WITH_ZLIB: savegames using zlib
|
|
50 |
# WITH_PNG: screenshots using PNG
|
|
51 |
# WITH_SDL: SDL video driver support
|
|
52 |
#
|
|
53 |
# Summary of other defines:
|
|
54 |
# MANUAL_CONFIG: do not use Makefile.config, config options set manually
|
|
55 |
# DEBUG: build in debug mode
|
|
56 |
# PROFILE: build in profile mode, disables -s and -fomit-frame-pointer
|
|
57 |
# DISPLAY_WARNINGS: when off, some errors are not displayed while compiling
|
|
58 |
# TRANSLATOR: build in translator mode (untranslated strings are prepended by
|
|
59 |
# a <TODO> mark)
|
|
60 |
# RELEASE: this will be the released version number. It replaces all places
|
|
61 |
# where it normally would print the revision number
|
|
62 |
# MIDI: if set, it will use it as custom path to midi player.
|
|
63 |
# If unset, it will use the hardcoded path in the c code
|
|
64 |
#
|
|
65 |
# DATA_DIR_PREFIX: This sets the dir OpenTTD looks for the needed files.
|
|
66 |
# MUST END WITH / if defined
|
|
67 |
#
|
|
68 |
# STATIC: link statically
|
|
69 |
# CYGWIN: build in Cygwin environment
|
|
70 |
# MINGW: build with MingW compiler, link with MingW libraries
|
|
71 |
#
|
|
72 |
# Experimental (does not work properly):
|
|
73 |
# WITH_NETWORK: enable networking
|
|
74 |
# WITH_DIRECTMUSIC: enable DirectMusic MIDI support
|
|
75 |
|
|
76 |
|
|
77 |
##############################################################################
|
|
78 |
#
|
|
79 |
# Configuration
|
|
80 |
#
|
|
81 |
|
|
82 |
# CONFIG_WRITER have to be found even for manual configuration
|
|
83 |
CONFIG_WRITER=makefiledir/Makefile.config_writer
|
|
84 |
|
|
85 |
ifndef MANUAL_CONFIG
|
|
86 |
# Automatic configuration
|
|
87 |
MAKE_CONFIG:=Makefile.config
|
|
88 |
MAKEFILE:=Makefile
|
|
89 |
LIB_DETECTION=makefiledir/Makefile.libdetection
|
|
90 |
CONFIG_WRITER=makefiledir/Makefile.config_writer
|
|
91 |
|
|
92 |
# Apply automatic configuration
|
|
93 |
# See target section for how this is built, suppress errors
|
|
94 |
# since first time it isn't found but make reads this twice
|
|
95 |
-include $(MAKE_CONFIG)
|
|
96 |
else
|
|
97 |
CONFIG_INCLUDED:=1
|
|
98 |
endif
|
|
99 |
|
|
100 |
# tests if makefile.config contains the new needed SDL-CONFIG
|
|
101 |
# it updates makefile.config if needed. Flags like ENABLE_NETWORK are remembered
|
|
102 |
ifndef SDL-CONFIG
|
|
103 |
ifdef WITH_SDL
|
|
104 |
ifndef MANUAL_CONFIG
|
|
105 |
#network is enabled by default
|
|
106 |
ENABLE_NETWORK:=1
|
|
107 |
UPDATECONFIG:=upgradeconf
|
|
108 |
CONFIG_INCLUDED:=
|
|
109 |
else
|
|
110 |
# this should define SDL-CONFIG for manual configuration
|
|
111 |
ifeq ($(shell uname),FreeBSD)
|
|
112 |
SDL-CONFIG:=sdl11-config
|
|
113 |
else
|
|
114 |
SDL-CONFIG:=sdl-config
|
|
115 |
endif
|
|
116 |
endif
|
|
117 |
endif
|
|
118 |
endif
|
|
119 |
|
|
120 |
ifndef CONFIG_INCLUDED
|
|
121 |
-include $(LIB_DETECTION)
|
|
122 |
endif
|
|
123 |
|
|
124 |
ifdef DISPLAY_WARNINGS
|
|
125 |
WARNING_DISPLAY:=-fstrict-aliasing
|
|
126 |
else
|
|
127 |
WARNING_DISPLAY:=-fno-strict-aliasing
|
|
128 |
endif
|
|
129 |
|
|
130 |
ifdef STATIC
|
|
131 |
ifndef WIN32
|
|
132 |
ifndef OSX
|
|
133 |
ifndef MORPHOS
|
|
134 |
ifndef SKIP_STATIC_CHECK
|
|
135 |
$(error Static is only known to work on MorphOS and MacOSX!!! --- Check makefile.config for more info and howto bypass this check)
|
|
136 |
endif
|
|
137 |
endif
|
|
138 |
endif
|
|
139 |
endif
|
|
140 |
endif
|
|
141 |
|
|
142 |
|
|
143 |
# Force SDL on UNIX platforms
|
|
144 |
ifndef WITH_SDL
|
|
145 |
ifdef UNIX
|
|
146 |
$(error You need to have SDL installed in order to run OpenTTD on UNIX.)
|
|
147 |
endif
|
|
148 |
endif
|
|
149 |
|
|
150 |
|
|
151 |
|
|
152 |
##############################################################################
|
|
153 |
#
|
|
154 |
# Compiler configuration
|
|
155 |
#
|
|
156 |
|
|
157 |
CC=gcc
|
|
158 |
CXX=g++
|
|
159 |
|
|
160 |
ifdef MORPHOS
|
|
161 |
CC += -noixemul -pipe
|
|
162 |
CXX += -noixemul -pipe
|
|
163 |
endif
|
|
164 |
|
|
165 |
# Executable file extension
|
|
166 |
ifdef WIN32
|
|
167 |
EXE=.exe
|
|
168 |
else
|
|
169 |
EXE=
|
|
170 |
endif
|
|
171 |
|
|
172 |
# Set output executable names
|
|
173 |
TTD=ttd$(EXE)
|
|
174 |
STRGEN=strgen/strgen$(EXE)
|
|
175 |
OSXAPP="OpenTTD.app"
|
|
176 |
|
|
177 |
# What revision are we compiling, if we have an idea?
|
|
178 |
REV_NUMBER := $(shell if test -d .svn; then svnversion . | tr -dc 0-9; fi)
|
|
179 |
|
|
180 |
ifdef RELEASE
|
|
181 |
REV:=$(RELEASE)
|
|
182 |
else
|
|
183 |
REV := $(shell if test -d .svn; then echo -n r; svnversion .; fi)
|
|
184 |
tmp_test:=$(shell echo "$(REV)" | grep "M" )
|
|
185 |
ifdef tmp_test
|
|
186 |
REV_NUMBER:=1
|
|
187 |
endif
|
|
188 |
endif
|
|
189 |
|
|
190 |
ifndef REV_NUMBER
|
|
191 |
REV_NUMBER:=0
|
|
192 |
endif
|
|
193 |
|
|
194 |
# MorphOS needs builddate
|
|
195 |
BUILDDATE=`date +%d.%m.%y`
|
|
196 |
|
|
197 |
# AMD64 needs a little more settings to work
|
|
198 |
ifeq ($(shell uname -m), x86_64)
|
|
199 |
endwarnings:=endwarnings
|
|
200 |
64_bit_warnings:=64_bit_warnings
|
|
201 |
BASECFLAGS += -m64 -D_LITTLE_ENDIAN
|
|
202 |
endif
|
|
203 |
|
|
204 |
|
|
205 |
# When calling the compiler, use these flags
|
|
206 |
# -g debugging symbols
|
|
207 |
# -Wall all warnings
|
|
208 |
# -s automatic strip
|
|
209 |
#
|
|
210 |
# You may also want:
|
|
211 |
# -O optimize or -O2 fully optimize (O's above 2 are not recommended)
|
|
212 |
# -pg profile - generate profiling data. See "man gprof" to use this.
|
|
213 |
|
|
214 |
CFLAGS=-Wall -Wno-multichar
|
|
215 |
CDEFS=-DWITH_REV
|
|
216 |
LDFLAGS=
|
|
217 |
LIBS=
|
|
218 |
|
|
219 |
ifdef DEBUG
|
|
220 |
# Debug mode
|
|
221 |
CDEFS += -D_DEBUG
|
|
222 |
BASECFLAGS += -g
|
|
223 |
else
|
|
224 |
ifdef PROFILE
|
|
225 |
BASECFLAGS += -pg
|
|
226 |
else
|
|
227 |
# Release mode
|
|
228 |
ifndef MORPHOS
|
|
229 |
# automatical strip breaks under morphos
|
|
230 |
BASECFLAGS += -s
|
|
231 |
LDFLAGS += -s
|
|
232 |
endif
|
|
233 |
endif
|
|
234 |
|
|
235 |
ifdef OSX
|
|
236 |
# these compilerflags makes the app run as fast as possible without making the app unstable. It works on G3 or newer
|
|
237 |
BASECFLAGS += -O3 -funroll-loops -fsched-interblock -falign-loops=16 -falign-jumps=16 -falign-functions=16 -falign-jumps-max-skip=15 -falign-loops-max-skip=15 -mdynamic-no-pic -mpowerpc-gpopt -force_cpusubtype_ALL $(WARNING_DISPLAY)
|
|
238 |
else
|
|
239 |
ifdef MORPHOS
|
|
240 |
BASECFLAGS += -O2 -funroll-loops -fexpensive-optimizations -mstring -mmultiple $(WARNING_DISPLAY)
|
|
241 |
else
|
|
242 |
BASECFLAGS += -O2 $(WARNING_DISPLAY)
|
|
243 |
endif
|
|
244 |
ifndef PROFILE
|
|
245 |
BASECFLAGS += -fomit-frame-pointer
|
|
246 |
endif
|
|
247 |
endif
|
|
248 |
endif
|
|
249 |
|
|
250 |
ifdef STATIC
|
|
251 |
ifndef OSX # OSX can't build static if -static flag is used
|
|
252 |
LDFLAGS += -static
|
|
253 |
endif
|
|
254 |
endif
|
|
255 |
|
|
256 |
# If building on Cygwin/MingW don't link with Cygwin libs
|
|
257 |
ifdef WIN32
|
|
258 |
ifdef MINGW
|
|
259 |
ifdef CYGWIN
|
|
260 |
BASECFLAGS += -mno-cygwin
|
|
261 |
LDFLAGS += -mno-cygwin
|
|
262 |
endif
|
|
263 |
endif
|
|
264 |
endif
|
|
265 |
|
|
266 |
CFLAGS += $(BASECFLAGS)
|
|
267 |
|
|
268 |
ifdef UNIX
|
|
269 |
CDEFS += -DUNIX
|
|
270 |
endif
|
|
271 |
|
|
272 |
# SDL config
|
|
273 |
ifdef WITH_SDL
|
|
274 |
CDEFS += -DWITH_SDL
|
|
275 |
CFLAGS += `$(SDL-CONFIG) --cflags`
|
|
276 |
ifdef STATIC
|
|
277 |
LIBS += `$(SDL-CONFIG) --static-libs`
|
|
278 |
else
|
|
279 |
LIBS += `$(SDL-CONFIG) --libs`
|
|
280 |
endif
|
|
281 |
endif
|
|
282 |
|
|
283 |
|
|
284 |
# zlib config
|
|
285 |
ifdef WITH_ZLIB
|
|
286 |
CDEFS += -DWITH_ZLIB
|
|
287 |
ifdef STATIC
|
|
288 |
ifdef OSX
|
|
289 |
# zlib is default on OSX, so everybody have it. No need for static linking
|
|
290 |
LIBS += -lz
|
|
291 |
else
|
|
292 |
ifndef STATIC_ZLIB_PATH
|
|
293 |
ifndef MANUAL_CONFIG
|
|
294 |
# updates makefile.config with the zlib path
|
|
295 |
UPDATECONFIG:=upgradeconf
|
|
296 |
endif
|
|
297 |
TEMP:=$(shell ls /lib 2>/dev/null | grep "zlib.a")$(shell ls /lib 2>/dev/null | grep "libz.a")
|
|
298 |
ifdef TEMP
|
|
299 |
STATIC_ZLIB_PATH:=/lib/$(TEMP)
|
|
300 |
else
|
|
301 |
TEMP:=$(shell ls /usr/lib 2>/dev/null | grep "zlib.a")$(shell ls /usr/lib 2>/dev/null | grep "libz.a")
|
|
302 |
ifdef TEMP
|
|
303 |
STATIC_ZLIB_PATH:=/usr/lib/$(TEMP)
|
|
304 |
else
|
|
305 |
TEMP:=$(shell ls /usr/local/lib 2>/dev/null | grep "zlib.a")$(shell ls /usr/local/lib 2>/dev/null | grep "libz.a")
|
|
306 |
ifdef TEMP
|
|
307 |
STATIC_ZLIB_PATH:=/usr/local/lib/$(TEMP)
|
|
308 |
endif
|
|
309 |
endif
|
|
310 |
endif
|
|
311 |
endif
|
|
312 |
LIBS += $(STATIC_ZLIB_PATH)
|
|
313 |
endif
|
|
314 |
else
|
|
315 |
LIBS += -lz
|
|
316 |
endif
|
|
317 |
endif
|
|
318 |
|
|
319 |
# libpng config
|
|
320 |
ifdef WITH_PNG
|
|
321 |
CDEFS += -DWITH_PNG
|
|
322 |
# FreeBSD doesn't use libpng-config
|
|
323 |
ifdef FREEBSD
|
|
324 |
LIBS += -lpng
|
|
325 |
else
|
|
326 |
CFLAGS += `libpng-config --cflags`
|
|
327 |
ifdef OSX
|
|
328 |
ifdef STATIC
|
|
329 |
# Seems like we need a tiny hack for OSX static to work
|
|
330 |
LIBS += `libpng-config --prefix`/lib/libpng.a
|
|
331 |
else
|
|
332 |
LIBS += `libpng-config --libs`
|
|
333 |
endif
|
|
334 |
else
|
|
335 |
# seems like older libpng versions are broken and need this
|
|
336 |
PNGCONFIG_FLAGS = --ldflags --libs
|
|
337 |
ifdef STATIC
|
|
338 |
LIBS += `libpng-config --static $(PNGCONFIG_FLAGS)`
|
|
339 |
else
|
|
340 |
LIBS += `libpng-config $(PNGCONFIG_FLAGS)`
|
|
341 |
endif
|
|
342 |
endif
|
|
343 |
endif
|
|
344 |
endif
|
|
345 |
|
|
346 |
|
|
347 |
ifdef TRANSLATOR
|
|
348 |
STRGEN_FLAGS=-t
|
|
349 |
else
|
|
350 |
STRGEN_FLAGS=
|
|
351 |
endif
|
|
352 |
|
|
353 |
# file paths setup
|
|
354 |
ifdef GAME_DATA_DIR
|
|
355 |
CDEFS += -DGAME_DATA_DIR=\"$(GAME_DATA_DIR)\"
|
|
356 |
endif
|
|
357 |
|
|
358 |
ifdef PERSONAL_DIR
|
|
359 |
CDEFS += -DPERSONAL_DIR=\"$(PERSONAL_DIR)\"
|
|
360 |
endif
|
|
361 |
|
|
362 |
ifdef USE_HOMEDIR
|
|
363 |
CDEFS += -DUSE_HOMEDIR
|
|
364 |
endif
|
|
365 |
|
|
366 |
# MIDI setup
|
|
367 |
ifdef OSX
|
|
368 |
ifndef MIDI
|
|
369 |
MIDI:=$(OSXAPP)/contents/macos/track_starter
|
|
370 |
endif
|
|
371 |
endif
|
|
372 |
|
|
373 |
ifdef MIDI
|
|
374 |
CDEFS += -DEXTERNAL_PLAYER=\"$(MIDI)\"
|
|
375 |
ifdef MIDI_ARG
|
|
376 |
CDEFS += -DMIDI_ARG=\"$(MIDI_ARG)\"
|
|
377 |
endif
|
|
378 |
endif
|
|
379 |
|
|
380 |
# Experimental
|
|
381 |
ifdef WITH_NETWORK
|
|
382 |
CDEFS += -DENABLE_NETWORK
|
|
383 |
ifdef UNIX
|
|
384 |
ifndef OSX
|
|
385 |
ifndef MORPHOS
|
|
386 |
# this have caused problems on many platforms and disabling it didn't break anything
|
|
387 |
# now we test if disabling it as a general breaks it for anybody
|
|
388 |
#LIBS += -lresolv
|
|
389 |
endif
|
|
390 |
endif
|
|
391 |
endif
|
|
392 |
endif
|
|
393 |
|
|
394 |
ifdef WITH_DIRECTMUSIC
|
|
395 |
CDEFS += -DWIN32_ENABLE_DIRECTMUSIC_SUPPORT
|
|
396 |
endif
|
|
397 |
|
|
398 |
ifdef WIN32
|
|
399 |
LIBS += -lws2_32 -lwinmm -lgdi32 -ldxguid -lole32 -lstdc++
|
|
400 |
TTDLDFLAGS += -Wl,--subsystem,windows
|
|
401 |
endif
|
|
402 |
|
|
403 |
# sets up the paths for use for make install
|
|
404 |
ifdef BINARY_DIR
|
|
405 |
BINARY_INSTALL:=$(BINARY_DIR)$(TTD)
|
|
406 |
else
|
|
407 |
BINARY_INSTALL:=$(INSTALL_DIR)$(TTD)
|
|
408 |
endif
|
|
409 |
ifdef DATA_DIR_PREFIX
|
|
410 |
DATA_DIR:=$(DATA_DIR_PREFIX)
|
|
411 |
else
|
|
412 |
DATA_DIR:=$(INSTALL_DIR)
|
|
413 |
endif
|
|
414 |
|
|
415 |
##############################################################################
|
|
416 |
#
|
|
417 |
# What to compile
|
|
418 |
# (users do not want to modify anything below)
|
|
419 |
#
|
|
420 |
|
|
421 |
|
|
422 |
### Sources
|
|
423 |
|
|
424 |
ttd_SOURCES = \
|
|
425 |
ai.c aircraft_cmd.c aircraft_gui.c airport.c airport_gui.c bridge_gui.c \
|
|
426 |
clear_cmd.c command.c disaster_cmd.c dock_gui.c dummy_land.c economy.c \
|
|
427 |
engine.c engine_gui.c fileio.c gfx.c graph_gui.c industry_cmd.c \
|
|
428 |
industry_gui.c intro_gui.c landscape.c main_gui.c misc.c misc_cmd.c \
|
|
429 |
misc_gui.c music_gui.c namegen.c network.c news_gui.c oldloader.c \
|
|
430 |
order_cmd.c order_gui.c pathfind.c player_gui.c players.c rail_cmd.c \
|
|
431 |
rail_gui.c road_cmd.c road_gui.c roadveh_cmd.c roadveh_gui.c saveload.c \
|
|
432 |
settings_gui.c ship_cmd.c ship_gui.c smallmap_gui.c sound.c \
|
|
433 |
spritecache.c station_cmd.c station_gui.c strings.c subsidy_gui.c \
|
|
434 |
texteff.c town_cmd.c town_gui.c train_cmd.c train_gui.c tree_cmd.c \
|
|
435 |
ttd.c tunnelbridge_cmd.c unmovable_cmd.c vehicle.c viewport.c \
|
|
436 |
water_cmd.c widget.c window.c minilzo.c screenshot.c settings.c rev.c \
|
|
437 |
grfspecial.c terraform_gui.c network_gui.c
|
|
438 |
|
|
439 |
ifdef WITH_SDL
|
|
440 |
ttd_SOURCES += sdl.c
|
|
441 |
endif
|
|
442 |
|
|
443 |
ifdef WIN32
|
|
444 |
ttd_SOURCES += win32.c w32dm.c
|
|
445 |
else
|
|
446 |
ttd_SOURCES += extmidi.c unix.c
|
|
447 |
endif
|
|
448 |
|
|
449 |
ttd_OBJS = $(ttd_SOURCES:%.c=%.o)
|
|
450 |
|
|
451 |
ifdef WIN32
|
|
452 |
# Resource file
|
|
453 |
ttd_OBJS += winres.o
|
|
454 |
endif
|
|
455 |
|
|
456 |
ifdef WITH_DIRECTMUSIC
|
|
457 |
ttd_SOURCES += w32dm2.cpp
|
|
458 |
ttd_OBJS += w32dm2.o
|
|
459 |
endif
|
|
460 |
|
|
461 |
ttd_DEPS1 = $(foreach obj,$(ttd_OBJS),.deps/$(obj))
|
|
462 |
ttd_DEPS = $(ttd_DEPS1:%.o=%.P)
|
|
463 |
|
|
464 |
LANG_TXT = $(filter-out %.unfinished.txt,$(wildcard lang/*.txt))
|
|
465 |
LANGS = $(LANG_TXT:%.txt=%.lng)
|
|
466 |
|
|
467 |
C_COMPILE = $(CC) $(CFLAGS) $(CDEFS)
|
|
468 |
CXX_COMPILE = $(CXX) $(CFLAGS) $(CDEFS)
|
|
469 |
|
|
470 |
C_BUILD = $(C_COMPILE) -c
|
|
471 |
CXX_BUILD = $(CXX_COMPILE) -c
|
|
472 |
|
|
473 |
C_LINK = $(CC) $(LDFLAGS) -o
|
|
474 |
|
|
475 |
|
|
476 |
##############################################################################
|
|
477 |
#
|
|
478 |
# Targets
|
|
479 |
#
|
|
480 |
|
|
481 |
|
|
482 |
### Normal build rules
|
|
483 |
|
|
484 |
|
|
485 |
ifdef OSX
|
|
486 |
OSX:=OSX
|
|
487 |
endif
|
|
488 |
|
|
489 |
|
|
490 |
all: $(UPDATECONFIG) $(TTD) $(OSX) $(endwarnings)
|
|
491 |
|
|
492 |
|
|
493 |
$(TTD): table/strings.h $(ttd_OBJS) $(LANGS) $(MAKE_CONFIG)
|
|
494 |
$(C_LINK) $@ $(TTDLDFLAGS) $(ttd_OBJS) $(LIBS)
|
|
495 |
|
|
496 |
$(OSX):
|
|
497 |
@mkdir -p $(OSXAPP)/Contents/MacOS
|
|
498 |
@mkdir -p $(OSXAPP)/Contents/Resources
|
|
499 |
@echo "APPL????" > $(OSXAPP)/Contents/PkgInfo
|
|
500 |
@cp os/macos/ttd.icns $(OSXAPP)/Contents/Resources/
|
|
501 |
@os/macos/plistgen.sh $(OSXAPP) $(REV)
|
|
502 |
@cp os/macos/track_starter $(OSXAPP)/contents/macos
|
|
503 |
@ls os/macos | grep -q "\.class" || \
|
|
504 |
javac os/macos/OpenTTDMidi.java
|
|
505 |
@cp os/macos/OpenTTDMidi.class $(OSXAPP)/contents/macos
|
|
506 |
@cp $(TTD) $(OSXAPP)/Contents/MacOS/ttd
|
|
507 |
|
|
508 |
$(endwarnings): $(64_bit_warnings)
|
|
509 |
|
|
510 |
$(64_bit_warnings):
|
|
511 |
$(warning 64 bit CPUs will get some 64 bit specific bugs!)
|
|
512 |
$(warning If you see any bugs, include in your bug report that you use a 64 bit CPU)
|
|
513 |
|
|
514 |
$(STRGEN): strgen/strgen.c rev.o
|
|
515 |
$(CC) $(BASECFLAGS) $(CDEFS) -o $@ $^
|
|
516 |
|
|
517 |
lang/english.lng: lang/english.txt $(STRGEN)
|
|
518 |
$(STRGEN)
|
|
519 |
|
|
520 |
table/strings.h: lang/english.lng
|
|
521 |
|
|
522 |
lang/%.lng: lang/%.txt $(STRGEN)
|
|
523 |
$(STRGEN) $(STRGEN_FLAGS) $<
|
|
524 |
|
|
525 |
winres.o: ttd.rc
|
|
526 |
windres -o $@ $<
|
|
527 |
|
|
528 |
|
|
529 |
rev.c: FORCE
|
|
530 |
@# setting the revision number in a place, there the binary can read it
|
|
531 |
@echo 'const char _openttd_revision[] = "'$(REV)'";' >>rev.c.new
|
|
532 |
@echo 'const int _revision_number = $(REV_NUMBER);' >>rev.c.new
|
|
533 |
@# some additions for MorphOS versions tag
|
|
534 |
@echo '#ifdef __MORPHOS__' >>rev.c.new
|
|
535 |
@echo 'const char morphos_versions_tag[] = "\\0$$VER: OpenTTD '$(REV)' ('${BUILDDATE}') © OpenTTD Team [MorphOS, PowerPC]";' >>rev.c.new
|
|
536 |
@echo '#endif' >>rev.c.new
|
|
537 |
@# Only update the real rev.c if it actually changed, to prevent
|
|
538 |
@# useless rebuilds.
|
|
539 |
@cmp -s rev.c rev.c.new 2>/dev/null || mv rev.c.new rev.c
|
|
540 |
@rm -f rev.c.new
|
|
541 |
|
|
542 |
FORCE:
|
|
543 |
|
|
544 |
|
|
545 |
clean:
|
|
546 |
rm -rf .deps *~ $(TTD) $(STRGEN) core table/strings.h $(LANGS) $(ttd_OBJS)
|
|
547 |
|
|
548 |
mrproper: clean
|
|
549 |
rm -rf $(MAKE_CONFIG)
|
|
550 |
|
|
551 |
ifndef OSX
|
|
552 |
ifndef MORPHOS
|
|
553 |
install:
|
|
554 |
@if [ "$(INSTALL)" == "" ]; then $(error make install is highly experimental at his state and not\
|
|
555 |
tested very much - use at your own risk - to use run \"make install INSTALL:=1\" - make sure makefile.config\
|
|
556 |
is set correctly up - run \"make upgradeconf\")
|
|
557 |
@if [ "$(DATA_DIR)" == "" ]; then $(error no install path set - check makefile.config)
|
|
558 |
mkdir -p $(DATA_DIR)/lang
|
|
559 |
mkdir -p $(DATA_DIR)/data
|
|
560 |
cp $(TTD) $(BINARY_INSTALL)
|
|
561 |
cp lang/*.lng $(DATA_DIR)/lang
|
|
562 |
cp data/*.grf $(DATA_DIR)/data
|
|
563 |
else #MorphOS
|
|
564 |
install:
|
|
565 |
$(error make install is not supported on MorphOS)
|
|
566 |
endif
|
|
567 |
else # OSX
|
|
568 |
install:
|
|
569 |
$(error make install is not supported on MacOSX)
|
|
570 |
endif
|
|
571 |
|
|
572 |
|
|
573 |
love:
|
|
574 |
@echo "YES! I thought you would never ask. We will have a great time. You can keep me turned on all night"
|
|
575 |
|
|
576 |
.PHONY: clean all $(OSX) install $(64_bit_warnings) $(endwarnings) love
|
|
577 |
|
|
578 |
|
|
579 |
### Automatic configuration
|
|
580 |
-include $(CONFIG_WRITER)
|
|
581 |
|
|
582 |
|
|
583 |
# Export all variables set to subprocesses (a bit dirty)
|
|
584 |
.EXPORT_ALL_VARIABLES:
|
|
585 |
upgradeconf: $(MAKE_CONFIG)
|
|
586 |
rm $(MAKE_CONFIG)
|
|
587 |
$(MAKE) $(MAKE_CONFIG)
|
|
588 |
|
|
589 |
.PHONY: upgradeconf
|
|
590 |
|
|
591 |
|
|
592 |
### Internal build rules
|
|
593 |
|
|
594 |
# This makes sure the .deps dir is always around.
|
|
595 |
DEPS_MAGIC := $(shell mkdir .deps > /dev/null 2>&1 || :)
|
|
596 |
|
|
597 |
# Introduce the dependencies
|
|
598 |
-include $(ttd_DEPS)
|
|
599 |
|
|
600 |
# This compiles the object file as well as silently updating its dependencies
|
|
601 |
# list at the same time. It is not an issue that they aren't around during the
|
|
602 |
# first compilation round as we just build everything at that time anyway,
|
|
603 |
# therefore we do not need to watch deps.
|
|
604 |
%.o: %.c $(MAKE_CONFIG)
|
|
605 |
@echo '$(C_BUILD) $<'; \
|
|
606 |
$(C_BUILD) $< -Wp,-MD,.deps/$(*F).pp
|
|
607 |
@-cp .deps/$(*F).pp .deps/$(*F).P; \
|
|
608 |
tr ' ' '\012' < .deps/$(*F).pp \
|
|
609 |
| sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
|
|
610 |
>> .deps/$(*F).P; \
|
|
611 |
rm .deps/$(*F).pp
|
|
612 |
|
|
613 |
# For DirectMusic build
|
|
614 |
%.o: %.cpp $(MAKE_CONFIG)
|
|
615 |
$(CXX_BUILD) $<
|