Subversion Repositories eduke32

Rev

Rev 8734 | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 8734 Rev 8752
1
#
1
#
2
# EDuke32 Makefile for GNU Make
2
# EDuke32 Makefile for GNU Make
3
#
3
#
4
4
5
### Global Profiles
5
### Global Profiles
6
ifeq ($(FURY),1)
6
ifeq ($(FURY),1)
7
    APPBASENAME := fury
7
    APPBASENAME := fury
8
    APPNAME := Ion Fury
8
    APPNAME := Ion Fury
9
    NETCODE := 0
9
    NETCODE := 0
10
    POLYMER := 0
10
    POLYMER := 0
11
    RETAIL_MENU := 1
11
    RETAIL_MENU := 1
12
    STANDALONE := 1
12
    STANDALONE := 1
13
    USE_LIBVPX := 0
13
    USE_LIBVPX := 0
14
endif
14
endif
15
15
16
### Platform and Toolchain Configuration
16
### Platform and Toolchain Configuration
17
include Common.mak
17
include Common.mak
18
18
19
### File Extensions
19
### File Extensions
20
asm := nasm
20
asm := nasm
21
o := o
21
o := o
22
22
23
### Directories
23
### Directories
24
source := source
24
source := source
25
obj := obj
25
obj := obj
26
26
27
### Functions
27
### Functions
28
define parent
28
define parent
29
$(word 1,$(subst _, ,$1))
29
$(word 1,$(subst _, ,$1))
30
endef
30
endef
31
define expandobjs
31
define expandobjs
32
$$(addprefix $$($$(call parent,$1)_obj)/,$$(addsuffix .$$o,$$(basename $$($1_objs) $$($1_rsrc_objs) $$($1_gen_objs))))
32
$$(addprefix $$($$(call parent,$1)_obj)/,$$(addsuffix .$$o,$$(basename $$($1_objs) $$($1_rsrc_objs) $$($1_gen_objs))))
33
endef
33
endef
34
define expandsrcs
34
define expandsrcs
35
$(addprefix $($(call parent,$1)_src)/,$($1_objs)) $(addprefix $($(call parent,$1)_rsrc)/,$($1_rsrc_objs)) $(addprefix $($(call parent,$1)_obj)/,$($1_gen_objs))
35
$(addprefix $($(call parent,$1)_src)/,$($1_objs)) $(addprefix $($(call parent,$1)_rsrc)/,$($1_rsrc_objs)) $(addprefix $($(call parent,$1)_obj)/,$($1_gen_objs))
36
endef
36
endef
37
define expanddeps
37
define expanddeps
38
$(strip $1 $(foreach j,$1,$(call $0,$($j_deps))))
38
$(strip $1 $(foreach j,$1,$(call $0,$($j_deps))))
39
endef
39
endef
40
define getdeps
40
define getdeps
41
$(call expanddeps,$1_$2 $(common_$2_deps) engine)
41
$(call expanddeps,$1_$2 $(common_$2_deps) engine)
42
endef
42
endef
43
43
44
44
45
##### External Library Definitions
45
##### External Library Definitions
46
46
47
#### libxmp-lite
47
#### libxmp-lite
48
48
49
libxmplite := libxmp-lite
49
libxmplite := libxmp-lite
50
50
51
libxmplite_objs := \
51
libxmplite_objs := \
52
    common.c \
52
    common.c \
53
    control.c \
53
    control.c \
54
    dataio.c \
54
    dataio.c \
55
    effects.c \
55
    effects.c \
56
    filter.c \
56
    filter.c \
57
    format.c \
57
    format.c \
58
    hio.c \
58
    hio.c \
59
    it_load.c \
59
    it_load.c \
60
    itsex.c \
60
    itsex.c \
61
    lfo.c \
61
    lfo.c \
62
    load.c \
62
    load.c \
63
    load_helpers.c \
63
    load_helpers.c \
64
    memio.c \
64
    memio.c \
65
    mix_all.c \
65
    mix_all.c \
66
    mixer.c \
66
    mixer.c \
67
    mod_load.c \
67
    mod_load.c \
68
    mtm_load.c \
68
    mtm_load.c \
69
    period.c \
69
    period.c \
70
    player.c \
70
    player.c \
71
    read_event.c \
71
    read_event.c \
72
    s3m_load.c \
72
    s3m_load.c \
73
    sample.c \
73
    sample.c \
74
    scan.c \
74
    scan.c \
75
    smix.c \
75
    smix.c \
76
    virtual.c \
76
    virtual.c \
77
    win32.c \
77
    win32.c \
78
    xm_load.c \
78
    xm_load.c \
79
79
80
libxmplite_root := $(source)/$(libxmplite)
80
libxmplite_root := $(source)/$(libxmplite)
81
libxmplite_src := $(libxmplite_root)/src
81
libxmplite_src := $(libxmplite_root)/src
82
libxmplite_inc := $(libxmplite_root)/include
82
libxmplite_inc := $(libxmplite_root)/include
83
libxmplite_obj := $(obj)/$(libxmplite)
83
libxmplite_obj := $(obj)/$(libxmplite)
84
84
85
libxmplite_cflags := -DHAVE_ROUND -DLIBXMP_CORE_PLAYER -DBUILDING_STATIC -I$(libxmplite_inc)/libxmp-lite -Wno-unused-parameter -Wno-sign-compare
85
libxmplite_cflags := -DHAVE_ROUND -DLIBXMP_CORE_PLAYER -DBUILDING_STATIC -I$(libxmplite_inc)/libxmp-lite -Wno-unused-parameter -Wno-sign-compare
86
86
87
87
88
#### LPeg
88
#### LPeg
89
89
90
lpeg := lpeg
90
lpeg := lpeg
91
91
92
lpeg_objs := \
92
lpeg_objs := \
93
    lpcap.c \
93
    lpcap.c \
94
    lpcode.c \
94
    lpcode.c \
95
    lpprint.c \
95
    lpprint.c \
96
    lptree.c \
96
    lptree.c \
97
    lpvm.c \
97
    lpvm.c \
98
98
99
lpeg_root := $(source)/$(lpeg)
99
lpeg_root := $(source)/$(lpeg)
100
lpeg_src := $(lpeg_root)/src
100
lpeg_src := $(lpeg_root)/src
101
lpeg_inc := $(lpeg_root)/include
101
lpeg_inc := $(lpeg_root)/include
102
lpeg_obj := $(obj)/$(lpeg)
102
lpeg_obj := $(obj)/$(lpeg)
103
103
104
104
105
#### PhysicsFS
105
#### PhysicsFS
106
106
107
physfs := physfs
107
physfs := physfs
108
108
109
physfs_objs := \
109
physfs_objs := \
110
    physfs.c \
110
    physfs.c \
111
    physfs_archiver_7z.c \
111
    physfs_archiver_7z.c \
112
    physfs_archiver_dir.c \
112
    physfs_archiver_dir.c \
113
    physfs_archiver_grp.c \
113
    physfs_archiver_grp.c \
114
    physfs_archiver_hog.c \
114
    physfs_archiver_hog.c \
115
    physfs_archiver_iso9660.c \
115
    physfs_archiver_iso9660.c \
116
    physfs_archiver_mvl.c \
116
    physfs_archiver_mvl.c \
117
    physfs_archiver_qpak.c \
117
    physfs_archiver_qpak.c \
118
    physfs_archiver_slb.c \
118
    physfs_archiver_slb.c \
119
    physfs_archiver_unpacked.c \
119
    physfs_archiver_unpacked.c \
120
    physfs_archiver_vdf.c \
120
    physfs_archiver_vdf.c \
121
    physfs_archiver_wad.c \
121
    physfs_archiver_wad.c \
122
    physfs_archiver_zip.c \
122
    physfs_archiver_zip.c \
123
    physfs_byteorder.c \
123
    physfs_byteorder.c \
124
    physfs_unicode.c \
124
    physfs_unicode.c \
125
125
126
ifeq ($(PLATFORM),APPLE)
126
ifeq ($(PLATFORM),APPLE)
127
    physfs_objs += physfs_platform_apple.m
127
    physfs_objs += physfs_platform_apple.m
128
else ifeq ($(PLATFORM),WINDOWS)
128
else ifeq ($(PLATFORM),WINDOWS)
129
    physfs_objs += physfs_platform_windows.c
129
    physfs_objs += physfs_platform_windows.c
130
else
130
else
131
    physfs_objs += physfs_platform_unix.c
131
    physfs_objs += physfs_platform_unix.c
132
endif
132
endif
133
133
134
physfs_root := $(source)/$(physfs)
134
physfs_root := $(source)/$(physfs)
135
physfs_src := $(physfs_root)/src
135
physfs_src := $(physfs_root)/src
136
physfs_inc := $(physfs_root)/include
136
physfs_inc := $(physfs_root)/include
137
physfs_obj := $(obj)/$(physfs)
137
physfs_obj := $(obj)/$(physfs)
138
138
139
physfs_cflags :=
139
physfs_cflags :=
140
140
141
141
142
#### glad
142
#### glad
143
143
144
glad := glad
144
glad := glad
145
145
146
glad_objs := \
146
glad_objs := \
147
    glad.c \
147
    glad.c \
148
148
149
glad_root := $(source)/$(glad)
149
glad_root := $(source)/$(glad)
150
glad_src := $(glad_root)/src
150
glad_src := $(glad_root)/src
151
glad_inc := $(glad_root)/include
151
glad_inc := $(glad_root)/include
152
glad_obj := $(obj)/$(glad)
152
glad_obj := $(obj)/$(glad)
153
153
154
glad_cflags :=
154
glad_cflags :=
155
155
156
ifeq ($(RENDERTYPE),WIN)
156
ifeq ($(RENDERTYPE),WIN)
157
    glad_objs += glad_wgl.c
157
    glad_objs += glad_wgl.c
158
endif
158
endif
159
159
160
#### Voidwrap
160
#### Voidwrap
161
161
162
voidwrap := voidwrap
162
voidwrap := voidwrap
163
163
164
voidwrap_objs := \
164
voidwrap_objs := \
165
    voidwrap_steam.cpp
165
    voidwrap_steam.cpp
166
166
167
voidwrap_root := $(source)/$(voidwrap)
167
voidwrap_root := $(source)/$(voidwrap)
168
voidwrap_src := $(voidwrap_root)/src
168
voidwrap_src := $(voidwrap_root)/src
169
voidwrap_inc := $(voidwrap_root)/include
169
voidwrap_inc := $(voidwrap_root)/include
170
voidwrap_obj := $(obj)/$(voidwrap)
170
voidwrap_obj := $(obj)/$(voidwrap)
171
171
172
ifeq ($(IMPLICIT_ARCH),x86_64)
172
ifeq ($(IMPLICIT_ARCH),x86_64)
173
    ifeq ($(PLATFORM),WINDOWS)
173
    ifeq ($(PLATFORM),WINDOWS)
