1 # $Id$ |
1 # $Id$ |
2 |
|
3 # This Makefile is partially based on "a completely generic Makefile", |
|
4 # originally created by Justin Husted <husted@cs> |
|
5 # |
|
6 # Rewrite and sane dependencies support by Petr Baudis <pasky@ucw.cz> |
|
7 # Cygwin support and configuration by Jaen Saul <slowbyte@hot.ee> |
|
8 # A lot of modifications by Bjarni Corfitzen <bjarni@openttd.com> |
|
9 # |
|
10 # Last modified by: $Author: strigeus $ |
|
11 # On: $Date: 2004/03/11 19:15:06 $ |
|
12 |
|
13 |
2 |
14 ############################################################################## |
3 ############################################################################## |
15 # |
4 # |
16 # Usage |
5 # Usage |
17 # |
6 # |
291 endif |
280 endif |
292 ifndef CFLAGS_HOST |
281 ifndef CFLAGS_HOST |
293 CFLAGS_HOST = $(BASECFLAGS) |
282 CFLAGS_HOST = $(BASECFLAGS) |
294 endif |
283 endif |
295 |
284 |
296 # When calling the compiler, use these flags |
|
297 # -g debugging symbols |
|
298 # -Wall all warnings |
|
299 # -s automatic strip |
|
300 # |
|
301 # You may also want: |
|
302 # -O optimize or -O2 fully optimize (O's above 2 are not recommended) |
|
303 # -pg profile - generate profiling data. See "man gprof" to use this. |
|
304 |
285 |
305 CC_VERSION = $(shell $(CC) -dumpversion | cut -c 1,3) |
286 CC_VERSION = $(shell $(CC) -dumpversion | cut -c 1,3) |
306 |
287 |
307 # GNU make can only test for (in)equality |
288 # GNU make can only test for (in)equality |
308 # this is a workaround to test for >= |
289 # this is a workaround to test for >= |
309 ifeq ($(shell if test $(CC_VERSION) -ge 29; then echo true; fi), true) |
290 ifeq ($(shell expr $(CC_VERSION) \>= 29), 1) |
310 CFLAGS += -O -Wall -Wno-multichar -Wsign-compare -Wstrict-prototypes |
291 CFLAGS += -O -Wall -Wno-multichar -Wsign-compare -Wstrict-prototypes |
311 CFLAGS += -Wwrite-strings -Wpointer-arith |
292 CFLAGS += -Wwrite-strings -Wpointer-arith |
312 endif |
293 endif |
313 ifeq ($(shell if test $(CC_VERSION) -ge 30; then echo true; fi), true) |
294 ifeq ($(shell expr $(CC_VERSION) \>= 30), 1) |
314 CFLAGS += -W -Wno-unused-parameter |
295 CFLAGS += -W -Wno-unused-parameter |
315 endif |
296 endif |
316 ifeq ($(shell if test $(CC_VERSION) -ge 34; then echo true; fi), true) |
297 ifeq ($(shell expr $(CC_VERSION) \>= 34), 1) |
317 CFLAGS += -Wdeclaration-after-statement -Wold-style-definition |
298 CFLAGS += -Wdeclaration-after-statement -Wold-style-definition |
318 endif |
299 endif |
319 |
300 |
320 ifdef DEBUG |
301 ifdef DEBUG |
321 ifeq ($(shell expr $(DEBUG) \>= 1), 1) |
302 ifeq ($(shell expr $(DEBUG) \>= 1), 1) |