blob: 1ffd777a5c0672cdaa2dc7e6b6159c0cb2050d58 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
|
CFILES = ai.c aircraft_cmd.c aircraft_gui.c airport_gui.c
bridge_gui.c clear_cmd.c command.c disaster_cmd.c
dock_gui.c dummy_land.c economy.c engine.c engine_gui.c
fileio.c gfx.c graph_gui.c industry_cmd.c industry_gui.c
intro_gui.c landscape.c main_gui.c minilzo.c misc.c
misc_cmd.c misc_gui.c music_gui.c namegen.c network.c
news_gui.c oldloader.c order_cmd.c order_gui.c pathfind.c
player_gui.c players.c rail_cmd.c rail_gui.c road_cmd.c
road_gui.c roadveh_cmd.c roadveh_gui.c saveload.c sdl.c
settings.c settings_gui.c ship_cmd.c ship_gui.c smallmap_gui.c
sound.c spritecache.c station_cmd.c station_gui.c
strings.c subsidy_gui.c texteff.c town_cmd.c town_gui.c
train_cmd.c train_gui.c tree_cmd.c ttd.c
tunnelbridge_cmd.c unmovable_cmd.c vehicle.c
viewport.c water_cmd.c widget.c window.c screenshot.c
airport.c grfspecial.c terraform_gui.c sprite.c ;
LANGFILES = english.txt swedish.txt french.txt german.txt italian.txt slovak.txt hungarian.txt norwegian.txt danish.txt czech.txt galician.txt polish.txt romanian.txt;
####################
# On UNIX we use gcc
####################
if $(UNIX) {
SDL_CONFIG_CFLAGS = `XX_SDL_CONFIG_PLACEHOLDER_XX --cflags` ;
SDL_CONFIG_LIBS = `XX_SDL_CONFIG_PLACEHOLDER_XX --libs` ;
LINKFLAGS += $(SDL_CONFIG_LIBS) ;
CC = gcc ;
CCFLAGS += -Wall -Wno-multichar -DUNIX -DWITH_SDL ;
OPTIMFLAGS = -O2 -fomit-frame-pointer ;
DEBUGFLAGS = -g ;
# also include extmidi
CFILES += extmidi.c unix.c ;
# compile in PNG support?
if $(WITH_PNG) {
CCFLAGS += -DWITH_PNG -I$(WITH_PNG) ;
LINKFLAGS += -lpng ;
}
# compile in zlib support?
if $(WITH_ZLIB) {
CCFLAGS += -DWITH_ZLIB ;
LINKFLAGS += -lz ;
}
# compile for BeOS 5.1 and higher
if $(WITH_BONE_NETWORKING) {
CCFLAGS += -DENABLE_NETWORK ;
LINKFLAGS += -lsocket -lbind ;
}
# link in BeOS MIDI and Be API libraries
if $(BEOS_MIDI) {
CCFLAGS += -DBEOS_MIDI ;
LINKFLAGS += -lbe -lmidi ;
CFILES += bemidi.cpp ;
}
}
####################
# MSVC on Win32
####################
actions ActWin32Res {
$(VISUALC)\\..\\common\\msdev98\\bin\\rc /r /i $(STDHDRS) /fo $(<) $(>)
}
rule Win32Res { ActWin32Res $(<) : $(>) ; DEPENDS $(<) : $(>) ; }
if $(TOOLSET) = VISUALC {
OPTIMFLAGS = /Oa /Os /Ow /Oy /Oi /Og /Ox /Gr /Gf /Gy /Zp4 /J /WX /W3 -DNDEBUG ;
CCFLAGS += -DWIN32 -DWIN32_EXCEPTION_TRACKER ;
CFILES += win32.c ;
LINKFLAGS += /opt:nowin98 /LIBPATH:$(VISUALC)\\lib ;
LINKLIBS = ws2_32.lib winmm.lib user32.lib gdi32.lib ;
# compile resources too
EOBJ = ttd.res ;
Win32Res ttd.res : ttd.rc ;
# png screenshots?
if $(WITH_PNG) {
CCFLAGS += -DWITH_PNG -I$(WITH_PNG) ;
LINKLIBS += libpng.lib ;
}
# zlib savegames?
if $(WITH_ZLIB) {
CCFLAGS += -DWITH_ZLIB ;
LINKLIBS += zlibstat.lib ;
}
# build release by default
RELEASE = 1 ;
}
####################
# Common
####################
rule MyObjects {
local _i _t _s ;
_t = $(OUTDIR)/$(>:S=$(SUFOBJ)) ;
OPTIM on $(_t) = $(3) ;
MkDir $(OUTDIR) ;
Depends $(_t) : $(OUTDIR) ;
for _i in $(>) {
_s = $(OUTDIR)/$(_i:S=$(SUFOBJ)) ;
Object $(_s) : $(_i) ;
# special handling for sdl.c and unix.c
if $(_i) = sdl.c || $(_i) = unix.c { CCFLAGS on $(_s) += $(SDL_CONFIG_CFLAGS) ; }
}
MainFromObjects $(OUTDIR)/$(<) : $(_t) $(EOBJ) ;
}
rule MyMain {
if $(RELEASE) {
OUTDIR = release ;
MyObjects ttd : $(>) : $(OPTIMFLAGS) ;
} else {
OUTDIR = debug ;
MyObjects ttd : $(>) : -D_DEBUG $(DEBUGFLAGS) ;
}
}
actions CompileLang {
strgen$(SLASH)strgen $(>)
}
rule LangFile {
if $(>) = lang/english.txt {
CompileLang $(<) table/strings.h : ;
DEPENDS table/string.h : $(>) ;
} else {
CompileLang $(<) : $(>) ;
}
Clean clean : $(<) ;
DEPENDS $(<) : $(>) ;
DEPENDS all : $(<) ;
DEPENDS $(<) : strgen/strgen ;
}
rule LangFiles {
local _i ;
for _i in $(<) { LangFile $(_i:S=.lng) : $(_i) ; }
Clean clean : table/strings.h ;
}
LangFiles lang/$(LANGFILES) ;
Main strgen/strgen : strgen/strgen.c ;
MyMain ttd : $(CFILES) ;
|