174
        voidwrap_lib := voidwrap_steam_x64.dll
174
        voidwrap_lib := voidwrap_steam_x64.dll
175
        steamworks_lib := win64/steam_api64.dll
175
        steamworks_lib := win64/steam_api64.dll
176
    else
176
    else
177
        voidwrap_lib := libvoidwrap_steam.so
177
        voidwrap_lib := libvoidwrap_steam.so
178
        steamworks_lib := linux64/libsteam_api.so
178
        steamworks_lib := linux64/libsteam_api.so
179
    endif
179
    endif
180
else
180
else
181
    ifeq ($(PLATFORM),WINDOWS)
181
    ifeq ($(PLATFORM),WINDOWS)
182
        voidwrap_lib := voidwrap_steam_x86.dll
182
        voidwrap_lib := voidwrap_steam_x86.dll
183
        steamworks_lib := steam_api.dll
183
        steamworks_lib := steam_api.dll
184
    else
184
    else
185
        voidwrap_lib := libvoidwrap_steam.so
185
        voidwrap_lib := libvoidwrap_steam.so
186
        steamworks_lib := linux32/libsteam_api.so
186
        steamworks_lib := linux32/libsteam_api.so
187
    endif
187
    endif
188
endif
188
endif
189
189
190
voidwrap_cflags := -I$(voidwrap_root)/sdk/public/steam -fPIC -fvisibility=hidden -Wno-invalid-offsetof
190
voidwrap_cflags := -I$(voidwrap_root)/sdk/public/steam -fPIC -fvisibility=hidden -Wno-invalid-offsetof
191
191
192
192
193
##### Component Definitions
193
##### Component Definitions
194
194
195
#### EBacktrace
195
#### EBacktrace
196
196
197
ifndef ebacktrace_dll
197
ifndef ebacktrace_dll
198
    ebacktrace_dll := ebacktrace1.dll
198
    ebacktrace_dll := ebacktrace1.dll
199
    ifeq ($(findstring x86_64,$(COMPILERTARGET)),x86_64)
199
    ifeq ($(findstring x86_64,$(COMPILERTARGET)),x86_64)
200
        ebacktrace_dll := ebacktrace1-64.dll
200
        ebacktrace_dll := ebacktrace1-64.dll
201
    endif
201
    endif
202
endif
202
endif
203
203
204
204
205
#### BUILD Engine
205
#### BUILD Engine
206
206
207
engine := build
207
engine := build
208
208
209
engine_root := $(source)/$(engine)
209
engine_root := $(source)/$(engine)
210
engine_src := $(engine_root)/src
210
engine_src := $(engine_root)/src
211
engine_inc := $(engine_root)/include
211
engine_inc := $(engine_root)/include
212
engine_obj := $(obj)/$(engine)
212
engine_obj := $(obj)/$(engine)
213
213
214
engine_cflags := -I$(engine_src)
214
engine_cflags := -I$(engine_src)
215
215
216
engine_deps :=
216
engine_deps :=
217
217
218
ifneq (0,$(USE_PHYSFS))
218
ifneq (0,$(USE_PHYSFS))
219
    engine_deps += physfs
219
    engine_deps += physfs
220
endif
220
endif
221
221
222
engine_objs := \
222
engine_objs := \
223
    2d.cpp \
223
    2d.cpp \
224
    baselayer.cpp \
224
    baselayer.cpp \
225
    cache1d.cpp \
225
    cache1d.cpp \
226
    clip.cpp \
226
    clip.cpp \
227
    colmatch.cpp \
227
    colmatch.cpp \
228
    common.cpp \
228
    common.cpp \
229
    communityapi.cpp \
229
    communityapi.cpp \
230
    compat.cpp \
230
    compat.cpp \
231
    cpuid.cpp \
231
    cpuid.cpp \
232
    crc32.cpp \
232
    crc32.cpp \
233
    defs.cpp \
233
    defs.cpp \
234
    dxtfilter.cpp \
234
    dxtfilter.cpp \
235
    enet.cpp \
235
    enet.cpp \
236
    engine.cpp \
236
    engine.cpp \
237
    fix16.cpp \
237
    fix16.cpp \
238
    hash.cpp \
238
    hash.cpp \
239
    hightile.cpp \
239
    hightile.cpp \
240
    klzw.cpp \
240
    klzw.cpp \
241
    kplib.cpp \
241
    kplib.cpp \
242
    lz4.c \
242
    lz4.c \
243
    md4.cpp \
243
    md4.cpp \
244
    mhk.cpp \
244
    mhk.cpp \
245
    miniz.c \
245
    miniz.c \
246
    miniz_tdef.c \
246
    miniz_tdef.c \
247
    miniz_tinfl.c \
247
    miniz_tinfl.c \
248
    mmulti.cpp \
248
    mmulti.cpp \
249
    mutex.cpp \
249
    mutex.cpp \
250
    osd.cpp \
250
    osd.cpp \
251
    palette.cpp \
251
    palette.cpp \
252
    pngwrite.cpp \
252
    pngwrite.cpp \
253
    polymost.cpp \
253
    polymost.cpp \
254
    polymost1Frag.glsl \
254
    polymost1Frag.glsl \
255
    polymost1Vert.glsl \
255
    polymost1Vert.glsl \
256
    pragmas.cpp \
256
    pragmas.cpp \
257
    rev.cpp \
257
    rev.cpp \
258
    screenshot.cpp \
258
    screenshot.cpp \
259
    screentext.cpp \
259
    screentext.cpp \
260
    scriptfile.cpp \
260
    scriptfile.cpp \
261
    sjson.cpp \
261
    sjson.cpp \
262
    smalltextfont.cpp \
262
    smalltextfont.cpp \
263
    softsurface.cpp \
263
    softsurface.cpp \
264
    texcache.cpp \
264
    texcache.cpp \
265
    textfont.cpp \
265
    textfont.cpp \
266
    tiles.cpp \
266
    tiles.cpp \
267
    timer.cpp \
267
    timer.cpp \
268
    vfs.cpp \
268
    vfs.cpp \
269
    xxhash.c \
269
    xxhash.c \
270
    zpl.cpp \
270
    zpl.cpp \
271
271
272
engine_editor_objs := \
272
engine_editor_objs := \
273
    build.cpp \
273
    build.cpp \
274
    config.cpp \
274
    config.cpp \
275
    defs.cpp \
275
    defs.cpp \
276
276
277
engine_tools_objs := \
277
engine_tools_objs := \
278
    colmatch.cpp \
278
    colmatch.cpp \
279
    compat.cpp \
279
    compat.cpp \
280
    crc32.cpp \
280
    crc32.cpp \
281
    klzw.cpp \
281
    klzw.cpp \
282
    kplib.cpp \
282
    kplib.cpp \
283
    lz4.cpp \
283
    lz4.cpp \
284
    pragmas.cpp \
284
    pragmas.cpp \
285
    vfs.cpp \
285
    vfs.cpp \
286
286
287
ifeq (0,$(NOASM))
287
ifeq (0,$(NOASM))
288
  engine_objs += a.nasm
288
  engine_objs += a.nasm
289
else
289
else
290
  engine_objs += a-c.cpp
290
  engine_objs += a-c.cpp
291
  ifneq (0,$(USE_ASM64))
291
  ifneq (0,$(USE_ASM64))
292
    engine_objs += a64.yasm
292
    engine_objs += a64.yasm
293
  endif
293
  endif
294
endif
294
endif
295
ifeq (1,$(USE_OPENGL))
295
ifeq (1,$(USE_OPENGL))
296
    engine_objs += glsurface.cpp voxmodel.cpp mdsprite.cpp tilepacker.cpp
296
    engine_objs += glsurface.cpp voxmodel.cpp mdsprite.cpp tilepacker.cpp
297
    engine_deps += glad
297
    engine_deps += glad
298
    ifeq (1,$(POLYMER))
298
    ifeq (1,$(POLYMER))
299
        engine_objs += glbuild.cpp polymer.cpp
299
        engine_objs += glbuild.cpp polymer.cpp
300
    endif
300
    endif
301
endif
301
endif
302
ifneq (0,$(LUNATIC))
302
ifneq (0,$(LUNATIC))
303
    engine_objs += lunatic.cpp
303
    engine_objs += lunatic.cpp
304
endif
304
endif
305
ifeq ($(PLATFORM),DARWIN)
305
ifeq ($(PLATFORM),DARWIN)
306
    engine_objs += osxbits.mm
306
    engine_objs += osxbits.mm
307
    engine_tools_objs += osxbits.mm
307
    engine_tools_objs += osxbits.mm
308
    ifeq ($(STARTUP_WINDOW),1)
308
    ifeq ($(STARTUP_WINDOW),1)
309
        engine_editor_objs += startosx.editor.mm
309
        engine_editor_objs += startosx.editor.mm
310
    endif
310
    endif
311
    ifeq ($(SDL_TARGET),1)
311
    ifeq ($(SDL_TARGET),1)
312
        ifneq ($(SDL_FRAMEWORK),0)
312
        ifneq ($(SDL_FRAMEWORK),0)
313
            engine_objs += SDLMain.mm
313
            engine_objs += SDLMain.mm
314
        endif
314
        endif
315
    endif
315
    endif
316
endif
316
endif
317
ifeq ($(PLATFORM),WINDOWS)
317
ifeq ($(PLATFORM),WINDOWS)
318
    engine_objs += winbits.cpp
318
    engine_objs += winbits.cpp
319
    ifeq ($(STARTUP_WINDOW),1)
319
    ifeq ($(STARTUP_WINDOW),1)
320
        engine_editor_objs += startwin.editor.cpp
320
        engine_editor_objs += startwin.editor.cpp
321
    endif
321
    endif
322
endif
322
endif
323
ifeq ($(PLATFORM),WII)
323
ifeq ($(PLATFORM),WII)
324
    engine_objs += wiibits.cpp
324
    engine_objs += wiibits.cpp
325
    LINKERFLAGS += -Wl,-wrap,c_default_exceptionhandler
325
    LINKERFLAGS += -Wl,-wrap,c_default_exceptionhandler
326
endif
326
endif
327
ifeq ($(RENDERTYPE),SDL)
327
ifeq ($(RENDERTYPE),SDL)
328
    engine_objs += sdlayer.cpp
328
    engine_objs += sdlayer.cpp
329
329
330
    ifeq (1,$(HAVE_GTK2))
330
    ifeq (1,$(HAVE_GTK2))
331
        engine_objs += gtkbits.cpp dynamicgtk.cpp
331
        engine_objs += gtkbits.cpp dynamicgtk.cpp
332
        ifeq ($(STARTUP_WINDOW),1)
332
        ifeq ($(STARTUP_WINDOW),1)
333
            engine_editor_objs += startgtk.editor.cpp
333
            engine_editor_objs += startgtk.editor.cpp
334
        endif
334
        endif
335
    endif
335
    endif
