Subversion Repositories eduke32

Rev

Rev 8122 | Rev 8132 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

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