author | bjarni |
Wed, 01 Dec 2004 19:44:39 +0000 | |
changeset 532 | 84e504f4f6d1 |
parent 531 | d5412b554030 |
child 543 | e3b43338096b |
permissions | -rw-r--r-- |
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 |
|
421
0b9bdcdfe0c5
(svn r619) Add the necessary bits to make building under BeOS using GNU Make work
tron
parents:
413
diff
changeset
|
47 |
# BEOS: building on BeOS |
446
20304ea8e94e
(svn r655) Add the necessary bits to make building on SunOS/Solaris work
tron
parents:
421
diff
changeset
|
48 |
# SUNOS: building on SunOS (Solaris) |
0 | 49 |
# |
50 |
# Summary of library choice defines |
|
51 |
# WITH_ZLIB: savegames using zlib |
|
52 |
# WITH_PNG: screenshots using PNG |
|
53 |
# WITH_SDL: SDL video driver support |
|
54 |
# |
|
55 |
# Summary of other defines: |
|
56 |
# MANUAL_CONFIG: do not use Makefile.config, config options set manually |
|
57 |
# DEBUG: build in debug mode |
|
58 |
# PROFILE: build in profile mode, disables -s and -fomit-frame-pointer |
|
59 |
# DISPLAY_WARNINGS: when off, some errors are not displayed while compiling |
|
60 |
# TRANSLATOR: build in translator mode (untranslated strings are prepended by |
|
61 |
# a <TODO> mark) |
|
62 |
# RELEASE: this will be the released version number. It replaces all places |
|
63 |
# where it normally would print the revision number |
|
222
b88456001397
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents:
221
diff
changeset
|
64 |
# MIDI: if set, it will use it as custom path to midi player. |
0 | 65 |
# If unset, it will use the hardcoded path in the c code |
222
b88456001397
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents:
221
diff
changeset
|
66 |
# NOVERBOSE: supress all warnings and errors during compilation. |
162
565551f829e9
(svn r163) Makefile: made compileroutput nicer and added NOVERBOSE to supress all warnings/errors if wanted(default off) (sign_de)
bjarni
parents:
157
diff
changeset
|
67 |
# It looks nicer, but you will not know what went wrong. Use it on released (stable) sources only |
462
b995527cb51c
(svn r681) Support for VERBOSE configuration variable which shows the commands actually used for compilation.
pasky
parents:
452
diff
changeset
|
68 |
# VERBOSE: actually show the commands used for compilation. |
0 | 69 |
# |
285 | 70 |
# Paths: |
71 |
# INSTALL: If not set, the game uses the directory of the binary to |
|
72 |
# store everything (lang, data, gm, save and openttd.cfg), this is the `old' behaviour. |
|
73 |
# In this case, none of the following paths are used, you also should _not_ |
|
74 |
# use `make install', but copy the required stuff yourself (or just play out |
|
75 |
# of you source directory, which should work fine). |
|
76 |
# If you want to use `make install' to install the game globally, you should |
|
77 |
# define it _before_ you build the game. If you only define INSTALL when you |
|
78 |
# do `make install', the game won't be able to find it's files (so you should |
|
79 |
# also define all the following paths before building). |
|
80 |
# |
|
81 |
# So, the following paths should be defined if INSTALL is defined. |
|
82 |
# None of these paths have to end with / |
|
83 |
# PREFIX: Normally /usr/local |
|
84 |
# BINARY_DIR: The location of the binary, normally games. (Will be prefixed |
|
85 |
# with $PREFIX) |
|
86 |
# DATA_DIR: The location of the data (lang, data and gm), normally |
|
87 |
# share/games/openttd. (Will be prefixed with $PREFIX) |
|
88 |
# PERSONAL_DIR: The directory where openttd.cfg and the save folder will be |
|
89 |
# stored. You cannot use ~ here, define USE_HOMEDIR for that. |
|
90 |
# USE_HOMEDIR: If this variable is set, PERSONAL_DIR will be prefixed with |
|
91 |
# ~/ at runtime (the user's homedir) |
|
92 |
# |
|
93 |
# DEST_DIR: make install will use this directory instead of the filesystem |
|
94 |
# root to install its files. This should normally not be used by |
|
95 |
# ordinary users, currently it is only used for the debian |
|
96 |
# packaging. This value should only be set when calling `make |
|
97 |
# install' and is not saved in Makefile.config |
|
0 | 98 |
# |
99 |
# STATIC: link statically |
|
100 |
# CYGWIN: build in Cygwin environment |
|
101 |
# MINGW: build with MingW compiler, link with MingW libraries |
|
102 |
# |
|
103 |
# Experimental (does not work properly): |
|
104 |
# WITH_NETWORK: enable networking |
|
105 |
# WITH_DIRECTMUSIC: enable DirectMusic MIDI support |
|
106 |
||
107 |
||
108 |
############################################################################## |
|
109 |
# |
|
110 |
# Configuration |
|
111 |
# |
|
112 |
||
180
47ee14fe2b35
(svn r181) Makefile: enabled ability to supress output of missing strings in lng files
bjarni
parents:
164
diff
changeset
|
113 |
# Makefile version tag |
47ee14fe2b35
(svn r181) Makefile: enabled ability to supress output of missing strings in lng files
bjarni
parents:
164
diff
changeset
|
114 |
# it checks if the version tag in makefile.config is the same and force update outdated config files |
348
959f425dc282
(svn r531) Makefile: made asserts enabled by default
bjarni
parents:
347
diff
changeset
|
115 |
MAKEFILE_VERSION:=3 |
180
47ee14fe2b35
(svn r181) Makefile: enabled ability to supress output of missing strings in lng files
bjarni
parents:
164
diff
changeset
|
116 |
|
0 | 117 |
# CONFIG_WRITER have to be found even for manual configuration |
118 |
CONFIG_WRITER=makefiledir/Makefile.config_writer |
|
119 |
||
120 |
ifndef MANUAL_CONFIG |
|
121 |
# Automatic configuration |
|
122 |
MAKE_CONFIG:=Makefile.config |
|
123 |
MAKEFILE:=Makefile |
|
124 |
LIB_DETECTION=makefiledir/Makefile.libdetection |
|
125 |
CONFIG_WRITER=makefiledir/Makefile.config_writer |
|
126 |
||
127 |
# Apply automatic configuration |
|
128 |
# See target section for how this is built, suppress errors |
|
129 |
# since first time it isn't found but make reads this twice |
|
130 |
-include $(MAKE_CONFIG) |
|
131 |
else |
|
132 |
CONFIG_INCLUDED:=1 |
|
133 |
endif |
|
134 |
||
180
47ee14fe2b35
(svn r181) Makefile: enabled ability to supress output of missing strings in lng files
bjarni
parents:
164
diff
changeset
|
135 |
# updates makefile.config if it's outdated |
47ee14fe2b35
(svn r181) Makefile: enabled ability to supress output of missing strings in lng files
bjarni
parents:
164
diff
changeset
|
136 |
ifneq ($(MAKEFILE_VERSION),$(CONFIG_VERSION)) |
189
4d133909845a
(svn r190) Makefile: fixed bug, that prevented compilation with MANUAL_CONFIG enabled
bjarni
parents:
180
diff
changeset
|
137 |
ifndef MANUAL_CONFIG # manual config should not check this |
4d133909845a
(svn r190) Makefile: fixed bug, that prevented compilation with MANUAL_CONFIG enabled
bjarni
parents:
180
diff
changeset
|
138 |
UPDATECONFIG:=upgradeconf |
4d133909845a
(svn r190) Makefile: fixed bug, that prevented compilation with MANUAL_CONFIG enabled
bjarni
parents:
180
diff
changeset
|
139 |
CONFIG_INCLUDED:= |
4d133909845a
(svn r190) Makefile: fixed bug, that prevented compilation with MANUAL_CONFIG enabled
bjarni
parents:
180
diff
changeset
|
140 |
else |
4d133909845a
(svn r190) Makefile: fixed bug, that prevented compilation with MANUAL_CONFIG enabled
bjarni
parents:
180
diff
changeset
|
141 |
# this should define SDL-CONFIG for manual configuration |
4d133909845a
(svn r190) Makefile: fixed bug, that prevented compilation with MANUAL_CONFIG enabled
bjarni
parents:
180
diff
changeset
|
142 |
ifeq ($(shell uname),FreeBSD) |
4d133909845a
(svn r190) Makefile: fixed bug, that prevented compilation with MANUAL_CONFIG enabled
bjarni
parents:
180
diff
changeset
|
143 |
SDL-CONFIG:=sdl11-config |
4d133909845a
(svn r190) Makefile: fixed bug, that prevented compilation with MANUAL_CONFIG enabled
bjarni
parents:
180
diff
changeset
|
144 |
else |
4d133909845a
(svn r190) Makefile: fixed bug, that prevented compilation with MANUAL_CONFIG enabled
bjarni
parents:
180
diff
changeset
|
145 |
SDL-CONFIG:=sdl-config |
4d133909845a
(svn r190) Makefile: fixed bug, that prevented compilation with MANUAL_CONFIG enabled
bjarni
parents:
180
diff
changeset
|
146 |
endif |
4d133909845a
(svn r190) Makefile: fixed bug, that prevented compilation with MANUAL_CONFIG enabled
bjarni
parents:
180
diff
changeset
|
147 |
endif |
0 | 148 |
else |
189
4d133909845a
(svn r190) Makefile: fixed bug, that prevented compilation with MANUAL_CONFIG enabled
bjarni
parents:
180
diff
changeset
|
149 |
# this should define SDL-CONFIG for manual configuration |
4d133909845a
(svn r190) Makefile: fixed bug, that prevented compilation with MANUAL_CONFIG enabled
bjarni
parents:
180
diff
changeset
|
150 |
ifeq ($(shell uname),FreeBSD) |
4d133909845a
(svn r190) Makefile: fixed bug, that prevented compilation with MANUAL_CONFIG enabled
bjarni
parents:
180
diff
changeset
|
151 |
SDL-CONFIG:=sdl11-config |
4d133909845a
(svn r190) Makefile: fixed bug, that prevented compilation with MANUAL_CONFIG enabled
bjarni
parents:
180
diff
changeset
|
152 |
else |
4d133909845a
(svn r190) Makefile: fixed bug, that prevented compilation with MANUAL_CONFIG enabled
bjarni
parents:
180
diff
changeset
|
153 |
SDL-CONFIG:=sdl-config |
4d133909845a
(svn r190) Makefile: fixed bug, that prevented compilation with MANUAL_CONFIG enabled
bjarni
parents:
180
diff
changeset
|
154 |
endif |
0 | 155 |
endif |
156 |
||
219
adfdf7fad721
(svn r220) Makefile: enables ENABLE_NETWORK by default if no config file is present
bjarni
parents:
189
diff
changeset
|
157 |
# this is used if there aren't any makefile.config |
0 | 158 |
ifndef CONFIG_INCLUDED |
285 | 159 |
# sets network on by default if there aren't any config file |
160 |
ENABLE_NETWORK:=1 |
|
161 |
||
162 |
# paths for make install |
|
163 |
# disabled as they would break it for some (many?) people if they were default |
|
164 |
#PREFIX:=/usr/local |
|
165 |
#DATA_DIR:=share/games/openttd |
|
166 |
#BINARY_DIR:=games |
|
167 |
#PERSONAL_DIR:=.openttd |
|
168 |
#USE_HOMEDIR:=1 |
|
169 |
||
0 | 170 |
-include $(LIB_DETECTION) |
171 |
endif |
|
172 |
||
162
565551f829e9
(svn r163) Makefile: made compileroutput nicer and added NOVERBOSE to supress all warnings/errors if wanted(default off) (sign_de)
bjarni
parents:
157
diff
changeset
|
173 |
# Verbose filter |
565551f829e9
(svn r163) Makefile: made compileroutput nicer and added NOVERBOSE to supress all warnings/errors if wanted(default off) (sign_de)
bjarni
parents:
157
diff
changeset
|
174 |
|
565551f829e9
(svn r163) Makefile: made compileroutput nicer and added NOVERBOSE to supress all warnings/errors if wanted(default off) (sign_de)
bjarni
parents:
157
diff
changeset
|
175 |
ifdef NOVERBOSE |
222
b88456001397
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents:
221
diff
changeset
|
176 |
VERBOSE_FILTER = >/dev/null 2>&1 |
162
565551f829e9
(svn r163) Makefile: made compileroutput nicer and added NOVERBOSE to supress all warnings/errors if wanted(default off) (sign_de)
bjarni
parents:
157
diff
changeset
|
177 |
else |
222
b88456001397
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents:
221
diff
changeset
|
178 |
VERBOSE_FILTER = |
162
565551f829e9
(svn r163) Makefile: made compileroutput nicer and added NOVERBOSE to supress all warnings/errors if wanted(default off) (sign_de)
bjarni
parents:
157
diff
changeset
|
179 |
endif |
565551f829e9
(svn r163) Makefile: made compileroutput nicer and added NOVERBOSE to supress all warnings/errors if wanted(default off) (sign_de)
bjarni
parents:
157
diff
changeset
|
180 |
|
0 | 181 |
ifdef DISPLAY_WARNINGS |
182 |
WARNING_DISPLAY:=-fstrict-aliasing |
|
222
b88456001397
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents:
221
diff
changeset
|
183 |
VERBOSE_FILTER = |
0 | 184 |
else |
185 |
WARNING_DISPLAY:=-fno-strict-aliasing |
|
186 |
endif |
|
187 |
||
180
47ee14fe2b35
(svn r181) Makefile: enabled ability to supress output of missing strings in lng files
bjarni
parents:
164
diff
changeset
|
188 |
ifdef SUPRESS_LANG_ERRORS |
47ee14fe2b35
(svn r181) Makefile: enabled ability to supress output of missing strings in lng files
bjarni
parents:
164
diff
changeset
|
189 |
ifndef VERBOSE_FILTER |
47ee14fe2b35
(svn r181) Makefile: enabled ability to supress output of missing strings in lng files
bjarni
parents:
164
diff
changeset
|
190 |
LANG_ERRORS = >/dev/null 2>&1 |
47ee14fe2b35
(svn r181) Makefile: enabled ability to supress output of missing strings in lng files
bjarni
parents:
164
diff
changeset
|
191 |
endif |
47ee14fe2b35
(svn r181) Makefile: enabled ability to supress output of missing strings in lng files
bjarni
parents:
164
diff
changeset
|
192 |
endif |
47ee14fe2b35
(svn r181) Makefile: enabled ability to supress output of missing strings in lng files
bjarni
parents:
164
diff
changeset
|
193 |
|
0 | 194 |
ifdef STATIC |
195 |
ifndef WIN32 |
|
196 |
ifndef OSX |
|
197 |
ifndef MORPHOS |
|
198 |
ifndef SKIP_STATIC_CHECK |
|
199 |
$(error Static is only known to work on MorphOS and MacOSX!!! --- Check makefile.config for more info and howto bypass this check) |
|
200 |
endif |
|
201 |
endif |
|
202 |
endif |
|
203 |
endif |
|
204 |
endif |
|
205 |
||
206 |
||
207 |
# Force SDL on UNIX platforms |
|
208 |
ifndef WITH_SDL |
|
209 |
ifdef UNIX |
|
210 |
$(error You need to have SDL installed in order to run OpenTTD on UNIX.) |
|
211 |
endif |
|
212 |
endif |
|
213 |
||
214 |
||
215 |
||
216 |
############################################################################## |
|
217 |
# |
|
218 |
# Compiler configuration |
|
219 |
# |
|
220 |
CC=gcc |
|
221 |
CXX=g++ |
|
222 |
||
223 |
ifdef MORPHOS |
|
224 |
CC += -noixemul -pipe |
|
225 |
CXX += -noixemul -pipe |
|
226 |
endif |
|
227 |
||
228 |
# Executable file extension |
|
229 |
ifdef WIN32 |
|
230 |
EXE=.exe |
|
231 |
else |
|
232 |
EXE= |
|
233 |
endif |
|
234 |
||
235 |
# Set output executable names |
|
32 | 236 |
TTD=openttd$(EXE) |
157
dd017fa3bad8
(svn r158) -Fix: make endianess check 100% accurate (hopefully ;))
truelight
parents:
126
diff
changeset
|
237 |
ENDIAN_CHECK=endian_check$(EXE) |
0 | 238 |
STRGEN=strgen/strgen$(EXE) |
239 |
OSXAPP="OpenTTD.app" |
|
240 |
||
241 |
# What revision are we compiling, if we have an idea? |
|
242 |
REV_NUMBER := $(shell if test -d .svn; then svnversion . | tr -dc 0-9; fi) |
|
243 |
||
244 |
ifdef RELEASE |
|
245 |
REV:=$(RELEASE) |
|
246 |
else |
|
450 | 247 |
REV := $(shell if test -d .svn; then svnversion . | awk '{ print "r"$$0 }'; fi) |
0 | 248 |
tmp_test:=$(shell echo "$(REV)" | grep "M" ) |
249 |
ifdef tmp_test |
|
250 |
REV_NUMBER:=1 |
|
251 |
endif |
|
252 |
endif |
|
253 |
||
254 |
ifndef REV_NUMBER |
|
255 |
REV_NUMBER:=0 |
|
256 |
endif |
|
257 |
||
258 |
# MorphOS needs builddate |
|
259 |
BUILDDATE=`date +%d.%m.%y` |
|
260 |
||
261 |
# AMD64 needs a little more settings to work |
|
262 |
ifeq ($(shell uname -m), x86_64) |
|
263 |
endwarnings:=endwarnings |
|
264 |
64_bit_warnings:=64_bit_warnings |
|
157
dd017fa3bad8
(svn r158) -Fix: make endianess check 100% accurate (hopefully ;))
truelight
parents:
126
diff
changeset
|
265 |
BASECFLAGS += -m64 |
0 | 266 |
endif |
267 |
||
268 |
||
269 |
# When calling the compiler, use these flags |
|
270 |
# -g debugging symbols |
|
271 |
# -Wall all warnings |
|
272 |
# -s automatic strip |
|
273 |
# |
|
274 |
# You may also want: |
|
275 |
# -O optimize or -O2 fully optimize (O's above 2 are not recommended) |
|
276 |
# -pg profile - generate profiling data. See "man gprof" to use this. |
|
277 |
||
278 |
CFLAGS=-Wall -Wno-multichar |
|
279 |
CDEFS=-DWITH_REV |
|
280 |
LDFLAGS= |
|
281 |
LIBS= |
|
282 |
||
283 |
ifdef DEBUG |
|
284 |
# Debug mode |
|
285 |
CDEFS += -D_DEBUG |
|
286 |
BASECFLAGS += -g |
|
287 |
else |
|
288 |
ifdef PROFILE |
|
289 |
BASECFLAGS += -pg |
|
290 |
else |
|
291 |
# Release mode |
|
292 |
ifndef MORPHOS |
|
293 |
# automatical strip breaks under morphos |
|
294 |
BASECFLAGS += -s |
|
295 |
LDFLAGS += -s |
|
296 |
endif |
|
297 |
endif |
|
298 |
||
299 |
ifdef OSX |
|
300 |
# these compilerflags makes the app run as fast as possible without making the app unstable. It works on G3 or newer |
|
301 |
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) |
|
302 |
else |
|
303 |
ifdef MORPHOS |
|
304 |
BASECFLAGS += -O2 -funroll-loops -fexpensive-optimizations -mstring -mmultiple $(WARNING_DISPLAY) |
|
305 |
else |
|
306 |
BASECFLAGS += -O2 $(WARNING_DISPLAY) |
|
307 |
endif |
|
308 |
ifndef PROFILE |
|
309 |
BASECFLAGS += -fomit-frame-pointer |
|
310 |
endif |
|
311 |
endif |
|
312 |
endif |
|
313 |
||
314 |
ifdef STATIC |
|
315 |
ifndef OSX # OSX can't build static if -static flag is used |
|
316 |
LDFLAGS += -static |
|
317 |
endif |
|
318 |
endif |
|
319 |
||
320 |
# If building on Cygwin/MingW don't link with Cygwin libs |
|
321 |
ifdef WIN32 |
|
322 |
ifdef MINGW |
|
323 |
ifdef CYGWIN |
|
324 |
BASECFLAGS += -mno-cygwin |
|
325 |
LDFLAGS += -mno-cygwin |
|
326 |
endif |
|
327 |
endif |
|
328 |
endif |
|
329 |
||
330 |
CFLAGS += $(BASECFLAGS) |
|
331 |
||
332 |
ifdef UNIX |
|
333 |
CDEFS += -DUNIX |
|
334 |
endif |
|
335 |
||
421
0b9bdcdfe0c5
(svn r619) Add the necessary bits to make building under BeOS using GNU Make work
tron
parents:
413
diff
changeset
|
336 |
ifdef BEOS |
0b9bdcdfe0c5
(svn r619) Add the necessary bits to make building under BeOS using GNU Make work
tron
parents:
413
diff
changeset
|
337 |
CDEFS += -DBEOS |
0b9bdcdfe0c5
(svn r619) Add the necessary bits to make building under BeOS using GNU Make work
tron
parents:
413
diff
changeset
|
338 |
LDFLAGS += -lmidi -lbe |
0b9bdcdfe0c5
(svn r619) Add the necessary bits to make building under BeOS using GNU Make work
tron
parents:
413
diff
changeset
|
339 |
ifdef WITH_NETWORK |
0b9bdcdfe0c5
(svn r619) Add the necessary bits to make building under BeOS using GNU Make work
tron
parents:
413
diff
changeset
|
340 |
ifdef BEOS_NET_SERVER |
0b9bdcdfe0c5
(svn r619) Add the necessary bits to make building under BeOS using GNU Make work
tron
parents:
413
diff
changeset
|
341 |
CDEFS += -DBEOS_NET_SERVER |
0b9bdcdfe0c5
(svn r619) Add the necessary bits to make building under BeOS using GNU Make work
tron
parents:
413
diff
changeset
|
342 |
endif |
0b9bdcdfe0c5
(svn r619) Add the necessary bits to make building under BeOS using GNU Make work
tron
parents:
413
diff
changeset
|
343 |
endif |
0b9bdcdfe0c5
(svn r619) Add the necessary bits to make building under BeOS using GNU Make work
tron
parents:
413
diff
changeset
|
344 |
endif |
0b9bdcdfe0c5
(svn r619) Add the necessary bits to make building under BeOS using GNU Make work
tron
parents:
413
diff
changeset
|
345 |
|
446
20304ea8e94e
(svn r655) Add the necessary bits to make building on SunOS/Solaris work
tron
parents:
421
diff
changeset
|
346 |
ifdef SUNOS |
20304ea8e94e
(svn r655) Add the necessary bits to make building on SunOS/Solaris work
tron
parents:
421
diff
changeset
|
347 |
CDEFS += -DSUNOS |
20304ea8e94e
(svn r655) Add the necessary bits to make building on SunOS/Solaris work
tron
parents:
421
diff
changeset
|
348 |
ifdef WITH_NETWORK |
20304ea8e94e
(svn r655) Add the necessary bits to make building on SunOS/Solaris work
tron
parents:
421
diff
changeset
|
349 |
LDFLAGS += -lnsl -lsocket |
20304ea8e94e
(svn r655) Add the necessary bits to make building on SunOS/Solaris work
tron
parents:
421
diff
changeset
|
350 |
endif |
20304ea8e94e
(svn r655) Add the necessary bits to make building on SunOS/Solaris work
tron
parents:
421
diff
changeset
|
351 |
endif |
20304ea8e94e
(svn r655) Add the necessary bits to make building on SunOS/Solaris work
tron
parents:
421
diff
changeset
|
352 |
|
0 | 353 |
# SDL config |
354 |
ifdef WITH_SDL |
|
355 |
CDEFS += -DWITH_SDL |
|
356 |
CFLAGS += `$(SDL-CONFIG) --cflags` |
|
357 |
ifdef STATIC |
|
358 |
LIBS += `$(SDL-CONFIG) --static-libs` |
|
359 |
else |
|
360 |
LIBS += `$(SDL-CONFIG) --libs` |
|
361 |
endif |
|
362 |
endif |
|
363 |
||
364 |
||
365 |
# zlib config |
|
366 |
ifdef WITH_ZLIB |
|
367 |
CDEFS += -DWITH_ZLIB |
|
368 |
ifdef STATIC |
|
369 |
ifdef OSX |
|
370 |
# zlib is default on OSX, so everybody have it. No need for static linking |
|
371 |
LIBS += -lz |
|
372 |
else |
|
373 |
ifndef STATIC_ZLIB_PATH |
|
374 |
ifndef MANUAL_CONFIG |
|
375 |
# updates makefile.config with the zlib path |
|
376 |
UPDATECONFIG:=upgradeconf |
|
377 |
endif |
|
378 |
TEMP:=$(shell ls /lib 2>/dev/null | grep "zlib.a")$(shell ls /lib 2>/dev/null | grep "libz.a") |
|
379 |
ifdef TEMP |
|
380 |
STATIC_ZLIB_PATH:=/lib/$(TEMP) |
|
381 |
else |
|
382 |
TEMP:=$(shell ls /usr/lib 2>/dev/null | grep "zlib.a")$(shell ls /usr/lib 2>/dev/null | grep "libz.a") |
|
383 |
ifdef TEMP |
|
384 |
STATIC_ZLIB_PATH:=/usr/lib/$(TEMP) |
|
385 |
else |
|
386 |
TEMP:=$(shell ls /usr/local/lib 2>/dev/null | grep "zlib.a")$(shell ls /usr/local/lib 2>/dev/null | grep "libz.a") |
|
387 |
ifdef TEMP |
|
388 |
STATIC_ZLIB_PATH:=/usr/local/lib/$(TEMP) |
|
389 |
endif |
|
390 |
endif |
|
391 |
endif |
|
392 |
endif |
|
393 |
LIBS += $(STATIC_ZLIB_PATH) |
|
394 |
endif |
|
395 |
else |
|
396 |
LIBS += -lz |
|
397 |
endif |
|
398 |
endif |
|
399 |
||
400 |
# libpng config |
|
401 |
ifdef WITH_PNG |
|
402 |
CDEFS += -DWITH_PNG |
|
403 |
# FreeBSD doesn't use libpng-config |
|
404 |
ifdef FREEBSD |
|
405 |
LIBS += -lpng |
|
406 |
else |
|
407 |
CFLAGS += `libpng-config --cflags` |
|
408 |
ifdef OSX |
|
409 |
ifdef STATIC |
|
410 |
# Seems like we need a tiny hack for OSX static to work |
|
411 |
LIBS += `libpng-config --prefix`/lib/libpng.a |
|
412 |
else |
|
413 |
LIBS += `libpng-config --libs` |
|
414 |
endif |
|
415 |
else |
|
416 |
# seems like older libpng versions are broken and need this |
|
417 |
PNGCONFIG_FLAGS = --ldflags --libs |
|
418 |
ifdef STATIC |
|
419 |
LIBS += `libpng-config --static $(PNGCONFIG_FLAGS)` |
|
420 |
else |
|
421 |
LIBS += `libpng-config $(PNGCONFIG_FLAGS)` |
|
422 |
endif |
|
423 |
endif |
|
424 |
endif |
|
425 |
endif |
|
426 |
||
347
892935295937
(svn r530) Makefile: added ability to switch asserts on and off
bjarni
parents:
285
diff
changeset
|
427 |
# enables/disables assert() |
348
959f425dc282
(svn r531) Makefile: made asserts enabled by default
bjarni
parents:
347
diff
changeset
|
428 |
ifdef DISABLE_ASSERTS |
959f425dc282
(svn r531) Makefile: made asserts enabled by default
bjarni
parents:
347
diff
changeset
|
429 |
CFLAGS += -DNDEBUG |
959f425dc282
(svn r531) Makefile: made asserts enabled by default
bjarni
parents:
347
diff
changeset
|
430 |
endif |
959f425dc282
(svn r531) Makefile: made asserts enabled by default
bjarni
parents:
347
diff
changeset
|
431 |
|
959f425dc282
(svn r531) Makefile: made asserts enabled by default
bjarni
parents:
347
diff
changeset
|
432 |
# automatically disables asserts for release |
959f425dc282
(svn r531) Makefile: made asserts enabled by default
bjarni
parents:
347
diff
changeset
|
433 |
ifdef RELEASE |
347
892935295937
(svn r530) Makefile: added ability to switch asserts on and off
bjarni
parents:
285
diff
changeset
|
434 |
ifndef ENABLE_ASSERTS |
892935295937
(svn r530) Makefile: added ability to switch asserts on and off
bjarni
parents:
285
diff
changeset
|
435 |
CFLAGS += -DNDEBUG |
892935295937
(svn r530) Makefile: added ability to switch asserts on and off
bjarni
parents:
285
diff
changeset
|
436 |
endif |
348
959f425dc282
(svn r531) Makefile: made asserts enabled by default
bjarni
parents:
347
diff
changeset
|
437 |
endif |
0 | 438 |
|
439 |
ifdef TRANSLATOR |
|
440 |
STRGEN_FLAGS=-t |
|
441 |
else |
|
442 |
STRGEN_FLAGS= |
|
443 |
endif |
|
444 |
||
445 |
||
446 |
# MIDI setup |
|
447 |
ifdef OSX |
|
448 |
ifndef MIDI |
|
449 |
MIDI:=$(OSXAPP)/contents/macos/track_starter |
|
450 |
endif |
|
451 |
endif |
|
452 |
||
453 |
ifdef MIDI |
|
454 |
CDEFS += -DEXTERNAL_PLAYER=\"$(MIDI)\" |
|
455 |
ifdef MIDI_ARG |
|
456 |
CDEFS += -DMIDI_ARG=\"$(MIDI_ARG)\" |
|
457 |
endif |
|
458 |
endif |
|
459 |
||
460 |
# Experimental |
|
461 |
ifdef WITH_NETWORK |
|
462 |
CDEFS += -DENABLE_NETWORK |
|
463 |
ifdef UNIX |
|
464 |
ifndef OSX |
|
465 |
ifndef MORPHOS |
|
466 |
# this have caused problems on many platforms and disabling it didn't break anything |
|
467 |
# now we test if disabling it as a general breaks it for anybody |
|
468 |
#LIBS += -lresolv |
|
469 |
endif |
|
470 |
endif |
|
471 |
endif |
|
472 |
endif |
|
473 |
||
474 |
ifdef WITH_DIRECTMUSIC |
|
475 |
CDEFS += -DWIN32_ENABLE_DIRECTMUSIC_SUPPORT |
|
476 |
endif |
|
477 |
||
478 |
ifdef WIN32 |
|
479 |
LIBS += -lws2_32 -lwinmm -lgdi32 -ldxguid -lole32 -lstdc++ |
|
480 |
TTDLDFLAGS += -Wl,--subsystem,windows |
|
481 |
endif |
|
482 |
||
483 |
# sets up the paths for use for make install |
|
285 | 484 |
ifdef INSTALL |
485 |
# We use _PREFIXED vars here, so the paths are recalculated every time, and |
|
486 |
# the prefix is not prepended in the makefile config |
|
487 |
BINARY_DIR_PREFIXED:=$(PREFIX)/$(BINARY_DIR) |
|
488 |
DATA_DIR_PREFIXED:=$(PREFIX)/$(DATA_DIR) |
|
489 |
# We use _INSTALL vars here, these vars are the locations where the files will |
|
490 |
# be installed |
|
491 |
DATA_DIR_INSTALL=$(DEST_DIR)/$(DATA_DIR_PREFIXED) |
|
492 |
BINARY_DIR_INSTALL=$(DEST_DIR)/$(BINARY_DIR_PREFIXED) |
|
493 |
# Let the code know where to find stuff |
|
494 |
ifdef DATA_DIR_PREFIXED |
|
495 |
CDEFS += -DGAME_DATA_DIR=\"$(DATA_DIR_PREFIXED)/\" |
|
0 | 496 |
endif |
285 | 497 |
|
498 |
ifdef PERSONAL_DIR |
|
499 |
CDEFS += -DPERSONAL_DIR=\"$(PERSONAL_DIR)/\" |
|
500 |
endif |
|
501 |
||
502 |
ifdef USE_HOMEDIR |
|
503 |
CDEFS += -DUSE_HOMEDIR |
|
504 |
endif |
|
0 | 505 |
endif |
506 |
||
507 |
############################################################################## |
|
508 |
# |
|
509 |
# What to compile |
|
510 |
# (users do not want to modify anything below) |
|
511 |
# |
|
512 |
||
513 |
||
514 |
### Sources |
|
515 |
||
421
0b9bdcdfe0c5
(svn r619) Add the necessary bits to make building under BeOS using GNU Make work
tron
parents:
413
diff
changeset
|
516 |
C_SOURCES = \ |
112
5291485847ff
(svn r113) -Update: re-ordered Makefile (filenames are now in alphabetic order again) (Celestar)
truelight
parents:
84
diff
changeset
|
517 |
ai.c ai_build.c ai_new.c ai_pathfinder.c ai_shared.c aircraft_cmd.c \ |
5291485847ff
(svn r113) -Update: re-ordered Makefile (filenames are now in alphabetic order again) (Celestar)
truelight
parents:
84
diff
changeset
|
518 |
aircraft_gui.c airport.c airport_gui.c aystar.c bridge_gui.c \ |
221
124a804562a5
(svn r222) -Fix: Added network.h and console_cmd.c to MSVC6 Project
signde
parents:
219
diff
changeset
|
519 |
clear_cmd.c command.c console.c console_cmds.c disaster_cmd.c dock_gui.c dummy_land.c economy.c \ |
452
520e4ed6945d
(svn r662) [newgrf] Moved grfspecial.c to newgrf.c/newgrf.h
dominik
parents:
451
diff
changeset
|
520 |
engine.c engine_gui.c fileio.c gfx.c graph_gui.c newgrf.c \ |
112
5291485847ff
(svn r113) -Update: re-ordered Makefile (filenames are now in alphabetic order again) (Celestar)
truelight
parents:
84
diff
changeset
|
521 |
industry_cmd.c industry_gui.c intro_gui.c landscape.c main_gui.c \ |
5291485847ff
(svn r113) -Update: re-ordered Makefile (filenames are now in alphabetic order again) (Celestar)
truelight
parents:
84
diff
changeset
|
522 |
minilzo.c misc.c misc_cmd.c misc_gui.c music_gui.c namegen.c network.c \ |
5291485847ff
(svn r113) -Update: re-ordered Makefile (filenames are now in alphabetic order again) (Celestar)
truelight
parents:
84
diff
changeset
|
523 |
network_gui.c news_gui.c oldloader.c order_cmd.c order_gui.c \ |
5291485847ff
(svn r113) -Update: re-ordered Makefile (filenames are now in alphabetic order again) (Celestar)
truelight
parents:
84
diff
changeset
|
524 |
pathfind.c player_gui.c players.c queue.c rail_cmd.c rail_gui.c rev.c \ |
5291485847ff
(svn r113) -Update: re-ordered Makefile (filenames are now in alphabetic order again) (Celestar)
truelight
parents:
84
diff
changeset
|
525 |
road_cmd.c road_gui.c roadveh_cmd.c roadveh_gui.c saveload.c \ |
5291485847ff
(svn r113) -Update: re-ordered Makefile (filenames are now in alphabetic order again) (Celestar)
truelight
parents:
84
diff
changeset
|
526 |
screenshot.c settings.c settings_gui.c ship_cmd.c ship_gui.c \ |
413
36afcda97345
(svn r610) -newgrf: Support for some basic deterministical spritegroups regarding stations. Waypoints look changes based on year now :^) (pasky).
darkvater
parents:
348
diff
changeset
|
527 |
smallmap_gui.c sound.c sprite.c spritecache.c station_cmd.c station_gui.c \ |
112
5291485847ff
(svn r113) -Update: re-ordered Makefile (filenames are now in alphabetic order again) (Celestar)
truelight
parents:
84
diff
changeset
|
528 |
strings.c subsidy_gui.c terraform_gui.c texteff.c town_cmd.c \ |
5291485847ff
(svn r113) -Update: re-ordered Makefile (filenames are now in alphabetic order again) (Celestar)
truelight
parents:
84
diff
changeset
|
529 |
town_gui.c train_cmd.c train_gui.c tree_cmd.c ttd.c tunnelbridge_cmd.c \ |
421
0b9bdcdfe0c5
(svn r619) Add the necessary bits to make building under BeOS using GNU Make work
tron
parents:
413
diff
changeset
|
530 |
unmovable_cmd.c vehicle.c vehicle_gui.c viewport.c water_cmd.c widget.c window.c |
0b9bdcdfe0c5
(svn r619) Add the necessary bits to make building under BeOS using GNU Make work
tron
parents:
413
diff
changeset
|
531 |
CXX_SOURCES = |
0 | 532 |
|
533 |
ifdef WITH_SDL |
|
421
0b9bdcdfe0c5
(svn r619) Add the necessary bits to make building under BeOS using GNU Make work
tron
parents:
413
diff
changeset
|
534 |
C_SOURCES += sdl.c |
0 | 535 |
endif |
536 |
||
537 |
ifdef WIN32 |
|
421
0b9bdcdfe0c5
(svn r619) Add the necessary bits to make building under BeOS using GNU Make work
tron
parents:
413
diff
changeset
|
538 |
C_SOURCES += win32.c w32dm.c |
0 | 539 |
else |
421
0b9bdcdfe0c5
(svn r619) Add the necessary bits to make building under BeOS using GNU Make work
tron
parents:
413
diff
changeset
|
540 |
C_SOURCES += extmidi.c unix.c |
0 | 541 |
endif |
542 |
||
421
0b9bdcdfe0c5
(svn r619) Add the necessary bits to make building under BeOS using GNU Make work
tron
parents:
413
diff
changeset
|
543 |
ttd_OBJS = $(C_SOURCES:%.c=%.o) $(CXX_SOURCES:%.cpp=%.o) |
0b9bdcdfe0c5
(svn r619) Add the necessary bits to make building under BeOS using GNU Make work
tron
parents:
413
diff
changeset
|
544 |
|
0b9bdcdfe0c5
(svn r619) Add the necessary bits to make building under BeOS using GNU Make work
tron
parents:
413
diff
changeset
|
545 |
ifdef BEOS |
532 | 546 |
CXX_SOURCES += os/beos/bemidi.cpp |
547 |
CFLAGS += -I. |
|
421
0b9bdcdfe0c5
(svn r619) Add the necessary bits to make building under BeOS using GNU Make work
tron
parents:
413
diff
changeset
|
548 |
endif |
0 | 549 |
|
550 |
ifdef WIN32 |
|
551 |
# Resource file |
|
552 |
ttd_OBJS += winres.o |
|
553 |
endif |
|
554 |
||
555 |
ifdef WITH_DIRECTMUSIC |
|
421
0b9bdcdfe0c5
(svn r619) Add the necessary bits to make building under BeOS using GNU Make work
tron
parents:
413
diff
changeset
|
556 |
CXX_SOURCES += w32dm2.cpp |
0 | 557 |
endif |
558 |
||
559 |
ttd_DEPS1 = $(foreach obj,$(ttd_OBJS),.deps/$(obj)) |
|
560 |
ttd_DEPS = $(ttd_DEPS1:%.o=%.P) |
|
561 |
||
562 |
LANG_TXT = $(filter-out %.unfinished.txt,$(wildcard lang/*.txt)) |
|
563 |
LANGS = $(LANG_TXT:%.txt=%.lng) |
|
564 |
||
565 |
C_COMPILE = $(CC) $(CFLAGS) $(CDEFS) |
|
566 |
CXX_COMPILE = $(CXX) $(CFLAGS) $(CDEFS) |
|
567 |
||
568 |
C_BUILD = $(C_COMPILE) -c |
|
569 |
CXX_BUILD = $(CXX_COMPILE) -c |
|
570 |
||
571 |
C_LINK = $(CC) $(LDFLAGS) -o |
|
572 |
||
573 |
||
162
565551f829e9
(svn r163) Makefile: made compileroutput nicer and added NOVERBOSE to supress all warnings/errors if wanted(default off) (sign_de)
bjarni
parents:
157
diff
changeset
|
574 |
|
0 | 575 |
############################################################################## |
576 |
# |
|
577 |
# Targets |
|
578 |
# |
|
579 |
||
580 |
||
581 |
### Normal build rules |
|
582 |
||
583 |
||
584 |
ifdef OSX |
|
585 |
OSX:=OSX |
|
586 |
endif |
|
587 |
||
588 |
||
475
d9b87f0ffdb4
(svn r726) The OpenTTD binary doesn't depend on the language files, so move this dependency to the all target
tron
parents:
474
diff
changeset
|
589 |
all: endian.h $(UPDATECONFIG) $(LANGS) $(TTD) $(OSX) $(endwarnings) |
0 | 590 |
|
157
dd017fa3bad8
(svn r158) -Fix: make endianess check 100% accurate (hopefully ;))
truelight
parents:
126
diff
changeset
|
591 |
endian.h: $(ENDIAN_CHECK) |
222
b88456001397
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents:
221
diff
changeset
|
592 |
@# Check if system is LITTLE_ENDIAN or BIG_ENDIAN |
163
deb9b58db3f4
(svn r164) -Fix: Makefile did not clean up endian-files
truelight
parents:
162
diff
changeset
|
593 |
@echo 'Running endian_check'; \ |
deb9b58db3f4
(svn r164) -Fix: Makefile did not clean up endian-files
truelight
parents:
162
diff
changeset
|
594 |
./$(ENDIAN_CHECK) > $@ |
157
dd017fa3bad8
(svn r158) -Fix: make endianess check 100% accurate (hopefully ;))
truelight
parents:
126
diff
changeset
|
595 |
|
dd017fa3bad8
(svn r158) -Fix: make endianess check 100% accurate (hopefully ;))
truelight
parents:
126
diff
changeset
|
596 |
$(ENDIAN_CHECK): endian_check.c |
163
deb9b58db3f4
(svn r164) -Fix: Makefile did not clean up endian-files
truelight
parents:
162
diff
changeset
|
597 |
@echo 'Compiling and Linking $@'; \ |
deb9b58db3f4
(svn r164) -Fix: Makefile did not clean up endian-files
truelight
parents:
162
diff
changeset
|
598 |
$(CC) $(BASECFLAGS) $(CDEFS) endian_check.c -o $@ |
222
b88456001397
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents:
221
diff
changeset
|
599 |
|
0 | 600 |
|
475
d9b87f0ffdb4
(svn r726) The OpenTTD binary doesn't depend on the language files, so move this dependency to the all target
tron
parents:
474
diff
changeset
|
601 |
$(TTD): table/strings.h $(ttd_OBJS) $(MAKE_CONFIG) |
462
b995527cb51c
(svn r681) Support for VERBOSE configuration variable which shows the commands actually used for compilation.
pasky
parents:
452
diff
changeset
|
602 |
$(if $(VERBOSE),@echo '$(C_LINK) $@ $(TTDLDFLAGS) $(ttd_OBJS) $(LIBS)';,@echo 'Compiling and Linking $@';) \ |
b995527cb51c
(svn r681) Support for VERBOSE configuration variable which shows the commands actually used for compilation.
pasky
parents:
452
diff
changeset
|
603 |
$(C_LINK) $@ $(TTDLDFLAGS) $(ttd_OBJS) $(LIBS) $(VERBOSE_FILTER) |
0 | 604 |
|
605 |
$(OSX): |
|
606 |
@mkdir -p $(OSXAPP)/Contents/MacOS |
|
607 |
@mkdir -p $(OSXAPP)/Contents/Resources |
|
608 |
@echo "APPL????" > $(OSXAPP)/Contents/PkgInfo |
|
35 | 609 |
@cp os/macos/ttd.icns $(OSXAPP)/Contents/Resources/openttd.icns |
0 | 610 |
@os/macos/plistgen.sh $(OSXAPP) $(REV) |
611 |
@cp os/macos/track_starter $(OSXAPP)/contents/macos |
|
612 |
@ls os/macos | grep -q "\.class" || \ |
|
613 |
javac os/macos/OpenTTDMidi.java |
|
614 |
@cp os/macos/OpenTTDMidi.class $(OSXAPP)/contents/macos |
|
162
565551f829e9
(svn r163) Makefile: made compileroutput nicer and added NOVERBOSE to supress all warnings/errors if wanted(default off) (sign_de)
bjarni
parents:
157
diff
changeset
|
615 |
@cp $(TTD) $(OSXAPP)/Contents/MacOS/$(TTD) |
0 | 616 |
|
617 |
$(endwarnings): $(64_bit_warnings) |
|
618 |
||
619 |
$(64_bit_warnings): |
|
620 |
$(warning 64 bit CPUs will get some 64 bit specific bugs!) |
|
621 |
$(warning If you see any bugs, include in your bug report that you use a 64 bit CPU) |
|
622 |
||
451
1c72622b9701
(svn r661) Make strgen print its own revision instead of the repo's.
tron
parents:
450
diff
changeset
|
623 |
$(STRGEN): strgen/strgen.c |
162
565551f829e9
(svn r163) Makefile: made compileroutput nicer and added NOVERBOSE to supress all warnings/errors if wanted(default off) (sign_de)
bjarni
parents:
157
diff
changeset
|
624 |
@echo 'Compiling and Linking $@'; \ |
565551f829e9
(svn r163) Makefile: made compileroutput nicer and added NOVERBOSE to supress all warnings/errors if wanted(default off) (sign_de)
bjarni
parents:
157
diff
changeset
|
625 |
$(CC) $(BASECFLAGS) $(CDEFS) -o $@ $^ $(VERBOSE_FILTER) |
0 | 626 |
|
474 | 627 |
table/strings.h: lang/english.txt $(STRGEN) |
162
565551f829e9
(svn r163) Makefile: made compileroutput nicer and added NOVERBOSE to supress all warnings/errors if wanted(default off) (sign_de)
bjarni
parents:
157
diff
changeset
|
628 |
@echo 'Generating $@'; \ |
0 | 629 |
$(STRGEN) |
222
b88456001397
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents:
221
diff
changeset
|
630 |
|
476
ad012336ed61
(svn r727) The langauge files depend on english.txt, not strings.h
tron
parents:
475
diff
changeset
|
631 |
lang/%.lng: lang/%.txt $(STRGEN) lang/english.txt |
162
565551f829e9
(svn r163) Makefile: made compileroutput nicer and added NOVERBOSE to supress all warnings/errors if wanted(default off) (sign_de)
bjarni
parents:
157
diff
changeset
|
632 |
@echo 'Generating $@'; \ |
180
47ee14fe2b35
(svn r181) Makefile: enabled ability to supress output of missing strings in lng files
bjarni
parents:
164
diff
changeset
|
633 |
$(STRGEN) $(STRGEN_FLAGS) $< $(VERBOSE_FILTER) $(LANG_ERRORS) |
0 | 634 |
|
635 |
winres.o: ttd.rc |
|
636 |
windres -o $@ $< |
|
637 |
||
638 |
||
639 |
rev.c: FORCE |
|
640 |
@# setting the revision number in a place, there the binary can read it |
|
641 |
@echo 'const char _openttd_revision[] = "'$(REV)'";' >>rev.c.new |
|
642 |
@echo 'const int _revision_number = $(REV_NUMBER);' >>rev.c.new |
|
643 |
@# some additions for MorphOS versions tag |
|
644 |
@echo '#ifdef __MORPHOS__' >>rev.c.new |
|
645 |
@echo 'const char morphos_versions_tag[] = "\\0$$VER: OpenTTD '$(REV)' ('${BUILDDATE}') © OpenTTD Team [MorphOS, PowerPC]";' >>rev.c.new |
|
646 |
@echo '#endif' >>rev.c.new |
|
647 |
@# Only update the real rev.c if it actually changed, to prevent |
|
648 |
@# useless rebuilds. |
|
649 |
@cmp -s rev.c rev.c.new 2>/dev/null || mv rev.c.new rev.c |
|
650 |
@rm -f rev.c.new |
|
651 |
||
652 |
FORCE: |
|
653 |
||
654 |
||
32 | 655 |
# ttd$(EXE) is removed just to make sure people execute the right binary (openttd$(EXE)) |
656 |
# remove this for next release! |
|
0 | 657 |
clean: |
162
565551f829e9
(svn r163) Makefile: made compileroutput nicer and added NOVERBOSE to supress all warnings/errors if wanted(default off) (sign_de)
bjarni
parents:
157
diff
changeset
|
658 |
@echo 'Cleaning up...'; \ |
163
deb9b58db3f4
(svn r164) -Fix: Makefile did not clean up endian-files
truelight
parents:
162
diff
changeset
|
659 |
rm -rf .deps *~ $(TTD) $(STRGEN) core table/strings.h $(LANGS) $(ttd_OBJS) endian.h $(ENDIAN_CHECK) ttd$(EXE) |
0 | 660 |
|
661 |
mrproper: clean |
|
662 |
rm -rf $(MAKE_CONFIG) |
|
663 |
||
664 |
ifndef OSX |
|
665 |
ifndef MORPHOS |
|
666 |
install: |
|
285 | 667 |
ifeq ($(INSTALL),) |
668 |
$(error make install is highly experimental at his state and not\ |
|
0 | 669 |
tested very much - use at your own risk - to use run \"make install INSTALL:=1\" - make sure makefile.config\ |
670 |
is set correctly up - run \"make upgradeconf\") |
|
285 | 671 |
endif |
672 |
||
673 |
ifeq ($(PREFIX), ) |
|
674 |
$(error no prefix set - check makefile.config) |
|
675 |
endif |
|
676 |
# We compare against the non prefixed version here, so we won't install |
|
677 |
# if only the prefix has been set |
|
678 |
ifeq ($(DATA_DIR),) |
|
679 |
$(error no data path set - check makefile.config) |
|
680 |
endif |
|
681 |
ifeq ($(BINARY_DIR),) |
|
682 |
$(error no binary path set - check makefile.config) |
|
683 |
endif |
|
684 |
# We'll install in $DEST_DIR instead of root if it is set (we don't |
|
685 |
# care about extra /'s |
|
686 |
mkdir -p $(DATA_DIR_INSTALL)/lang |
|
687 |
mkdir -p $(DATA_DIR_INSTALL)/data |
|
688 |
mkdir -p $(DATA_DIR_INSTALL)/gm |
|
689 |
mkdir -p $(BINARY_DIR_INSTALL) |
|
690 |
cp $(TTD) $(BINARY_DIR_INSTALL) |
|
691 |
cp lang/*.lng $(DATA_DIR_INSTALL)/lang |
|
692 |
cp data/*.grf $(DATA_DIR_INSTALL)/data |
|
693 |
cp data/opntitle.dat $(DATA_DIR_INSTALL)/data |
|
694 |
cp media/openttd.64.png $(DATA_DIR_INSTALL) |
|
0 | 695 |
else #MorphOS |
696 |
install: |
|
697 |
$(error make install is not supported on MorphOS) |
|
698 |
endif |
|
699 |
else # OSX |
|
700 |
install: |
|
701 |
$(error make install is not supported on MacOSX) |
|
702 |
endif |
|
703 |
||
704 |
||
705 |
love: |
|
706 |
@echo "YES! I thought you would never ask. We will have a great time. You can keep me turned on all night" |
|
707 |
||
708 |
.PHONY: clean all $(OSX) install $(64_bit_warnings) $(endwarnings) love |
|
709 |
||
710 |
||
711 |
### Automatic configuration |
|
712 |
-include $(CONFIG_WRITER) |
|
222
b88456001397
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents:
221
diff
changeset
|
713 |
|
0 | 714 |
|
715 |
# Export all variables set to subprocesses (a bit dirty) |
|
716 |
.EXPORT_ALL_VARIABLES: |
|
717 |
upgradeconf: $(MAKE_CONFIG) |
|
718 |
rm $(MAKE_CONFIG) |
|
719 |
$(MAKE) $(MAKE_CONFIG) |
|
720 |
||
721 |
.PHONY: upgradeconf |
|
722 |
||
723 |
||
724 |
### Internal build rules |
|
725 |
||
726 |
# This makes sure the .deps dir is always around. |
|
727 |
DEPS_MAGIC := $(shell mkdir .deps > /dev/null 2>&1 || :) |
|
728 |
||
729 |
# Introduce the dependencies |
|
730 |
-include $(ttd_DEPS) |
|
731 |
||
732 |
# This compiles the object file as well as silently updating its dependencies |
|
733 |
# list at the same time. It is not an issue that they aren't around during the |
|
734 |
# first compilation round as we just build everything at that time anyway, |
|
735 |
# therefore we do not need to watch deps. |
|
162
565551f829e9
(svn r163) Makefile: made compileroutput nicer and added NOVERBOSE to supress all warnings/errors if wanted(default off) (sign_de)
bjarni
parents:
157
diff
changeset
|
736 |
|
565551f829e9
(svn r163) Makefile: made compileroutput nicer and added NOVERBOSE to supress all warnings/errors if wanted(default off) (sign_de)
bjarni
parents:
157
diff
changeset
|
737 |
#@echo '$(C_BUILD) $<'; \ |
565551f829e9
(svn r163) Makefile: made compileroutput nicer and added NOVERBOSE to supress all warnings/errors if wanted(default off) (sign_de)
bjarni
parents:
157
diff
changeset
|
738 |
|
565551f829e9
(svn r163) Makefile: made compileroutput nicer and added NOVERBOSE to supress all warnings/errors if wanted(default off) (sign_de)
bjarni
parents:
157
diff
changeset
|
739 |
|
0 | 740 |
%.o: %.c $(MAKE_CONFIG) |
462
b995527cb51c
(svn r681) Support for VERBOSE configuration variable which shows the commands actually used for compilation.
pasky
parents:
452
diff
changeset
|
741 |
$(if $(VERBOSE),@echo '$(C_BUILD) $<',@echo 'Compiling $(*F).o'); \ |
162
565551f829e9
(svn r163) Makefile: made compileroutput nicer and added NOVERBOSE to supress all warnings/errors if wanted(default off) (sign_de)
bjarni
parents:
157
diff
changeset
|
742 |
$(C_BUILD) $< -Wp,-MD,.deps/$(*F).pp $(VERBOSE_FILTER) |
0 | 743 |
@-cp .deps/$(*F).pp .deps/$(*F).P; \ |
744 |
tr ' ' '\012' < .deps/$(*F).pp \ |
|
745 |
| sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \ |
|
746 |
>> .deps/$(*F).P; \ |
|
747 |
rm .deps/$(*F).pp |
|
748 |
||
532 | 749 |
# For DirectMusic build and BeOS specific parts |
0 | 750 |
%.o: %.cpp $(MAKE_CONFIG) |
532 | 751 |
$(CXX_BUILD) $< -o $@ |