336
endif
336
endif
337
ifeq ($(RENDERTYPE),WIN)
337
ifeq ($(RENDERTYPE),WIN)
338
    engine_objs += winlayer.cpp rawinput.cpp
338
    engine_objs += winlayer.cpp rawinput.cpp
339
endif
339
endif
340
340
341
ifneq ($(USE_LIBVPX),0)
341
ifneq ($(USE_LIBVPX),0)
342
    engine_objs += animvpx.cpp
342
    engine_objs += animvpx.cpp
343
endif
343
endif
344
344
345
345
346
#### mact
346
#### mact
347
347
348
mact := mact
348
mact := mact
349
349
350
mact_root := $(source)/$(mact)
350
mact_root := $(source)/$(mact)
351
mact_src := $(mact_root)/src
351
mact_src := $(mact_root)/src
352
mact_inc := $(mact_root)/include
352
mact_inc := $(mact_root)/include
353
mact_obj := $(obj)/$(mact)
353
mact_obj := $(obj)/$(mact)
354
354
355
mact_objs := \
355
mact_objs := \
356
    animlib.cpp \
356
    animlib.cpp \
357
    control.cpp \
357
    control.cpp \
358
    joystick.cpp \
358
    joystick.cpp \
359
    keyboard.cpp \
359
    keyboard.cpp \
360
    scriplib.cpp \
360
    scriplib.cpp \
361
361
362
362
363
#### AudioLib
363
#### AudioLib
364
364
365
audiolib := audiolib
365
audiolib := audiolib
366
366
367
audiolib_objs := \
367
audiolib_objs := \
368
    driver_adlib.cpp \
368
    driver_adlib.cpp \
-
 
369
    driver_sf2.cpp \
369
    drivers.cpp \
370
    drivers.cpp \
370
    flac.cpp \
371
    flac.cpp \
371
    formats.cpp \
372
    formats.cpp \
372
    fx_man.cpp \
373
    fx_man.cpp \
373
    gmtimbre.cpp \
374
    gmtimbre.cpp \
374
    midi.cpp \
375
    midi.cpp \
375
    mix.cpp \
376
    mix.cpp \
376
    mixst.cpp \
377
    mixst.cpp \
377
    multivoc.cpp \
378
    multivoc.cpp \
378
    music.cpp \
379
    music.cpp \
379
    opl3.cpp \
380
    opl3.cpp \
380
    pitch.cpp \
381
    pitch.cpp \
381
    vorbis.cpp \
382
    vorbis.cpp \
382
    xa.cpp \
383
    xa.cpp \
383
    xmp.cpp \
384
    xmp.cpp \
384
385
385
audiolib_root := $(source)/$(audiolib)
386
audiolib_root := $(source)/$(audiolib)
386
audiolib_src := $(audiolib_root)/src
387
audiolib_src := $(audiolib_root)/src
387
audiolib_inc := $(audiolib_root)/include
388
audiolib_inc := $(audiolib_root)/include
388
audiolib_obj := $(obj)/$(audiolib)
389
audiolib_obj := $(obj)/$(audiolib)
389
390
390
audiolib_cflags :=
391
audiolib_cflags :=
391
392
392
audiolib_deps :=
393
audiolib_deps :=
393
394
394
ifeq ($(PLATFORM),WINDOWS)
395
ifeq ($(PLATFORM),WINDOWS)
395
    audiolib_objs += driver_directsound.cpp driver_winmm.cpp 
396
    audiolib_objs += driver_directsound.cpp driver_winmm.cpp 
396
endif
397
endif
397
398
398
ifeq ($(RENDERTYPE),SDL)
399
ifeq ($(RENDERTYPE),SDL)
399
    ifeq (,$(filter $(PLATFORM),DARWIN WINDOWS WII))
400
    ifeq (,$(filter $(PLATFORM),DARWIN WINDOWS WII))
400
        audiolib_cflags += `$(PKG_CONFIG) --cflags vorbis`
401
        audiolib_cflags += `$(PKG_CONFIG) --cflags vorbis`
401
    endif
402
    endif
402
    audiolib_objs += driver_sdl.cpp
403
    audiolib_objs += driver_sdl.cpp
403
endif
404
endif
404
405
405
ifneq (0,$(HAVE_XMP))
406
ifneq (0,$(HAVE_XMP))
406
    audiolib_cflags += -I$(libxmplite_inc)
407
    audiolib_cflags += -I$(libxmplite_inc)
407
    audiolib_deps += libxmplite
408
    audiolib_deps += libxmplite
408
endif
409
endif
409
410
410
411
411
#### Tools
412
#### Tools
412
413
413
tools := tools
414
tools := tools
414
415
415
tools_objs := \
416
tools_objs := \
416
    compat_tools.cpp \
417
    compat_tools.cpp \
417
418
418
tools_root := $(source)/$(tools)
419
tools_root := $(source)/$(tools)
419
tools_src := $(tools_root)/src
420
tools_src := $(tools_root)/src
420
tools_obj := $(obj)/$(tools)
421
tools_obj := $(obj)/$(tools)
421
422
422
tools_cflags := $(engine_cflags)
423
tools_cflags := $(engine_cflags)
423
424
424
tools_deps := engine_tools
425
tools_deps := engine_tools
425
426
426
tools_targets := \
427
tools_targets := \
427
    arttool \
428
    arttool \
428
    bsuite \
429
    bsuite \
429
    cacheinfo \
430
    cacheinfo \
430
    generateicon \
431
    generateicon \
431
    givedepth \
432
    givedepth \
432
    ivfrate \
433
    ivfrate \
433
    kextract \
434
    kextract \
434
    kgroup \
435
    kgroup \
435
    kmd2tool \
436
    kmd2tool \
436
    map2stl \
437
    map2stl \
437
    md2tool \
438
    md2tool \
438
    mkpalette \
439
    mkpalette \
439
    transpal \
440
    transpal \
440
    unpackssi \
441
    unpackssi \
441
    wad2art \
442
    wad2art \
442
    wad2map \
443
    wad2map \
443
444
444
ifeq ($(PLATFORM),WINDOWS)
445
ifeq ($(PLATFORM),WINDOWS)
445
    tools_targets += enumdisplay getdxdidf
446
    tools_targets += enumdisplay getdxdidf
446
endif
447
endif
447
ifeq ($(RENDERTYPE),SDL)
448
ifeq ($(RENDERTYPE),SDL)
448
    tools_targets += makesdlkeytrans
449
    tools_targets += makesdlkeytrans
449
endif
450
endif
450
451
451
452
452
#### KenBuild (Test Game)
453
#### KenBuild (Test Game)
453
454
454
kenbuild := kenbuild
455
kenbuild := kenbuild
455
456
456
kenbuild_root := $(source)/$(kenbuild)
457
kenbuild_root := $(source)/$(kenbuild)
457
kenbuild_src := $(kenbuild_root)/src
458
kenbuild_src := $(kenbuild_root)/src
458
kenbuild_rsrc := $(kenbuild_root)/rsrc
459
kenbuild_rsrc := $(kenbuild_root)/rsrc
459
kenbuild_obj := $(obj)/$(kenbuild)
460
kenbuild_obj := $(obj)/$(kenbuild)
460
461
461
kenbuild_cflags := -I$(kenbuild_src)
462
kenbuild_cflags := -I$(kenbuild_src)
462
463
463
kenbuild_game := ekenbuild
464
kenbuild_game := ekenbuild
464
kenbuild_editor := ekenbuild-editor
465
kenbuild_editor := ekenbuild-editor
465
466
466
kenbuild_game_deps := audiolib
467
kenbuild_game_deps := audiolib
467
468
468
kenbuild_game_proper := EKenBuild
469
kenbuild_game_proper := EKenBuild
469
kenbuild_editor_proper := EKenBuild Editor
470
kenbuild_editor_proper := EKenBuild Editor
470
471
471
kenbuild_game_objs := \
472
kenbuild_game_objs := \
472
    common.cpp \
473
    common.cpp \
473
    config.cpp \
474
    config.cpp \
474
    kdmeng.cpp \
475
    kdmeng.cpp \
475
    game.cpp \
476
    game.cpp \
476
477
477
kenbuild_editor_objs := \
478
kenbuild_editor_objs := \
478
    bstub.cpp \
479
    bstub.cpp \
479
    common.cpp \
480
    common.cpp \
480
481
481
kenbuild_game_rsrc_objs :=
482
kenbuild_game_rsrc_objs :=
482
kenbuild_editor_rsrc_objs :=
483
kenbuild_editor_rsrc_objs :=
483
kenbuild_game_gen_objs :=
484
kenbuild_game_gen_objs :=
484
kenbuild_editor_rsrc_objs :=
485
kenbuild_editor_rsrc_objs :=
485
486
486
ifeq (11,$(HAVE_GTK2)$(STARTUP_WINDOW))
487
ifeq (11,$(HAVE_GTK2)$(STARTUP_WINDOW))
487
    kenbuild_game_objs += startgtk.game.cpp
488
    kenbuild_game_objs += startgtk.game.cpp
488
    kenbuild_game_gen_objs += game_banner.c
489
    kenbuild_game_gen_objs += game_banner.c
489
    kenbuild_editor_gen_objs += build_banner.c
490
    kenbuild_editor_gen_objs += build_banner.c
490
endif
491
endif
491
ifeq ($(RENDERTYPE),SDL)
492
ifeq ($(RENDERTYPE),SDL)
492
    kenbuild_game_rsrc_objs += game_icon.c
493
    kenbuild_game_rsrc_objs += game_icon.c
493
    kenbuild_editor_rsrc_objs += build_icon.c
494
    kenbuild_editor_rsrc_objs += build_icon.c
494
endif
495
endif
495
ifeq ($(PLATFORM),WINDOWS)
496
ifeq ($(PLATFORM),WINDOWS)
496
    kenbuild_game_objs += startwin.game.cpp
497
    kenbuild_game_objs += startwin.game.cpp
497
    kenbuild_game_rsrc_objs += gameres.rc
498
    kenbuild_game_rsrc_objs += gameres.rc
498
    kenbuild_editor_rsrc_objs += buildres.rc
499
    kenbuild_editor_rsrc_objs += buildres.rc
499
endif
500
endif
500
501
501
ifeq ($(PLATFORM),DARWIN)
502
ifeq ($(PLATFORM),DARWIN)
502
    ifeq ($(STARTUP_WINDOW),1)
503
    ifeq ($(STARTUP_WINDOW),1)
503
        kenbuild_game_objs += StartupWinController.game.mm
504
        kenbuild_game_objs += StartupWinController.game.mm
504
    endif
505
    endif
