Subversion Repositories eduke32

Rev

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