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