505
endif
506
endif
506
507
507
508
508
#### Duke Nukem 3D
509
#### Duke Nukem 3D
509
510
510
duke3d := duke3d
511
duke3d := duke3d
511
512
512
duke3d_game_ldflags :=
513
duke3d_game_ldflags :=
513
duke3d_editor_ldflags :=
514
duke3d_editor_ldflags :=
514
515
515
duke3d_game_stripflags :=
516
duke3d_game_stripflags :=
516
duke3d_editor_stripflags :=
517
duke3d_editor_stripflags :=
517
518
518
duke3d_root := $(source)/$(duke3d)
519
duke3d_root := $(source)/$(duke3d)
519
duke3d_src := $(duke3d_root)/src
520
duke3d_src := $(duke3d_root)/src
520
duke3d_rsrc := $(duke3d_root)/rsrc
521
duke3d_rsrc := $(duke3d_root)/rsrc
521
duke3d_obj := $(obj)/$(duke3d)
522
duke3d_obj := $(obj)/$(duke3d)
522
523
523
ifeq ($(FURY),1)
524
ifeq ($(FURY),1)
524
    ifeq ($(PLATFORM),WINDOWS)
525
    ifeq ($(PLATFORM),WINDOWS)
525
        duke3d_rsrc := $(duke3d_root)/rsrc/fury
526
        duke3d_rsrc := $(duke3d_root)/rsrc/fury
526
    endif
527
    endif
527
    duke3d_obj := $(obj)/fury
528
    duke3d_obj := $(obj)/fury
528
endif
529
endif
529
530
530
duke3d_cflags := -I$(duke3d_src)
531
duke3d_cflags := -I$(duke3d_src)
531
532
532
common_editor_deps := duke3d_common_editor engine_editor
533
common_editor_deps := duke3d_common_editor engine_editor
533
534
534
duke3d_game_deps := audiolib mact
535
duke3d_game_deps := audiolib mact
535
duke3d_editor_deps := audiolib
536
duke3d_editor_deps := audiolib
536
537
537
ifneq (0,$(LUNATIC))
538
ifneq (0,$(LUNATIC))
538
    duke3d_game_deps += lunatic lunatic_game lpeg
539
    duke3d_game_deps += lunatic lunatic_game lpeg
539
    duke3d_editor_deps += lunatic lunatic_editor lpeg
540
    duke3d_editor_deps += lunatic lunatic_editor lpeg
540
endif
541
endif
541
542
542
duke3d_game := eduke32
543
duke3d_game := eduke32
543
duke3d_editor := mapster32
544
duke3d_editor := mapster32
544
545
545
ifneq (,$(APPBASENAME))
546
ifneq (,$(APPBASENAME))
546
    duke3d_game := $(APPBASENAME)
547
    duke3d_game := $(APPBASENAME)
547
endif
548
endif
548
549
549
duke3d_game_proper := EDuke32
550
duke3d_game_proper := EDuke32
550
duke3d_editor_proper := Mapster32
551
duke3d_editor_proper := Mapster32
551
552
552
duke3d_common_editor_objs := \
553
duke3d_common_editor_objs := \
553
    m32common.cpp \
554
    m32common.cpp \
554
    m32def.cpp \
555
    m32def.cpp \
555
    m32exec.cpp \
556
    m32exec.cpp \
556
    m32vars.cpp \
557
    m32vars.cpp \
557
558
558
duke3d_game_objs := \
559
duke3d_game_objs := \
559
    actors.cpp \
560
    actors.cpp \
560
    anim.cpp \
561
    anim.cpp \
561
    cheats.cpp \
562
    cheats.cpp \
562
    cmdline.cpp \
563
    cmdline.cpp \
563
    common.cpp \
564
    common.cpp \
564
    config.cpp \
565
    config.cpp \
565
    demo.cpp \
566
    demo.cpp \
566
    game.cpp \
567
    game.cpp \
567
    gamedef.cpp \
568
    gamedef.cpp \
568
    gameexec.cpp \
569
    gameexec.cpp \
569
    gamestructures.cpp \
570
    gamestructures.cpp \
570
    gamevars.cpp \
571
    gamevars.cpp \
571
    global.cpp \
572
    global.cpp \
572
    grpscan.cpp \
573
    grpscan.cpp \
573
    input.cpp \
574
    input.cpp \
574
    menus.cpp \
575
    menus.cpp \
575
    namesdyn.cpp \
576
    namesdyn.cpp \
576
    network.cpp \
577
    network.cpp \
577
    osdcmds.cpp \
578
    osdcmds.cpp \
578
    osdfuncs.cpp \
579
    osdfuncs.cpp \
579
    player.cpp \
580
    player.cpp \
580
    premap.cpp \
581
    premap.cpp \
581
    rts.cpp \
582
    rts.cpp \
582
    savegame.cpp \
583
    savegame.cpp \
583
    sbar.cpp \
584
    sbar.cpp \
584
    screens.cpp \
585
    screens.cpp \
585
    sector.cpp \
586
    sector.cpp \
586
    sounds.cpp \
587
    sounds.cpp \
587
    soundsdyn.cpp \
588
    soundsdyn.cpp \
588
    text.cpp \
589
    text.cpp \
589
590
590
duke3d_editor_objs := \
591
duke3d_editor_objs := \
591
    astub.cpp \
592
    astub.cpp \
592
    common.cpp \
593
    common.cpp \
593
    grpscan.cpp \
594
    grpscan.cpp \
594
    sounds_mapster32.cpp \
595
    sounds_mapster32.cpp \
595
596
596
duke3d_game_rsrc_objs :=
597
duke3d_game_rsrc_objs :=
597
duke3d_editor_rsrc_objs :=
598
duke3d_editor_rsrc_objs :=
598
duke3d_game_gen_objs :=
599
duke3d_game_gen_objs :=
599
duke3d_editor_gen_objs :=
600
duke3d_editor_gen_objs :=
600
601
601
duke3d_game_miscdeps :=
602
duke3d_game_miscdeps :=
602
duke3d_editor_miscdeps :=
603
duke3d_editor_miscdeps :=
603
duke3d_game_orderonlydeps :=
604
duke3d_game_orderonlydeps :=
604
duke3d_editor_orderonlydeps :=
605
duke3d_editor_orderonlydeps :=
605
606
606
## Lunatic devel
607
## Lunatic devel
607
lunatic := lunatic
608
lunatic := lunatic
608
lunatic_src := $(duke3d_src)/$(lunatic)
609
lunatic_src := $(duke3d_src)/$(lunatic)
609
lunatic_obj := $(duke3d_obj)
610
lunatic_obj := $(duke3d_obj)
610
611
611
ifneq (0,$(LUNATIC))
612
ifneq (0,$(LUNATIC))
612
    COMPILERFLAGS += -I$(lunatic_src) -DLUNATIC
613
    COMPILERFLAGS += -I$(lunatic_src) -DLUNATIC
613
614
614
    # Determine size of _defs*.lua bytecode once.
615
    # Determine size of _defs*.lua bytecode once.
615
    ifndef DEFS_BC_SIZE
616
    ifndef DEFS_BC_SIZE
616
        DEFS_BC_SIZE := $(shell $(LUAJIT) -bg -t h $(lunatic_src)/_defs_game.lua -)
617
        DEFS_BC_SIZE := $(shell $(LUAJIT) -bg -t h $(lunatic_src)/_defs_game.lua -)
617
        DEFS_BC_SIZE := $(word 3, $(DEFS_BC_SIZE))
618
        DEFS_BC_SIZE := $(word 3, $(DEFS_BC_SIZE))
618
    endif
619
    endif
619
    ifndef DEFS_M32_BC_SIZE
620
    ifndef DEFS_M32_BC_SIZE
620
        DEFS_M32_BC_SIZE := $(shell $(LUAJIT) -bg -t h $(lunatic_src)/_defs_editor.lua -)
621
        DEFS_M32_BC_SIZE := $(shell $(LUAJIT) -bg -t h $(lunatic_src)/_defs_editor.lua -)
621
        DEFS_M32_BC_SIZE := $(word 3, $(DEFS_M32_BC_SIZE))
622
        DEFS_M32_BC_SIZE := $(word 3, $(DEFS_M32_BC_SIZE))
622
    endif
623
    endif
623
    duke3d_cflags += -DLUNATIC_DEFS_BC_SIZE=$(DEFS_BC_SIZE) -DLUNATIC_DEFS_M32_BC_SIZE=$(DEFS_M32_BC_SIZE)
624
    duke3d_cflags += -DLUNATIC_DEFS_BC_SIZE=$(DEFS_BC_SIZE) -DLUNATIC_DEFS_M32_BC_SIZE=$(DEFS_M32_BC_SIZE)
624
625
625
    # Lunatic object base names. These are not used in targets directly.
626
    # Lunatic object base names. These are not used in targets directly.
626
    lunatic_objs := \
627
    lunatic_objs := \
627
        defs_common.lua \
628
        defs_common.lua \
628
        engine_maptext.lua \
629
        engine_maptext.lua \
629
        engine.lua \
630
        engine.lua \
630
        bcarray.lua \
631
        bcarray.lua \
631
        bcheck.lua \
632
        bcheck.lua \
632
        bitar.lua \
633
        bitar.lua \
633
        xmath.lua \
634
        xmath.lua \
634
        v.lua \
635
        v.lua \
635
        dump.lua \
636
        dump.lua \
636
        dis_x86.lua \
637
        dis_x86.lua \
637
        dis_x64.lua \
638
        dis_x64.lua \
638
639
639
    lunatic_game_objs := \
640
    lunatic_game_objs := \
640
        lunatic_game.cpp \
641
        lunatic_game.cpp \
641
        _defs_game.lua \
642
        _defs_game.lua \
642
        con_lang.lua \
643
        con_lang.lua \
643
        lunacon.lua \
644
        lunacon.lua \
644
        randgen.lua \
645
        randgen.lua \
645
        stat.lua \
646
        stat.lua \
646
        control.lua \
647
        control.lua \
647
        lunasave.lua \
648
        lunasave.lua \
648
        fs.lua \
649
        fs.lua \
649
650
650
    lunatic_editor_objs := \
651
    lunatic_editor_objs := \
651
        lunatic_editor.cpp \
652
        lunatic_editor.cpp \
652
        _defs_editor.lua \
653
        _defs_editor.lua \
653
654
654
    # TODO: remove debugging modules from release build
655
    # TODO: remove debugging modules from release build
655
656
656
    # now, take care of having the necessary symbols (sector, wall, etc.) in the
657
    # now, take care of having the necessary symbols (sector, wall, etc.) in the
657
    # executable no matter what the debugging level
658
    # executable no matter what the debugging level
658
659
659
    ifeq ($(PLATFORM),DARWIN)
660
    ifeq ($(PLATFORM),DARWIN)
660
        # strip on OSX says: removing global symbols from a final linked no longer supported.
661
        # strip on OSX says: removing global symbols from a final linked no longer supported.
661
        #                    Use -exported_symbols_list at link time when building
662
        #                    Use -exported_symbols_list at link time when building
662
        # But, following _their_ directions does not give us the symbols! wtf?
663
        # But, following _their_ directions does not give us the symbols! wtf?
663
        # Instead of using -alias_list and -exported_symbols_list, prevent stripping them.
664
        # Instead of using -alias_list and -exported_symbols_list, prevent stripping them.
664
        duke3d_game_stripflags += -s $(duke3d_obj)/lunatic_dynsymlist_game_osx
665
        duke3d_game_stripflags += -s $(duke3d_obj)/lunatic_dynsymlist_game_osx
665
        duke3d_editor_stripflags += -s $(duke3d_obj)/lunatic_dynsymlist_editor_osx
666
        duke3d_editor_stripflags += -s $(duke3d_obj)/lunatic_dynsymlist_editor_osx
666
667
667
        duke3d_game_orderonlydeps += $(duke3d_obj)/lunatic_dynsymlist_game_osx
668
        duke3d_game_orderonlydeps += $(duke3d_obj)/lunatic_dynsymlist_game_osx
668
        duke3d_editor_orderonlydeps += $(duke3d_obj)/lunatic_dynsymlist_editor_osx
669
        duke3d_editor_orderonlydeps += $(duke3d_obj)/lunatic_dynsymlist_editor_osx
669
        LINKERFLAGS += -pagezero_size 10000 -image_base 100000000
670
        LINKERFLAGS += -pagezero_size 10000 -image_base 100000000
670
    endif
671
    endif
671
    ifeq ($(PLATFORM),WINDOWS)
672
    ifeq ($(PLATFORM),WINDOWS)
672
        override STRIP :=
673
        override STRIP :=
673
        duke3d_game_miscdeps += $(duke3d_obj)/lunatic_dynsymlist_game.def
674
        duke3d_game_miscdeps += $(duke3d_obj)/lunatic_dynsymlist_game.def
674
        duke3d_editor_miscdeps += $(duke3d_obj)/lunatic_dynsymlist_editor.def
675
        duke3d_editor_miscdeps += $(duke3d_obj)/lunatic_dynsymlist_editor.def
675
    endif
676
    endif
676
    ifeq ($(SUBPLATFORM),LINUX)
677
    ifeq ($(SUBPLATFORM),LINUX)
677
        override STRIP :=
678
        override STRIP :=
678
        duke3d_game_ldflags += -Wl,--dynamic-list=$(lunatic_src)/dynsymlist_game.lds
679
        duke3d_game_ldflags += -Wl,--dynamic-list=$(lunatic_src)/dynsymlist_game.lds
679
        duke3d_editor_ldflags += -Wl,--dynamic-list=$(lunatic_src)/dynsymlist_editor.lds
680
        duke3d_editor_ldflags += -Wl,--dynamic-list=$(lunatic_src)/dynsymlist_editor.lds
680
    endif
681
    endif
681
endif
682
endif
682
683
683
ifeq ($(SUBPLATFORM),LINUX)
684
ifeq ($(SUBPLATFORM),LINUX)
684
    LIBS += -lFLAC -lvorbisfile -lvorbis -logg
685
    LIBS += -lFLAC -lvorbisfile -lvorbis -logg
685
endif
686
endif
686
687
687
ifeq ($(PLATFORM),BSD)
688
ifeq ($(PLATFORM),BSD)
688
    LIBS += -lFLAC -lvorbisfile -lvorbis -logg -lexecinfo
689
    LIBS += -lFLAC -lvorbisfile -lvorbis -logg -lexecinfo
689
endif
690
endif
690
691
691
ifeq ($(PLATFORM),DARWIN)
692
ifeq ($(PLATFORM),DARWIN)
692
    LIBS += -lFLAC -lvorbisfile -lvorbis -logg -lm \
693
    LIBS += -lFLAC -lvorbisfile -lvorbis -logg -lm \
693
            -Wl,-framework,Cocoa -Wl,-framework,Carbon -Wl,-framework,OpenGL \
694
            -Wl,-framework,Cocoa -Wl,-framework,Carbon -Wl,-framework,OpenGL \
694
            -Wl,-framework,CoreMIDI -Wl,-framework,AudioUnit \
695
            -Wl,-framework,CoreMIDI -Wl,-framework,AudioUnit \
695
            -Wl,-framework,AudioToolbox -Wl,-framework,IOKit -Wl,-framework,AGL
696
            -Wl,-framework,AudioToolbox -Wl,-framework,IOKit -Wl,-framework,AGL
696
    ifneq (00,$(DARWIN9)$(DARWIN10))
697
    ifneq (00,$(DARWIN9)$(DARWIN10))
697
        LIBS += -Wl,-framework,QuickTime -lm
698
        LIBS += -Wl,-framework,QuickTime -lm
698
    endif
699
    endif
699
700
700
    ifeq ($(STARTUP_WINDOW),1)
701
    ifeq ($(STARTUP_WINDOW),1)
701
        duke3d_game_objs += GrpFile.game.mm GameListSource.game.mm startosx.game.mm
702
        duke3d_game_objs += GrpFile.game.mm GameListSource.game.mm startosx.game.mm
702
    endif
703
    endif
703
endif
704
endif
704
705
705
ifeq ($(PLATFORM),WINDOWS)
706
ifeq ($(PLATFORM),WINDOWS)
706
    LIBS += -lFLAC -lvorbisfile -lvorbis -logg -ldsound
707
    LIBS += -lFLAC -lvorbisfile -lvorbis -logg -ldsound
707
    duke3d_game_objs += winbits.cpp
708
    duke3d_game_objs += winbits.cpp
708
    duke3d_game_rsrc_objs += gameres.rc
709
    duke3d_game_rsrc_objs += gameres.rc
709
    duke3d_editor_rsrc_objs += buildres.rc
710
    duke3d_editor_rsrc_objs += buildres.rc
710
    ifeq ($(STARTUP_WINDOW),1)
711
    ifeq ($(STARTUP_WINDOW),1)
711
        duke3d_game_objs += startwin.game.cpp
712
        duke3d_game_objs += startwin.game.cpp
712
    endif
713
    endif
713
endif
714
endif
714
715
715
ifeq ($(PLATFORM),WII)
716
ifeq ($(PLATFORM),WII)
716
    LIBS += -lvorbisidec
717
    LIBS += -lvorbisidec
717
endif
718
endif
718
719
719
ifeq (11,$(HAVE_GTK2)$(STARTUP_WINDOW))
720
ifeq (11,$(HAVE_GTK2)$(STARTUP_WINDOW))
720
    duke3d_game_objs += startgtk.game.cpp
721
    duke3d_game_objs += startgtk.game.cpp
721
    duke3d_game_gen_objs += game_banner.c
722
    duke3d_game_gen_objs += game_banner.c
722
    duke3d_editor_gen_objs += build_banner.c
723
    duke3d_editor_gen_objs += build_banner.c
723
endif
724
endif
724
ifeq ($(RENDERTYPE),SDL)
725
ifeq ($(RENDERTYPE),SDL)
725
    duke3d_game_rsrc_objs += game_icon.c
726
    duke3d_game_rsrc_objs += game_icon.c
726
    duke3d_editor_rsrc_objs += build_icon.c
727
    duke3d_editor_rsrc_objs += build_icon.c
727
endif
728
endif
728
729
729
730
730
#### Shadow Warrior
731
#### Shadow Warrior
731
732
732
sw := sw
733
sw := sw
733
734
734
sw_root := $(source)/$(sw)
735
sw_root := $(source)/$(sw)
735
sw_src := $(sw_root)/src
736
sw_src := $(sw_root)/src
736
sw_rsrc := $(sw_root)/rsrc
737
sw_rsrc := $(sw_root)/rsrc
737
sw_obj := $(obj)/$(sw)
738
sw_obj := $(obj)/$(sw)
738
739
739
sw_cflags := -I$(sw_src)
740
sw_cflags := -I$(sw_src)
740
741
741
sw_game_deps := audiolib mact
742
sw_game_deps := audiolib mact
742
sw_editor_deps := audiolib
743
sw_editor_deps := audiolib
743
744
744
sw_game := voidsw
745
sw_game := voidsw
745
sw_editor := wangulator
746
sw_editor := wangulator
746
747
747
sw_game_proper := VoidSW
748
sw_game_proper := VoidSW
748
sw_editor_proper := Wangulator
749
sw_editor_proper := Wangulator
749
750
750
sw_game_objs := \
751
sw_game_objs := \
751
    actor.cpp \
752
    actor.cpp \
752
    ai.cpp \
753
    ai.cpp \
753
    anim.cpp \
754
    anim.cpp \
754
    border.cpp \
755
    border.cpp \
755
    break.cpp \
756
    break.cpp \
756
    bunny.cpp \
757
    bunny.cpp \
757
    cache.cpp \
758
    cache.cpp \
758
    cheats.cpp \
759
    cheats.cpp \
759
    colormap.cpp \
760
    colormap.cpp \
760
    common.cpp \
761
    common.cpp \
761
    config.cpp \
762
    config.cpp \
762
    console.cpp \
763
    console.cpp \
763
    coolg.cpp \
764
    coolg.cpp \
764
    coolie.cpp \
765
    coolie.cpp \
765
    copysect.cpp \
766
    copysect.cpp \
766
    demo.cpp \
767
    demo.cpp \
767
    draw.cpp \
768
    draw.cpp \
768
    eel.cpp \
769
    eel.cpp \
769
    game.cpp \
770
    game.cpp \
770
    girlninj.cpp \
771
    girlninj.cpp \
771
    goro.cpp \
772
    goro.cpp \
772
    grpscan.cpp \
773
    grpscan.cpp \
773
    hornet.cpp \
774
    hornet.cpp \
774
    interp.cpp \
775
    interp.cpp \
775
    interpsh.cpp \
776
    interpsh.cpp \
776
    inv.cpp \
777
    inv.cpp \
777
    jplayer.cpp \
778
    jplayer.cpp \
778
    jsector.cpp \
779
    jsector.cpp \
779
    jweapon.cpp \
780
    jweapon.cpp \
780
    lava.cpp \
781
    lava.cpp \
781
    light.cpp \
782
    light.cpp \
782
    mclip.cpp \
783
    mclip.cpp \
783
    mdastr.cpp \
784
    mdastr.cpp \
784
    menus.cpp \
785
    menus.cpp \
785
    miscactr.cpp \
786
    miscactr.cpp \
786
    morph.cpp \
787
    morph.cpp \
787
    network.cpp \
788
    network.cpp \
788
    ninja.cpp \
789
    ninja.cpp \
789
    panel.cpp \
790
    panel.cpp \
790
    player.cpp \
791
    player.cpp \
791
    predict.cpp \
792
    predict.cpp \
792
    quake.cpp \
793
    quake.cpp \
793
    ripper.cpp \
794
    ripper.cpp \
794
    ripper2.cpp \
795
    ripper2.cpp \
795
    rooms.cpp \
796
    rooms.cpp \
796
    rotator.cpp \
797
    rotator.cpp \
797
    rts.cpp \
798
    rts.cpp \
798
    save.cpp \
799
    save.cpp \
799
    saveable.cpp \
800
    saveable.cpp \
800
    scrip2.cpp \
801
    scrip2.cpp \
801
    sector.cpp \
802
    sector.cpp \
802
    serp.cpp \
803
    serp.cpp \
803
    setup.cpp \
804
    setup.cpp \
804
    skel.cpp \
805
    skel.cpp \
805
    skull.cpp \
806
    skull.cpp \
806
    slidor.cpp \
807
    slidor.cpp \
807
    sounds.cpp \
808
    sounds.cpp \
808
    spike.cpp \
809
    spike.cpp \
809
    sprite.cpp \
810
    sprite.cpp \
810
    sumo.cpp \
811
    sumo.cpp \
811
    swconfig.cpp \
812
    swconfig.cpp \
812
    sync.cpp \
813
    sync.cpp \
813
    text.cpp \
814
    text.cpp \
814
    track.cpp \
815
    track.cpp \
815
    vator.cpp \
816
    vator.cpp \
816
    vis.cpp \
817
    vis.cpp \
817
    wallmove.cpp \
818
    wallmove.cpp \
818
    warp.cpp \
819
    warp.cpp \
819
    weapon.cpp \
820
    weapon.cpp \
820
    zilla.cpp \
821
    zilla.cpp \
821
    zombie.cpp \
822
    zombie.cpp \
822
823
823
sw_editor_objs := \
824
sw_editor_objs := \
824
    bldscript.cpp \
825
    bldscript.cpp \
825
    brooms.cpp \
826
    brooms.cpp \
826
    colormap.cpp \
827
    colormap.cpp \
827
    common.cpp \
828
    common.cpp \
828
    grpscan.cpp \
829
    grpscan.cpp \
829
    jbhlp.cpp \
830
    jbhlp.cpp \
830
    jnstub.cpp \
831
    jnstub.cpp \
831
832
832
sw_game_rsrc_objs :=
833
sw_game_rsrc_objs :=
833
sw_editor_rsrc_objs :=
834
sw_editor_rsrc_objs :=
834
sw_game_gen_objs :=
835
sw_game_gen_objs :=
835
sw_editor_gen_objs :=
836
sw_editor_gen_objs :=
836
837
837
ifeq (11,$(HAVE_GTK2)$(STARTUP_WINDOW))
838
ifeq (11,$(HAVE_GTK2)$(STARTUP_WINDOW))
838
    sw_game_objs += startgtk.game.cpp
839
    sw_game_objs += startgtk.game.cpp
839
    sw_game_gen_objs += game_banner.c
840
    sw_game_gen_objs += game_banner.c
840
    sw_editor_gen_objs += build_banner.c
841
    sw_editor_gen_objs += build_banner.c
841
endif
842
endif
842
ifeq ($(RENDERTYPE),SDL)
843
ifeq ($(RENDERTYPE),SDL)
843
    sw_game_rsrc_objs += game_icon.c
844
    sw_game_rsrc_objs += game_icon.c
844
    sw_editor_rsrc_objs += game_icon.c
845
    sw_editor_rsrc_objs += game_icon.c
845
endif
846
endif
846
ifeq ($(PLATFORM),WINDOWS)
847
ifeq ($(PLATFORM),WINDOWS)
847
    sw_game_objs += startwin.game.cpp
848
    sw_game_objs += startwin.game.cpp
848
    sw_game_rsrc_objs += gameres.rc
849
    sw_game_rsrc_objs += gameres.rc
849
    sw_editor_rsrc_objs += buildres.rc
850
    sw_editor_rsrc_objs += buildres.rc
850
endif
851
endif
851
ifeq ($(PLATFORM),DARWIN)
852
ifeq ($(PLATFORM),DARWIN)
852
    ifeq ($(STARTUP_WINDOW),1)
853
    ifeq ($(STARTUP_WINDOW),1)
853
        sw_game_objs += GrpFile.game.mm GameListSource.game.mm StartupWinController.game.mm
854
        sw_game_objs += GrpFile.game.mm GameListSource.game.mm StartupWinController.game.mm
854
    endif
855
    endif
855
endif
856
endif
856
857
857
858
858
#### Final setup
859
#### Final setup
859
860
860
COMPILERFLAGS += \
861
COMPILERFLAGS += \
861
    -I$(engine_inc) \
862
    -I$(engine_inc) \
862
    -I$(mact_inc) \
863
    -I$(mact_inc) \
863
    -I$(audiolib_inc) \
864
    -I$(audiolib_inc) \
864
    -I$(glad_inc) \
865
    -I$(glad_inc) \
865
    -I$(voidwrap_inc) \
866
    -I$(voidwrap_inc) \
866
    -MP -MMD \
867
    -MP -MMD \
867
868
868
ifneq (0,$(USE_PHYSFS))
869
ifneq (0,$(USE_PHYSFS))
869
    COMPILERFLAGS += -I$(physfs_inc) -DUSE_PHYSFS
870
    COMPILERFLAGS += -I$(physfs_inc) -DUSE_PHYSFS
870
endif
871
endif
871
872
872
873
873
##### Recipes
874
##### Recipes
874
875
875
games := \
876
games := \
876
    duke3d \
877
    duke3d \
877
    kenbuild \
878
    kenbuild \
878
    sw \
879
    sw \
879
880
880
libraries := \
881
libraries := \
881
    audiolib \
882
    audiolib \
882
    engine \
883
    engine \
883
    glad \
884
    glad \
884
    libxmplite \
885
    libxmplite \
885
    lpeg \
886
    lpeg \
886
    mact \
887
    mact \
887
    voidwrap \
888
    voidwrap \
888
889
889
ifneq (0,$(USE_PHYSFS))
890
ifneq (0,$(USE_PHYSFS))
890
    libraries += physfs
891
    libraries += physfs
891
endif
892
endif
892
893
893
components := \
894
components := \
894
    $(games) \
895
    $(games) \
895
    $(libraries) \
896
    $(libraries) \
896
    tools \
897
    tools \
897
898
898
roles := \
899
roles := \
899
    game \
900
    game \
900
    editor \
901
    editor \
901
902
902
903
903
ifeq ($(PRETTY_OUTPUT),1)
904
ifeq ($(PRETTY_OUTPUT),1)
904
.SILENT:
905
.SILENT:
905
endif
906
endif
906
.PHONY: \
907
.PHONY: \
907
    $(addprefix clean,$(games) test utils tools) \
908
    $(addprefix clean,$(games) test utils tools) \
908
    $(engine_obj)/rev.$o \
909
    $(engine_obj)/rev.$o \
909
    all \
910
    all \
910
    clang-tools \
911
    clang-tools \
911
    clean \
912
    clean \
912
    printtools \
913
    printtools \
913
    printutils \
914
    printutils \
914
    rev \
915
    rev \
915
    start \
916
    start \
916
    veryclean \
917
    veryclean \
917
918
918
.SUFFIXES:
919
.SUFFIXES:
919
.SECONDEXPANSION:
920
.SECONDEXPANSION:
920
921
921
922
922
#### Targets
923
#### Targets
923
924
924
all: duke3d
925
all: duke3d
925
926
926
start:
927
start:
927
	$(BUILD_STARTED)
928
	$(BUILD_STARTED)
928
929
929
tools: $(addsuffix $(EXESUFFIX),$(tools_targets)) | start
930
tools: $(addsuffix $(EXESUFFIX),$(tools_targets)) | start
930
	@$(call LL,$^)
931
	@$(call LL,$^)
931
932
932
$(games): $$(foreach i,$(roles),$$($$@_$$i)$(EXESUFFIX)) | start
933
$(games): $$(foreach i,$(roles),$$($$@_$$i)$(EXESUFFIX)) | start
933
	@$(call LL,$^)
934
	@$(call LL,$^)
934
935
935
ebacktrace: $(ebacktrace_dll) | start
936
ebacktrace: $(ebacktrace_dll) | start
936
	@$(call LL,$^)
937
	@$(call LL,$^)
937
938
938
ifeq ($(PLATFORM),WII)
939
ifeq ($(PLATFORM),WII)
939
ifneq ($(ELF2DOL),)
940
ifneq ($(ELF2DOL),)
940
%$(DOLSUFFIX): %$(EXESUFFIX)
941
%$(DOLSUFFIX): %$(EXESUFFIX)
941
endif
942
endif
942
endif
943
endif
943
944
944
945
945
define BUILDRULE
946
define BUILDRULE
946
947
947
$$($1_$2)$$(EXESUFFIX): $$(foreach i,$(call getdeps,$1,$2),$$(call expandobjs,$$i)) $$($1_$2_miscdeps) | $$($1_$2_orderonlydeps)
948
$$($1_$2)$$(EXESUFFIX): $$(foreach i,$(call getdeps,$1,$2),$$(call expandobjs,$$i)) $$($1_$2_miscdeps) | $$($1_$2_orderonlydeps)
948
	$$(LINK_STATUS)
949
	$$(LINK_STATUS)
949
	$$(RECIPE_IF) $$(LINKER) -o $$@ $$^ $$(GUI_LIBS) $$($1_$2_ldflags) $$(LIBDIRS) $$(LIBS) $$(RECIPE_RESULT_LINK)
950
	$$(RECIPE_IF) $$(LINKER) -o $$@ $$^ $$(GUI_LIBS) $$($1_$2_ldflags) $$(LIBDIRS) $$(LIBS) $$(RECIPE_RESULT_LINK)
950
ifeq ($$(PLATFORM),WII)
951
ifeq ($$(PLATFORM),WII)
951
ifneq ($$(ELF2DOL),)
952
ifneq ($$(ELF2DOL),)
952
	$$(ELF2DOL) $$@ $$($1_$2)$$(DOLSUFFIX)
953
	$$(ELF2DOL) $$@ $$($1_$2)$$(DOLSUFFIX)
953
endif
954
endif
954
endif
955
endif
955
ifneq ($$(STRIP),)
956
ifneq ($$(STRIP),)
956
	$$(STRIP) $$@ $$($1_$2_stripflags)
957
	$$(STRIP) $$@ $$($1_$2_stripflags)
957
endif
958
endif
958
ifeq ($$(PLATFORM),DARWIN)
959
ifeq ($$(PLATFORM),DARWIN)
959
	cp -RPf "platform/Apple/bundles/$$($1_$2_proper).app" "./"
960
	cp -RPf "platform/Apple/bundles/$$($1_$2_proper).app" "./"
960
	$(call MKDIR,"$$($1_$2_proper).app/Contents/MacOS")
961
	$(call MKDIR,"$$($1_$2_proper).app/Contents/MacOS")
961
	cp -f "$$($1_$2)$$(EXESUFFIX)" "$$($1_$2_proper).app/Contents/MacOS/"
962
	cp -f "$$($1_$2)$$(EXESUFFIX)" "$$($1_$2_proper).app/Contents/MacOS/"
962
endif
963
endif
963
964
964
endef
965
endef
965
966
966
$(foreach i,$(games),$(foreach j,$(roles),$(eval $(call BUILDRULE,$i,$j))))
967
$(foreach i,$(games),$(foreach j,$(roles),$(eval $(call BUILDRULE,$i,$j))))
967
968
968
969
969
#### Rules
970
#### Rules
970
971
971
$(ebacktrace_dll): platform/Windows/src/backtrace.c
972
$(ebacktrace_dll): platform/Windows/src/backtrace.c
972
	$(COMPILE_STATUS)
973
	$(COMPILE_STATUS)
973
	$(RECIPE_IF) $(CC) $(CONLYFLAGS) -O2 -ggdb -shared -Wall -Wextra -static-libgcc -I$(engine_inc) -o $@ $^ -lbfd -liberty -limagehlp $(RECIPE_RESULT_COMPILE)
974
	$(RECIPE_IF) $(CC) $(CONLYFLAGS) -O2 -ggdb -shared -Wall -Wextra -static-libgcc -I$(engine_inc) -o $@ $^ -lbfd -liberty -limagehlp $(RECIPE_RESULT_COMPILE)
974
975
975
libklzw$(DLLSUFFIX): $(engine_src)/klzw.cpp
976
libklzw$(DLLSUFFIX): $(engine_src)/klzw.cpp
976
	$(COMPILE_STATUS)
977
	$(COMPILE_STATUS)
977
	$(RECIPE_IF) $(COMPILER_C) -shared -fPIC $< -o $@ $(RECIPE_RESULT_COMPILE)
978
	$(RECIPE_IF) $(COMPILER_C) -shared -fPIC $< -o $@ $(RECIPE_RESULT_COMPILE)
978
979
979
# to debug the tools link phase, make a copy of this rule explicitly replacing % with the name of a tool, such as kextract
980
# to debug the tools link phase, make a copy of this rule explicitly replacing % with the name of a tool, such as kextract
980
%$(EXESUFFIX): $(tools_obj)/%.$o $(foreach i,tools $(tools_deps),$(call expandobjs,$i))
981
%$(EXESUFFIX): $(tools_obj)/%.$o $(foreach i,tools $(tools_deps),$(call expandobjs,$i))
981
	$(LINK_STATUS)
982
	$(LINK_STATUS)
982
	$(RECIPE_IF) $(LINKER) -o $@ $^ $(LIBDIRS) $(LIBS) $(RECIPE_RESULT_LINK)
983
	$(RECIPE_IF) $(LINKER) -o $@ $^ $(LIBDIRS) $(LIBS) $(RECIPE_RESULT_LINK)
983
984
984
enumdisplay$(EXESUFFIX): $(tools_obj)/enumdisplay.$o
985
enumdisplay$(EXESUFFIX): $(tools_obj)/enumdisplay.$o
985
	$(LINK_STATUS)
986
	$(LINK_STATUS)
986
	$(RECIPE_IF) $(LINKER) -o $@ $^ $(LIBDIRS) $(LIBS) -lgdi32 $(RECIPE_RESULT_LINK)
987
	$(RECIPE_IF) $(LINKER) -o $@ $^ $(LIBDIRS) $(LIBS) -lgdi32 $(RECIPE_RESULT_LINK)
987
getdxdidf$(EXESUFFIX): $(tools_obj)/getdxdidf.$o
988
getdxdidf$(EXESUFFIX): $(tools_obj)/getdxdidf.$o
988
	$(LINK_STATUS)
989
	$(LINK_STATUS)
989
	$(RECIPE_IF) $(LINKER) -o $@ $^ $(LIBDIRS) $(LIBS) -ldinput $(RECIPE_RESULT_LINK)
990
	$(RECIPE_IF) $(LINKER) -o $@ $^ $(LIBDIRS) $(LIBS) -ldinput $(RECIPE_RESULT_LINK)
990
991
991
992
992
### Voidwrap
993
### Voidwrap
993
994
994
$(voidwrap_lib): $(foreach i,$(voidwrap),$(call expandobjs,$i))
995
$(voidwrap_lib): $(foreach i,$(voidwrap),$(call expandobjs,$i))
995
	$(LINK_STATUS)
996
	$(LINK_STATUS)
996
	$(RECIPE_IF) $(LINKER) -shared -Wl,-soname,$@ -o $@ $^ $(LIBDIRS) $(voidwrap_root)/sdk/redistributable_bin/$(steamworks_lib) $(RECIPE_RESULT_LINK)
997
	$(RECIPE_IF) $(LINKER) -shared -Wl,-soname,$@ -o $@ $^ $(LIBDIRS) $(voidwrap_root)/sdk/redistributable_bin/$(steamworks_lib) $(RECIPE_RESULT_LINK)
997
998
998
999
999
### Lunatic
1000
### Lunatic
1000
1001
1001
# Create object files directly with luajit
1002
# Create object files directly with luajit
1002
$(duke3d_obj)/%.$o: $(lunatic_src)/%.lua | $(duke3d_obj)
1003
$(duke3d_obj)/%.$o: $(lunatic_src)/%.lua | $(duke3d_obj)
1003
	$(COMPILE_STATUS)
1004
	$(COMPILE_STATUS)
1004
	$(RECIPE_IF) $(LUAJIT) -bg $(LUAJIT_BCOPTS) $< $@ $(RECIPE_RESULT_COMPILE)
1005
	$(RECIPE_IF) $(LUAJIT) -bg $(LUAJIT_BCOPTS) $< $@ $(RECIPE_RESULT_COMPILE)
1005
1006
1006
$(duke3d_obj)/%.$o: $(lunatic_src)/%.cpp | $(duke3d_obj)
1007
$(duke3d_obj)/%.$o: $(lunatic_src)/%.cpp | $(duke3d_obj)
1007
	$(COMPILE_STATUS)
1008
	$(COMPILE_STATUS)
1008
	$(RECIPE_IF) $(COMPILER_CXX) $(duke3d_cflags) -c $< -o $@ $(RECIPE_RESULT_COMPILE)
1009
	$(RECIPE_IF) $(COMPILER_CXX) $(duke3d_cflags) -c $< -o $@ $(RECIPE_RESULT_COMPILE)
1009
1010
1010
# List of exported symbols, OS X
1011
# List of exported symbols, OS X
1011
$(duke3d_obj)/lunatic_%_osx: $(lunatic_src)/%.lds | $(duke3d_obj)
1012
$(duke3d_obj)/lunatic_%_osx: $(lunatic_src)/%.lds | $(duke3d_obj)
1012
	sed 's/[{};]//g;s/[A-Za-z_][A-Za-z_0-9]*/_&/g' $< > $@
1013
	sed 's/[{};]//g;s/[A-Za-z_][A-Za-z_0-9]*/_&/g' $< > $@
1013
1014
1014
# List of exported symbols, Windows
1015
# List of exported symbols, Windows
1015
$(duke3d_obj)/lunatic_%.def: $(lunatic_src)/%.lds | $(duke3d_obj)
1016
$(duke3d_obj)/lunatic_%.def: $(lunatic_src)/%.lds | $(duke3d_obj)
1016
	echo EXPORTS > $@
1017
	echo EXPORTS > $@
1017
	sed 's/[{};]//g' $< >> $@
1018
	sed 's/[{};]//g' $< >> $@
1018
1019
1019
1020
1020
### Main Rules
1021
### Main Rules
1021
1022
1022
define OBJECTRULES
1023
define OBJECTRULES
1023
1024
1024
include $(wildcard $($1_obj)/*.d)
1025
include $(wildcard $($1_obj)/*.d)
1025
1026
1026
$$($1_obj)/%.$$o: $$($1_src)/%.nasm | $$($1_obj)
1027
$$($1_obj)/%.$$o: $$($1_src)/%.nasm | $$($1_obj)
1027
	$$(COMPILE_STATUS)
1028
	$$(COMPILE_STATUS)
1028
	$$(RECIPE_IF) $$(AS) $$(ASFLAGS) $$< -o $$@ $$(RECIPE_RESULT_COMPILE)
1029
	$$(RECIPE_IF) $$(AS) $$(ASFLAGS) $$< -o $$@ $$(RECIPE_RESULT_COMPILE)
1029
1030
1030
$$($1_obj)/%.$$o: $$($1_src)/%.yasm | $$($1_obj)
1031
$$($1_obj)/%.$$o: $$($1_src)/%.yasm | $$($1_obj)
1031
	$$(COMPILE_STATUS)
1032
	$$(COMPILE_STATUS)
1032
	$$(RECIPE_IF) $$(AS) $$(ASFLAGS) $$< -o $$@ $$(RECIPE_RESULT_COMPILE)
1033
	$$(RECIPE_IF) $$(AS) $$(ASFLAGS) $$< -o $$@ $$(RECIPE_RESULT_COMPILE)
1033
1034
1034
$$($1_obj)/%.$$o: $$($1_src)/%.c | $$($1_obj)
1035
$$($1_obj)/%.$$o: $$($1_src)/%.c | $$($1_obj)
1035
	$$(COMPILE_STATUS)
1036
	$$(COMPILE_STATUS)
1036
	$$(RECIPE_IF) $$(COMPILER_C) $$($1_cflags) -c $$< -o $$@ $$(RECIPE_RESULT_COMPILE)
1037
	$$(RECIPE_IF) $$(COMPILER_C) $$($1_cflags) -c $$< -o $$@ $$(RECIPE_RESULT_COMPILE)
1037
1038
1038
$$($1_obj)/%.$$o: $$($1_src)/%.cpp | $$($1_obj)
1039
$$($1_obj)/%.$$o: $$($1_src)/%.cpp | $$($1_obj)
1039
	$$(COMPILE_STATUS)
1040
	$$(COMPILE_STATUS)
1040
	$$(RECIPE_IF) $$(COMPILER_CXX) $$($1_cflags) -c $$< -o $$@ $$(RECIPE_RESULT_COMPILE)
1041
	$$(RECIPE_IF) $$(COMPILER_CXX) $$($1_cflags) -c $$< -o $$@ $$(RECIPE_RESULT_COMPILE)
1041
1042
1042
$$($1_obj)/%.$$o: $$($1_src)/%.m | $$($1_obj)
1043
$$($1_obj)/%.$$o: $$($1_src)/%.m | $$($1_obj)
1043
	$$(COMPILE_STATUS)
1044
	$$(COMPILE_STATUS)
1044
	$$(RECIPE_IF) $$(COMPILER_OBJC) $$($1_cflags) -c $$< -o $$@ $$(RECIPE_RESULT_COMPILE)
1045
	$$(RECIPE_IF) $$(COMPILER_OBJC) $$($1_cflags) -c $$< -o $$@ $$(RECIPE_RESULT_COMPILE)
1045
1046
1046
$$($1_obj)/%.$$o: $$($1_src)/%.mm | $$($1_obj)
1047
$$($1_obj)/%.$$o: $$($1_src)/%.mm | $$($1_obj)
1047
	$$(COMPILE_STATUS)
1048
	$$(COMPILE_STATUS)
1048
	$$(RECIPE_IF) $$(COMPILER_OBJCXX) $$($1_cflags) -c $$< -o $$@ $$(RECIPE_RESULT_COMPILE)
1049
	$$(RECIPE_IF) $$(COMPILER_OBJCXX) $$($1_cflags) -c $$< -o $$@ $$(RECIPE_RESULT_COMPILE)
1049
1050
1050
$$($1_obj)/%.$$o: $$($1_obj)/%.c | $$($1_obj)
1051
$$($1_obj)/%.$$o: $$($1_obj)/%.c | $$($1_obj)
1051
	$$(COMPILE_STATUS)
1052
	$$(COMPILE_STATUS)
1052
	$$(RECIPE_IF) $$(COMPILER_C) $$($1_cflags) -c $$< -o $$@ $$(RECIPE_RESULT_COMPILE)
1053
	$$(RECIPE_IF) $$(COMPILER_C) $$($1_cflags) -c $$< -o $$@ $$(RECIPE_RESULT_COMPILE)
1053
1054
1054
$$($1_obj)/%.$$o: $$($1_src)/%.glsl | $$($1_obj)
1055
$$($1_obj)/%.$$o: $$($1_src)/%.glsl | $$($1_obj)
1055
	@echo Creating $$($1_obj)/$$(<F).cpp from $$<
1056
	@echo Creating $$($1_obj)/$$(<F).cpp from $$<
1056
	@$$(call RAW_ECHO,extern char const *$$(basename $$(<F));) > $$($1_obj)/$$(<F).cpp
1057
	@$$(call RAW_ECHO,extern char const *$$(basename $$(<F));) > $$($1_obj)/$$(<F).cpp
1057
	@$$(call RAW_ECHO,char const *$$(basename $$(<F)) = R"shader$$(paren_open)) >> $$($1_obj)/$$(<F).cpp
1058
	@$$(call RAW_ECHO,char const *$$(basename $$(<F)) = R"shader$$(paren_open)) >> $$($1_obj)/$$(<F).cpp
1058
	@$$(call CAT,$$<) >> $$($1_obj)/$$(<F).cpp
1059
	@$$(call CAT,$$<) >> $$($1_obj)/$$(<F).cpp
1059
	@$$(call RAW_ECHO,$$(paren_close)shader";) >> $$($1_obj)/$$(<F).cpp
1060
	@$$(call RAW_ECHO,$$(paren_close)shader";) >> $$($1_obj)/$$(<F).cpp
1060
	$$(COMPILE_STATUS)
1061
	$$(COMPILE_STATUS)
1061
	$$(RECIPE_IF) $$(COMPILER_CXX) $$($1_cflags) -c $$($1_obj)/$$(<F).cpp -o $$@ $$(RECIPE_RESULT_COMPILE)
1062
	$$(RECIPE_IF) $$(COMPILER_CXX) $$($1_cflags) -c $$($1_obj)/$$(<F).cpp -o $$@ $$(RECIPE_RESULT_COMPILE)
1062
1063
1063
## Cosmetic stuff
1064
## Cosmetic stuff
1064
1065
1065
$$($1_obj)/%.$$o: $$($1_rsrc)/%.rc | $$($1_obj)
1066
$$($1_obj)/%.$$o: $$($1_rsrc)/%.rc | $$($1_obj)
1066
	$$(COMPILE_STATUS)
1067
	$$(COMPILE_STATUS)
1067
	$$(RECIPE_IF) $$(RC) -i $$< -o $$@ --include-dir=$$(engine_inc) --include-dir=$$($1_src) --include-dir=$$($1_rsrc) -DPOLYMER=$$(POLYMER) $(REVFLAG) $$(RECIPE_RESULT_COMPILE)
1068
	$$(RECIPE_IF) $$(RC) -i $$< -o $$@ --include-dir=$$(engine_inc) --include-dir=$$($1_src) --include-dir=$$($1_rsrc) -DPOLYMER=$$(POLYMER) $(REVFLAG) $$(RECIPE_RESULT_COMPILE)
1068
1069
1069
$$($1_obj)/%.$$o: $$($1_rsrc)/%.c | $$($1_obj)
1070
$$($1_obj)/%.$$o: $$($1_rsrc)/%.c | $$($1_obj)
1070
	$$(COMPILE_STATUS)
1071
	$$(COMPILE_STATUS)
1071
	$$(RECIPE_IF) $$(COMPILER_C) $$($1_cflags) -c $$< -o $$@ $$(RECIPE_RESULT_COMPILE)
1072
	$$(RECIPE_IF) $$(COMPILER_C) $$($1_cflags) -c $$< -o $$@ $$(RECIPE_RESULT_COMPILE)
1072
1073
1073
$$($1_obj)/%_banner.c: $$($1_rsrc)/%.bmp | $$($1_obj)
1074
$$($1_obj)/%_banner.c: $$($1_rsrc)/%.bmp | $$($1_obj)
1074
	echo "#include \"gtkpixdata_shim.h\"" > $$@
1075
	echo "#include \"gtkpixdata_shim.h\"" > $$@
1075
	gdk-pixbuf-csource --extern --struct --raw --name=startbanner_pixdata $$^ | sed 's/load_inc//' >> $$@
1076
	gdk-pixbuf-csource --extern --struct --raw --name=startbanner_pixdata $$^ | sed 's/load_inc//' >> $$@
1076
1077
1077
endef
1078
endef
1078
1079
1079
$(foreach i,$(components),$(eval $(call OBJECTRULES,$i)))
1080
$(foreach i,$(components),$(eval $(call OBJECTRULES,$i)))
1080
1081
1081
1082
1082
### Other special cases
1083
### Other special cases
1083
1084
1084
# Comment out the following rule to debug a-c.o
1085
# Comment out the following rule to debug a-c.o
1085
$(engine_obj)/a-c.$o: $(engine_src)/a-c.cpp | $(engine_obj)
1086
$(engine_obj)/a-c.$o: $(engine_src)/a-c.cpp | $(engine_obj)
1086
	$(COMPILE_STATUS)
1087
	$(COMPILE_STATUS)
1087
	$(RECIPE_IF) $(subst -O$(OPTLEVEL),-O2,$(subst $(ASAN_FLAGS),,$(COMPILER_CXX))) $(engine_cflags) -c $< -o $@ $(RECIPE_RESULT_COMPILE)
1088
	$(RECIPE_IF) $(subst -O$(OPTLEVEL),-O2,$(subst $(ASAN_FLAGS),,$(COMPILER_CXX))) $(engine_cflags) -c $< -o $@ $(RECIPE_RESULT_COMPILE)
1088
1089
1089
$(engine_obj)/rev.$o: $(engine_src)/rev.cpp | $(engine_obj)
1090
$(engine_obj)/rev.$o: $(engine_src)/rev.cpp | $(engine_obj)
1090
	$(COMPILE_STATUS)
1091
	$(COMPILE_STATUS)
1091
	$(RECIPE_IF) $(COMPILER_CXX) $(engine_cflags) $(REVFLAG) -c $< -o $@ $(RECIPE_RESULT_COMPILE)
1092
	$(RECIPE_IF) $(COMPILER_CXX) $(engine_cflags) $(REVFLAG) -c $< -o $@ $(RECIPE_RESULT_COMPILE)
1092
1093
1093
1094
1094
### Directories
1095
### Directories
1095
1096
1096
$(foreach i,$(components),$($i_obj)):
1097
$(foreach i,$(components),$($i_obj)):
1097
	-$(call MKDIR,$@)
1098
	-$(call MKDIR,$@)
1098
1099
1099
### Phonies
1100
### Phonies
1100
1101
1101
clang-tools: $(filter %.c %.cpp,$(foreach i,$(call getdeps,duke3d,game),$(call expandsrcs,$i)))
1102
clang-tools: $(filter %.c %.cpp,$(foreach i,$(call getdeps,duke3d,game),$(call expandsrcs,$i)))
1102
	echo $^ -- -x c++ $(CXXONLYFLAGS) $(COMPILERFLAGS) $(CWARNS) $(foreach i,$(components),$($i_cflags))
1103
	echo $^ -- -x c++ $(CXXONLYFLAGS) $(COMPILERFLAGS) $(CWARNS) $(foreach i,$(components),$($i_cflags))
1103
1104
1104
$(addprefix clean,$(games)):
1105
$(addprefix clean,$(games)):
1105
	-$(call RM,$(foreach i,$(roles),$($(subst clean,,$@)_$i)$(EXESUFFIX)))
1106
	-$(call RM,$(foreach i,$(roles),$($(subst clean,,$@)_$i)$(EXESUFFIX)))
1106
	-$(call RMDIR,$($(subst clean,,$@)_obj))
1107
	-$(call RMDIR,$($(subst clean,,$@)_obj))
1107
ifeq ($(PLATFORM),DARWIN)
1108
ifeq ($(PLATFORM),DARWIN)
1108
	-$(call RMDIR,$(foreach i,$(roles),"$($(subst clean,,$@)_$i_proper).app"))
1109
	-$(call RMDIR,$(foreach i,$(roles),"$($(subst clean,,$@)_$i_proper).app"))
1109
endif
1110
endif
1110
1111
1111
cleantools:
1112
cleantools:
1112
	-$(call RM,$(addsuffix $(EXESUFFIX),$($(subst clean,,$@)_targets)))
1113
	-$(call RM,$(addsuffix $(EXESUFFIX),$($(subst clean,,$@)_targets)))
1113
	-$(call RMDIR,$($(subst clean,,$@)_obj))
1114
	-$(call RMDIR,$($(subst clean,,$@)_obj))
1114
1115
1115
clean: cleanduke3d cleantools
1116
clean: cleanduke3d cleantools
1116
	-$(call RMDIR,$(obj))
1117
	-$(call RMDIR,$(obj))
1117
	-$(call RM,$(ebacktrace_dll))
1118
	-$(call RM,$(ebacktrace_dll))
1118
	-$(call RM,$(voidwrap_lib))
1119
	-$(call RM,$(voidwrap_lib))
1119
1120
1120
printtools:
1121
printtools:
1121
	echo "$(addsuffix $(EXESUFFIX),$(tools_targets))"
1122
	echo "$(addsuffix $(EXESUFFIX),$(tools_targets))"
1122
1123
1123
rev: $(engine_obj)/rev.$o
1124
rev: $(engine_obj)/rev.$o
1124
1125
1125
1126
1126
### Compatibility
1127
### Compatibility
1127
1128
1128
cleantest: cleankenbuild
1129
cleantest: cleankenbuild
1129
cleanutils: cleantools
1130
cleanutils: cleantools
1130
printutils: printtools
1131
printutils: printtools
1131
test: kenbuild
1132
test: kenbuild
1132
utils: tools
1133
utils: tools
1133
veryclean: clean
1134
veryclean: clean