Subversion Repositories eduke32

Rev

Rev 8734 | 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 \
6099 hendricks2 238
    hash.cpp \
239
    hightile.cpp \
8217 terminx 240
    klzw.cpp \
6099 hendricks2 241
    kplib.cpp \
242
    lz4.c \
8217 terminx 243
    md4.cpp \
244
    mhk.cpp \
245
    miniz.c \
246
    miniz_tdef.c \
247
    miniz_tinfl.c \
8663 ny00123 248
    mmulti.cpp \
8217 terminx 249
    mutex.cpp \
6099 hendricks2 250
    osd.cpp \
8217 terminx 251
    palette.cpp \
252
    pngwrite.cpp \
253
    polymost.cpp \
254
    polymost1Frag.glsl \
255
    polymost1Vert.glsl \
6099 hendricks2 256
    pragmas.cpp \
8217 terminx 257
    rev.cpp \
258
    screenshot.cpp \
8650 hendricks2 259
    screentext.cpp \
6099 hendricks2 260
    scriptfile.cpp \
8217 terminx 261
    sjson.cpp \
262
    smalltextfont.cpp \
6939 pogokeen 263
    softsurface.cpp \
8217 terminx 264
    texcache.cpp \
265
    textfont.cpp \
266
    tiles.cpp \
7976 terminx 267
    timer.cpp \
8217 terminx 268
    vfs.cpp \
6099 hendricks2 269
    xxhash.c \
8179 terminx 270
    zpl.cpp \
5754 hendricks2 271
 
6422 hendricks2 272
engine_editor_objs := \
6099 hendricks2 273
    build.cpp \
274
    config.cpp \
275
    defs.cpp \
5754 hendricks2 276
 
6422 hendricks2 277
engine_tools_objs := \
8217 terminx 278
    colmatch.cpp \
6150 hendricks2 279
    compat.cpp \
8217 terminx 280
    crc32.cpp \
281
    klzw.cpp \
282
    kplib.cpp \
283
    lz4.cpp \
6150 hendricks2 284
    pragmas.cpp \
8199 terminx 285
    vfs.cpp \
6150 hendricks2 286
 
4543 hendricks2 287
ifeq (0,$(NOASM))
6422 hendricks2 288
  engine_objs += a.nasm
4543 hendricks2 289
else
6422 hendricks2 290
  engine_objs += a-c.cpp
4543 hendricks2 291
  ifneq (0,$(USE_ASM64))
6422 hendricks2 292
    engine_objs += a64.yasm
4543 hendricks2 293
  endif
294
endif
295
ifeq (1,$(USE_OPENGL))
6919 pogokeen 296
    engine_objs += glsurface.cpp voxmodel.cpp mdsprite.cpp tilepacker.cpp
6656 pogokeen 297
    engine_deps += glad
4543 hendricks2 298
    ifeq (1,$(POLYMER))
6656 pogokeen 299
        engine_objs += glbuild.cpp polymer.cpp
4543 hendricks2 300
    endif
301
endif
4591 helixhorne 302
ifneq (0,$(LUNATIC))
6422 hendricks2 303
    engine_objs += lunatic.cpp
4543 hendricks2 304
endif
305
ifeq ($(PLATFORM),DARWIN)
6422 hendricks2 306
    engine_objs += osxbits.mm
6425 hendricks2 307
    engine_tools_objs += osxbits.mm
5941 hendricks2 308
    ifeq ($(STARTUP_WINDOW),1)
6422 hendricks2 309
        engine_editor_objs += startosx.editor.mm
4543 hendricks2 310
    endif
5691 hendricks2 311
    ifeq ($(SDL_TARGET),1)
5778 hendricks2 312
        ifneq ($(SDL_FRAMEWORK),0)
6422 hendricks2 313
            engine_objs += SDLMain.mm
5691 hendricks2 314
        endif
4543 hendricks2 315
    endif
316
endif
317
ifeq ($(PLATFORM),WINDOWS)
6422 hendricks2 318
    engine_objs += winbits.cpp
5943 hendricks2 319
    ifeq ($(STARTUP_WINDOW),1)
6422 hendricks2 320
        engine_editor_objs += startwin.editor.cpp
5943 hendricks2 321
    endif
4543 hendricks2 322
endif
4820 hendricks2 323
ifeq ($(PLATFORM),WII)
6422 hendricks2 324
    engine_objs += wiibits.cpp
6418 hendricks2 325
    LINKERFLAGS += -Wl,-wrap,c_default_exceptionhandler
4820 hendricks2 326
endif
4543 hendricks2 327
ifeq ($(RENDERTYPE),SDL)
6422 hendricks2 328
    engine_objs += sdlayer.cpp
4543 hendricks2 329
 
330
    ifeq (1,$(HAVE_GTK2))
6422 hendricks2 331
        engine_objs += gtkbits.cpp dynamicgtk.cpp
5942 hendricks2 332
        ifeq ($(STARTUP_WINDOW),1)
6422 hendricks2 333
            engine_editor_objs += startgtk.editor.cpp
5942 hendricks2 334
        endif
4543 hendricks2 335
    endif
336
endif
337
ifeq ($(RENDERTYPE),WIN)
6422 hendricks2 338
    engine_objs += winlayer.cpp rawinput.cpp
4543 hendricks2 339
endif
340
 
6056 hendricks2 341
ifneq ($(USE_LIBVPX),0)
6422 hendricks2 342
    engine_objs += animvpx.cpp
6056 hendricks2 343
endif
344
 
4543 hendricks2 345
 
6422 hendricks2 346
#### mact
4555 hendricks2 347
 
6422 hendricks2 348
mact := mact
5747 hendricks2 349
 
6422 hendricks2 350
mact_root := $(source)/$(mact)
351
mact_src := $(mact_root)/src
352
mact_inc := $(mact_root)/include
353
mact_obj := $(obj)/$(mact)
4555 hendricks2 354
 
6422 hendricks2 355
mact_objs := \
8217 terminx 356
    animlib.cpp \
6099 hendricks2 357
    control.cpp \
8217 terminx 358
    joystick.cpp \
6099 hendricks2 359
    keyboard.cpp \
360
    scriplib.cpp \
4555 hendricks2 361
 
5197 hendricks2 362
 
6149 hendricks2 363
#### AudioLib
4543 hendricks2 364
 
6422 hendricks2 365
audiolib := audiolib
5747 hendricks2 366
 
6422 hendricks2 367
audiolib_objs := \
8218 terminx 368
    driver_adlib.cpp \
8752 terminx 369
    driver_sf2.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 \
8734 terminx 570
    gamestructures.cpp \
8217 terminx 571
    gamevars.cpp \
572
    global.cpp \
573
    grpscan.cpp \
6099 hendricks2 574
    input.cpp \
575
    menus.cpp \
576
    namesdyn.cpp \
7443 hendricks2 577
    network.cpp \
8217 terminx 578
    osdcmds.cpp \
579
    osdfuncs.cpp \
580
    player.cpp \
581
    premap.cpp \
582
    rts.cpp \
6099 hendricks2 583
    savegame.cpp \
8217 terminx 584
    sbar.cpp \
585
    screens.cpp \
586
    sector.cpp \
6099 hendricks2 587
    sounds.cpp \
588
    soundsdyn.cpp \
8649 hendricks2 589
    text.cpp \
5754 hendricks2 590
 
6422 hendricks2 591
duke3d_editor_objs := \
6099 hendricks2 592
    astub.cpp \
593
    common.cpp \
594
    grpscan.cpp \
595
    sounds_mapster32.cpp \
5754 hendricks2 596
 
6422 hendricks2 597
duke3d_game_rsrc_objs :=
598
duke3d_editor_rsrc_objs :=
599
duke3d_game_gen_objs :=
600
duke3d_editor_gen_objs :=
6101 hendricks2 601
 
6422 hendricks2 602
duke3d_game_miscdeps :=
603
duke3d_editor_miscdeps :=
604
duke3d_game_orderonlydeps :=
605
duke3d_editor_orderonlydeps :=
2143 helixhorne 606
 
607
## Lunatic devel
6422 hendricks2 608
lunatic := lunatic
609
lunatic_src := $(duke3d_src)/$(lunatic)
610
lunatic_obj := $(duke3d_obj)
6151 hendricks2 611
 
2034 helixhorne 612
ifneq (0,$(LUNATIC))
6422 hendricks2 613
    COMPILERFLAGS += -I$(lunatic_src) -DLUNATIC
6104 hendricks2 614
 
615
    # Determine size of _defs*.lua bytecode once.
616
    ifndef DEFS_BC_SIZE
6422 hendricks2 617
        DEFS_BC_SIZE := $(shell $(LUAJIT) -bg -t h $(lunatic_src)/_defs_game.lua -)
6104 hendricks2 618
        DEFS_BC_SIZE := $(word 3, $(DEFS_BC_SIZE))
619
    endif
620
    ifndef DEFS_M32_BC_SIZE
6422 hendricks2 621
        DEFS_M32_BC_SIZE := $(shell $(LUAJIT) -bg -t h $(lunatic_src)/_defs_editor.lua -)
6104 hendricks2 622
        DEFS_M32_BC_SIZE := $(word 3, $(DEFS_M32_BC_SIZE))
623
    endif
6422 hendricks2 624
    duke3d_cflags += -DLUNATIC_DEFS_BC_SIZE=$(DEFS_BC_SIZE) -DLUNATIC_DEFS_M32_BC_SIZE=$(DEFS_M32_BC_SIZE)
6104 hendricks2 625
 
6098 hendricks2 626
    # Lunatic object base names. These are not used in targets directly.
6422 hendricks2 627
    lunatic_objs := \
6099 hendricks2 628
        defs_common.lua \
629
        engine_maptext.lua \
630
        engine.lua \
631
        bcarray.lua \
632
        bcheck.lua \
633
        bitar.lua \
634
        xmath.lua \
635
        v.lua \
636
        dump.lua \
637
        dis_x86.lua \
638
        dis_x64.lua \
4237 helixhorne 639
 
6422 hendricks2 640
    lunatic_game_objs := \
6153 hendricks2 641
        lunatic_game.cpp \
6099 hendricks2 642
        _defs_game.lua \
643
        con_lang.lua \
644
        lunacon.lua \
645
        randgen.lua \
646
        stat.lua \
647
        control.lua \
6145 hendricks2 648
        lunasave.lua \
6099 hendricks2 649
        fs.lua \
2143 helixhorne 650
 
6422 hendricks2 651
    lunatic_editor_objs := \
6099 hendricks2 652
        lunatic_editor.cpp \
6153 hendricks2 653
        _defs_editor.lua \
6098 hendricks2 654
 
655
    # TODO: remove debugging modules from release build
656
 
2143 helixhorne 657
    # now, take care of having the necessary symbols (sector, wall, etc.) in the
658
    # executable no matter what the debugging level
659
 
2074 helixhorne 660
    ifeq ($(PLATFORM),DARWIN)
2143 helixhorne 661
        # strip on OSX says: removing global symbols from a final linked no longer supported.
662
        #                    Use -exported_symbols_list at link time when building
663
        # But, following _their_ directions does not give us the symbols! wtf?
6056 hendricks2 664
        # Instead of using -alias_list and -exported_symbols_list, prevent stripping them.
6422 hendricks2 665
        duke3d_game_stripflags += -s $(duke3d_obj)/lunatic_dynsymlist_game_osx
666
        duke3d_editor_stripflags += -s $(duke3d_obj)/lunatic_dynsymlist_editor_osx
2143 helixhorne 667
 
6422 hendricks2 668
        duke3d_game_orderonlydeps += $(duke3d_obj)/lunatic_dynsymlist_game_osx
669
        duke3d_editor_orderonlydeps += $(duke3d_obj)/lunatic_dynsymlist_editor_osx
6418 hendricks2 670
        LINKERFLAGS += -pagezero_size 10000 -image_base 100000000
2143 helixhorne 671
    endif
672
    ifeq ($(PLATFORM),WINDOWS)
6418 hendricks2 673
        override STRIP :=
6422 hendricks2 674
        duke3d_game_miscdeps += $(duke3d_obj)/lunatic_dynsymlist_game.def
675
        duke3d_editor_miscdeps += $(duke3d_obj)/lunatic_dynsymlist_editor.def
2143 helixhorne 676
    endif
3272 hendricks2 677
    ifeq ($(SUBPLATFORM),LINUX)
6418 hendricks2 678
        override STRIP :=
6422 hendricks2 679
        duke3d_game_ldflags += -Wl,--dynamic-list=$(lunatic_src)/dynsymlist_game.lds
680
        duke3d_editor_ldflags += -Wl,--dynamic-list=$(lunatic_src)/dynsymlist_editor.lds
2074 helixhorne 681
    endif
2034 helixhorne 682
endif
683
 
3272 hendricks2 684
ifeq ($(SUBPLATFORM),LINUX)
5037 hendricks2 685
    LIBS += -lFLAC -lvorbisfile -lvorbis -logg
996 terminx 686
endif
687
 
5037 hendricks2 688
ifeq ($(PLATFORM),BSD)
689
    LIBS += -lFLAC -lvorbisfile -lvorbis -logg -lexecinfo
690
endif
691
 
996 terminx 692
ifeq ($(PLATFORM),DARWIN)
4543 hendricks2 693
    LIBS += -lFLAC -lvorbisfile -lvorbis -logg -lm \
694
            -Wl,-framework,Cocoa -Wl,-framework,Carbon -Wl,-framework,OpenGL \
5078 terminx 695
            -Wl,-framework,CoreMIDI -Wl,-framework,AudioUnit \
4548 hendricks2 696
            -Wl,-framework,AudioToolbox -Wl,-framework,IOKit -Wl,-framework,AGL
697
    ifneq (00,$(DARWIN9)$(DARWIN10))
698
        LIBS += -Wl,-framework,QuickTime -lm
699
    endif
2537 hendricks2 700
 
5941 hendricks2 701
    ifeq ($(STARTUP_WINDOW),1)
6422 hendricks2 702
        duke3d_game_objs += GrpFile.game.mm GameListSource.game.mm startosx.game.mm
2426 hendricks2 703
    endif
996 terminx 704
endif
705
 
5 Plagman 706
ifeq ($(PLATFORM),WINDOWS)
8216 terminx 707
    LIBS += -lFLAC -lvorbisfile -lvorbis -logg -ldsound
6422 hendricks2 708
    duke3d_game_objs += winbits.cpp
709
    duke3d_game_rsrc_objs += gameres.rc
710
    duke3d_editor_rsrc_objs += buildres.rc
5928 terminx 711
    ifeq ($(STARTUP_WINDOW),1)
6422 hendricks2 712
        duke3d_game_objs += startwin.game.cpp
5928 terminx 713
    endif
3219 hendricks2 714
endif
4543 hendricks2 715
 
716
ifeq ($(PLATFORM),WII)
717
    LIBS += -lvorbisidec
718
endif
719
 
6147 hendricks2 720
ifeq (11,$(HAVE_GTK2)$(STARTUP_WINDOW))
6422 hendricks2 721
    duke3d_game_objs += startgtk.game.cpp
722
    duke3d_game_gen_objs += game_banner.c
723
    duke3d_editor_gen_objs += build_banner.c
6147 hendricks2 724
endif
3219 hendricks2 725
ifeq ($(RENDERTYPE),SDL)
6422 hendricks2 726
    duke3d_game_rsrc_objs += game_icon.c
727
    duke3d_editor_rsrc_objs += build_icon.c
4084 hendricks2 728
endif
5 Plagman 729
 
4555 hendricks2 730
 
6418 hendricks2 731
#### Shadow Warrior
6105 hendricks2 732
 
6422 hendricks2 733
sw := sw
5213 hendricks2 734
 
6422 hendricks2 735
sw_root := $(source)/$(sw)
736
sw_src := $(sw_root)/src
737
sw_rsrc := $(sw_root)/rsrc
738
sw_obj := $(obj)/$(sw)
1595 helixhorne 739
 
6422 hendricks2 740
sw_cflags := -I$(sw_src)
6105 hendricks2 741
 
8216 terminx 742
sw_game_deps := audiolib mact
6422 hendricks2 743
sw_editor_deps := audiolib
6149 hendricks2 744
 
6422 hendricks2 745
sw_game := voidsw
7537 hendricks2 746
sw_editor := wangulator
5747 hendricks2 747
 
6422 hendricks2 748
sw_game_proper := VoidSW
7537 hendricks2 749
sw_editor_proper := Wangulator
5197 hendricks2 750
 
6422 hendricks2 751
sw_game_objs := \
6099 hendricks2 752
    actor.cpp \
753
    ai.cpp \
754
    anim.cpp \
755
    border.cpp \
756
    break.cpp \
757
    bunny.cpp \
758
    cache.cpp \
759
    cheats.cpp \
760
    colormap.cpp \
761
    common.cpp \
762
    config.cpp \
763
    console.cpp \
764
    coolg.cpp \
765
    coolie.cpp \
766
    copysect.cpp \
767
    demo.cpp \
768
    draw.cpp \
769
    eel.cpp \
770
    game.cpp \
771
    girlninj.cpp \
772
    goro.cpp \
773
    grpscan.cpp \
774
    hornet.cpp \
775
    interp.cpp \
776
    interpsh.cpp \
777
    inv.cpp \
778
    jplayer.cpp \
779
    jsector.cpp \
780
    jweapon.cpp \
781
    lava.cpp \
782
    light.cpp \
783
    mclip.cpp \
784
    mdastr.cpp \
785
    menus.cpp \
786
    miscactr.cpp \
787
    morph.cpp \
7443 hendricks2 788
    network.cpp \
6099 hendricks2 789
    ninja.cpp \
790
    panel.cpp \
791
    player.cpp \
792
    predict.cpp \
793
    quake.cpp \
794
    ripper.cpp \
795
    ripper2.cpp \
796
    rooms.cpp \
797
    rotator.cpp \
798
    rts.cpp \
799
    save.cpp \
8217 terminx 800
    saveable.cpp \
6099 hendricks2 801
    scrip2.cpp \
802
    sector.cpp \
803
    serp.cpp \
804
    setup.cpp \
805
    skel.cpp \
806
    skull.cpp \
807
    slidor.cpp \
808
    sounds.cpp \
809
    spike.cpp \
810
    sprite.cpp \
811
    sumo.cpp \
812
    swconfig.cpp \
813
    sync.cpp \
814
    text.cpp \
815
    track.cpp \
816
    vator.cpp \
817
    vis.cpp \
818
    wallmove.cpp \
819
    warp.cpp \
820
    weapon.cpp \
821
    zilla.cpp \
822
    zombie.cpp \
5197 hendricks2 823
 
6422 hendricks2 824
sw_editor_objs := \
8217 terminx 825
    bldscript.cpp \
6099 hendricks2 826
    brooms.cpp \
827
    colormap.cpp \
8217 terminx 828
    common.cpp \
6099 hendricks2 829
    grpscan.cpp \
8217 terminx 830
    jbhlp.cpp \
831
    jnstub.cpp \
5754 hendricks2 832
 
6422 hendricks2 833
sw_game_rsrc_objs :=
834
sw_editor_rsrc_objs :=
835
sw_game_gen_objs :=
836
sw_editor_gen_objs :=
6101 hendricks2 837
 
8498 hendricks2 838
ifeq (11,$(HAVE_GTK2)$(STARTUP_WINDOW))
6422 hendricks2 839
    sw_game_objs += startgtk.game.cpp
840
    sw_game_gen_objs += game_banner.c
841
    sw_editor_gen_objs += build_banner.c
6147 hendricks2 842
endif
5197 hendricks2 843
ifeq ($(RENDERTYPE),SDL)
6422 hendricks2 844
    sw_game_rsrc_objs += game_icon.c
845
    sw_editor_rsrc_objs += game_icon.c
5197 hendricks2 846
endif
847
ifeq ($(PLATFORM),WINDOWS)
6422 hendricks2 848
    sw_game_objs += startwin.game.cpp
849
    sw_game_rsrc_objs += gameres.rc
850
    sw_editor_rsrc_objs += buildres.rc
5197 hendricks2 851
endif
8601 hendricks2 852
ifeq ($(PLATFORM),DARWIN)
853
    ifeq ($(STARTUP_WINDOW),1)
854
        sw_game_objs += GrpFile.game.mm GameListSource.game.mm StartupWinController.game.mm
855
    endif
856
endif
5197 hendricks2 857
 
858
 
6418 hendricks2 859
#### Final setup
5197 hendricks2 860
 
8094 hendricks2 861
COMPILERFLAGS += \
862
    -I$(engine_inc) \
863
    -I$(mact_inc) \
864
    -I$(audiolib_inc) \
865
    -I$(glad_inc) \
866
    -I$(voidwrap_inc) \
867
    -MP -MMD \
868
 
7359 hendricks2 869
ifneq (0,$(USE_PHYSFS))
870
    COMPILERFLAGS += -I$(physfs_inc) -DUSE_PHYSFS
871
endif
6418 hendricks2 872
 
873
 
6149 hendricks2 874
##### Recipes
6093 hendricks2 875
 
6422 hendricks2 876
games := \
8217 terminx 877
    duke3d \
6422 hendricks2 878
    kenbuild \
879
    sw \
6093 hendricks2 880
 
6422 hendricks2 881
libraries := \
8217 terminx 882
    audiolib \
6422 hendricks2 883
    engine \
8217 terminx 884
    glad \
6422 hendricks2 885
    libxmplite \
886
    lpeg \
8217 terminx 887
    mact \
8094 hendricks2 888
    voidwrap \
6093 hendricks2 889
 
7359 hendricks2 890
ifneq (0,$(USE_PHYSFS))
891
    libraries += physfs
892
endif
893
 
6422 hendricks2 894
components := \
895
    $(games) \
896
    $(libraries) \
897
    tools \
6093 hendricks2 898
 
6422 hendricks2 899
roles := \
900
    game \
901
    editor \
6093 hendricks2 902
 
903
 
1103 terminx 904
ifeq ($(PRETTY_OUTPUT),1)
1101 terminx 905
.SILENT:
1103 terminx 906
endif
6097 hendricks2 907
.PHONY: \
8217 terminx 908
    $(addprefix clean,$(games) test utils tools) \
909
    $(engine_obj)/rev.$o \
6097 hendricks2 910
    all \
8217 terminx 911
    clang-tools \
6097 hendricks2 912
    clean \
8217 terminx 913
    printtools \
6097 hendricks2 914
    printutils \
915
    rev \
8217 terminx 916
    start \
917
    veryclean \
6097 hendricks2 918
 
6052 hendricks2 919
.SUFFIXES:
6094 hendricks2 920
.SECONDEXPANSION:
5 Plagman 921
 
6094 hendricks2 922
 
6149 hendricks2 923
#### Targets
5 Plagman 924
 
5197 hendricks2 925
all: duke3d
926
 
3163 hendricks2 927
start:
1102 terminx 928
	$(BUILD_STARTED)
1595 helixhorne 929
 
6422 hendricks2 930
tools: $(addsuffix $(EXESUFFIX),$(tools_targets)) | start
6424 hendricks2 931
	@$(call LL,$^)
3163 hendricks2 932
 
6423 hendricks2 933
$(games): $$(foreach i,$(roles),$$($$@_$$i)$(EXESUFFIX)) | start
6424 hendricks2 934
	@$(call LL,$^)
4824 hendricks2 935
 
6422 hendricks2 936
ebacktrace: $(ebacktrace_dll) | start
6424 hendricks2 937
	@$(call LL,$^)
4555 hendricks2 938
 
4824 hendricks2 939
ifeq ($(PLATFORM),WII)
940
ifneq ($(ELF2DOL),)
6093 hendricks2 941
%$(DOLSUFFIX): %$(EXESUFFIX)
4824 hendricks2 942
endif
943
endif
6423 hendricks2 944
 
945
 
6093 hendricks2 946
define BUILDRULE
1595 helixhorne 947
 
6422 hendricks2 948
$$($1_$2)$$(EXESUFFIX): $$(foreach i,$(call getdeps,$1,$2),$$(call expandobjs,$$i)) $$($1_$2_miscdeps) | $$($1_$2_orderonlydeps)
6093 hendricks2 949
	$$(LINK_STATUS)
6422 hendricks2 950
	$$(RECIPE_IF) $$(LINKER) -o $$@ $$^ $$(GUI_LIBS) $$($1_$2_ldflags) $$(LIBDIRS) $$(LIBS) $$(RECIPE_RESULT_LINK)
6093 hendricks2 951
ifeq ($$(PLATFORM),WII)
952
ifneq ($$(ELF2DOL),)
953
	$$(ELF2DOL) $$@ $$($1_$2)$$(DOLSUFFIX)
4824 hendricks2 954
endif
955
endif
6093 hendricks2 956
ifneq ($$(STRIP),)
6422 hendricks2 957
	$$(STRIP) $$@ $$($1_$2_stripflags)
1693 helixhorne 958
endif
6093 hendricks2 959
ifeq ($$(PLATFORM),DARWIN)
6422 hendricks2 960
	cp -RPf "platform/Apple/bundles/$$($1_$2_proper).app" "./"
6424 hendricks2 961
	$(call MKDIR,"$$($1_$2_proper).app/Contents/MacOS")
6422 hendricks2 962
	cp -f "$$($1_$2)$$(EXESUFFIX)" "$$($1_$2_proper).app/Contents/MacOS/"
2385 hendricks2 963
endif
5 Plagman 964
 
6093 hendricks2 965
endef
5197 hendricks2 966
 
6422 hendricks2 967
$(foreach i,$(games),$(foreach j,$(roles),$(eval $(call BUILDRULE,$i,$j))))
5197 hendricks2 968
 
6093 hendricks2 969
 
6149 hendricks2 970
#### Rules
3057 helixhorne 971
 
6422 hendricks2 972
$(ebacktrace_dll): platform/Windows/src/backtrace.c
3163 hendricks2 973
	$(COMPILE_STATUS)
6422 hendricks2 974
	$(RECIPE_IF) $(CC) $(CONLYFLAGS) -O2 -ggdb -shared -Wall -Wextra -static-libgcc -I$(engine_inc) -o $@ $^ -lbfd -liberty -limagehlp $(RECIPE_RESULT_COMPILE)
2037 helixhorne 975
 
7140 hendricks2 976
libklzw$(DLLSUFFIX): $(engine_src)/klzw.cpp
1102 terminx 977
	$(COMPILE_STATUS)
7140 hendricks2 978
	$(RECIPE_IF) $(COMPILER_C) -shared -fPIC $< -o $@ $(RECIPE_RESULT_COMPILE)
1693 helixhorne 979
 
6425 hendricks2 980
# 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 981
%$(EXESUFFIX): $(tools_obj)/%.$o $(foreach i,tools $(tools_deps),$(call expandobjs,$i))
6083 hendricks2 982
	$(LINK_STATUS)
983
	$(RECIPE_IF) $(LINKER) -o $@ $^ $(LIBDIRS) $(LIBS) $(RECIPE_RESULT_LINK)
1101 terminx 984
 
6422 hendricks2 985
enumdisplay$(EXESUFFIX): $(tools_obj)/enumdisplay.$o
6083 hendricks2 986
	$(LINK_STATUS)
987
	$(RECIPE_IF) $(LINKER) -o $@ $^ $(LIBDIRS) $(LIBS) -lgdi32 $(RECIPE_RESULT_LINK)
6422 hendricks2 988
getdxdidf$(EXESUFFIX): $(tools_obj)/getdxdidf.$o
6083 hendricks2 989
	$(LINK_STATUS)
990
	$(RECIPE_IF) $(LINKER) -o $@ $^ $(LIBDIRS) $(LIBS) -ldinput $(RECIPE_RESULT_LINK)
4194 helixhorne 991
 
6095 hendricks2 992
 
8094 hendricks2 993
### Voidwrap
994
 
995
$(voidwrap_lib): $(foreach i,$(voidwrap),$(call expandobjs,$i))
996
	$(LINK_STATUS)
997
	$(RECIPE_IF) $(LINKER) -shared -Wl,-soname,$@ -o $@ $^ $(LIBDIRS) $(voidwrap_root)/sdk/redistributable_bin/$(steamworks_lib) $(RECIPE_RESULT_LINK)
998
 
999
 
6149 hendricks2 1000
### Lunatic
3057 helixhorne 1001
 
2650 helixhorne 1002
# Create object files directly with luajit
6422 hendricks2 1003
$(duke3d_obj)/%.$o: $(lunatic_src)/%.lua | $(duke3d_obj)
2650 helixhorne 1004
	$(COMPILE_STATUS)
4543 hendricks2 1005
	$(RECIPE_IF) $(LUAJIT) -bg $(LUAJIT_BCOPTS) $< $@ $(RECIPE_RESULT_COMPILE)
2650 helixhorne 1006
 
6422 hendricks2 1007
$(duke3d_obj)/%.$o: $(lunatic_src)/%.cpp | $(duke3d_obj)
2034 helixhorne 1008
	$(COMPILE_STATUS)
6422 hendricks2 1009
	$(RECIPE_IF) $(COMPILER_CXX) $(duke3d_cflags) -c $< -o $@ $(RECIPE_RESULT_COMPILE)
2034 helixhorne 1010
 
3057 helixhorne 1011
# List of exported symbols, OS X
6422 hendricks2 1012
$(duke3d_obj)/lunatic_%_osx: $(lunatic_src)/%.lds | $(duke3d_obj)
2074 helixhorne 1013
	sed 's/[{};]//g;s/[A-Za-z_][A-Za-z_0-9]*/_&/g' $< > $@
1014
 
3057 helixhorne 1015
# List of exported symbols, Windows
6422 hendricks2 1016
$(duke3d_obj)/lunatic_%.def: $(lunatic_src)/%.lds | $(duke3d_obj)
2143 helixhorne 1017
	echo EXPORTS > $@
1018
	sed 's/[{};]//g' $< >> $@
1019
 
3057 helixhorne 1020
 
6149 hendricks2 1021
### Main Rules
1905 helixhorne 1022
 
6095 hendricks2 1023
define OBJECTRULES
3334 hendricks2 1024
 
7839 terminx 1025
include $(wildcard $($1_obj)/*.d)
1026
 
6422 hendricks2 1027
$$($1_obj)/%.$$o: $$($1_src)/%.nasm | $$($1_obj)
6095 hendricks2 1028
	$$(COMPILE_STATUS)
1029
	$$(RECIPE_IF) $$(AS) $$(ASFLAGS) $$< -o $$@ $$(RECIPE_RESULT_COMPILE)
2458 hendricks2 1030
 
6422 hendricks2 1031
$$($1_obj)/%.$$o: $$($1_src)/%.yasm | $$($1_obj)
6095 hendricks2 1032
	$$(COMPILE_STATUS)
1033
	$$(RECIPE_IF) $$(AS) $$(ASFLAGS) $$< -o $$@ $$(RECIPE_RESULT_COMPILE)
1101 terminx 1034
 
6422 hendricks2 1035
$$($1_obj)/%.$$o: $$($1_src)/%.c | $$($1_obj)
6095 hendricks2 1036
	$$(COMPILE_STATUS)
6422 hendricks2 1037
	$$(RECIPE_IF) $$(COMPILER_C) $$($1_cflags) -c $$< -o $$@ $$(RECIPE_RESULT_COMPILE)
220 terminx 1038
 
6422 hendricks2 1039
$$($1_obj)/%.$$o: $$($1_src)/%.cpp | $$($1_obj)
6095 hendricks2 1040
	$$(COMPILE_STATUS)
6422 hendricks2 1041
	$$(RECIPE_IF) $$(COMPILER_CXX) $$($1_cflags) -c $$< -o $$@ $$(RECIPE_RESULT_COMPILE)
1595 helixhorne 1042
 
6422 hendricks2 1043
$$($1_obj)/%.$$o: $$($1_src)/%.m | $$($1_obj)
6095 hendricks2 1044
	$$(COMPILE_STATUS)
6422 hendricks2 1045
	$$(RECIPE_IF) $$(COMPILER_OBJC) $$($1_cflags) -c $$< -o $$@ $$(RECIPE_RESULT_COMPILE)
1765 plagman 1046
 
6422 hendricks2 1047
$$($1_obj)/%.$$o: $$($1_src)/%.mm | $$($1_obj)
6095 hendricks2 1048
	$$(COMPILE_STATUS)
6422 hendricks2 1049
	$$(RECIPE_IF) $$(COMPILER_OBJCXX) $$($1_cflags) -c $$< -o $$@ $$(RECIPE_RESULT_COMPILE)
4543 hendricks2 1050
 
7786 hendricks2 1051
$$($1_obj)/%.$$o: $$($1_obj)/%.c | $$($1_obj)
6173 hendricks2 1052
	$$(COMPILE_STATUS)
6422 hendricks2 1053
	$$(RECIPE_IF) $$(COMPILER_C) $$($1_cflags) -c $$< -o $$@ $$(RECIPE_RESULT_COMPILE)
6173 hendricks2 1054
 
7793 pogokeen 1055
$$($1_obj)/%.$$o: $$($1_src)/%.glsl | $$($1_obj)
1056
	@echo Creating $$($1_obj)/$$(<F).cpp from $$<
7800 hendricks2 1057
	@$$(call RAW_ECHO,extern char const *$$(basename $$(<F));) > $$($1_obj)/$$(<F).cpp
1058
	@$$(call RAW_ECHO,char const *$$(basename $$(<F)) = R"shader$$(paren_open)) >> $$($1_obj)/$$(<F).cpp
7793 pogokeen 1059
	@$$(call CAT,$$<) >> $$($1_obj)/$$(<F).cpp
1060
	@$$(call RAW_ECHO,$$(paren_close)shader";) >> $$($1_obj)/$$(<F).cpp
7797 hendricks2 1061
	$$(COMPILE_STATUS)
1062
	$$(RECIPE_IF) $$(COMPILER_CXX) $$($1_cflags) -c $$($1_obj)/$$(<F).cpp -o $$@ $$(RECIPE_RESULT_COMPILE)
7782 pogokeen 1063
 
6149 hendricks2 1064
## Cosmetic stuff
4543 hendricks2 1065
 
6422 hendricks2 1066
$$($1_obj)/%.$$o: $$($1_rsrc)/%.rc | $$($1_obj)
6095 hendricks2 1067
	$$(COMPILE_STATUS)
8365 terminx 1068
	$$(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 1069
 
6422 hendricks2 1070
$$($1_obj)/%.$$o: $$($1_rsrc)/%.c | $$($1_obj)
6095 hendricks2 1071
	$$(COMPILE_STATUS)
6422 hendricks2 1072
	$$(RECIPE_IF) $$(COMPILER_C) $$($1_cflags) -c $$< -o $$@ $$(RECIPE_RESULT_COMPILE)
5197 hendricks2 1073
 
6422 hendricks2 1074
$$($1_obj)/%_banner.c: $$($1_rsrc)/%.bmp | $$($1_obj)
6095 hendricks2 1075
	echo "#include \"gtkpixdata_shim.h\"" > $$@
1076
	gdk-pixbuf-csource --extern --struct --raw --name=startbanner_pixdata $$^ | sed 's/load_inc//' >> $$@
4555 hendricks2 1077
 
6095 hendricks2 1078
endef
5765 hendricks2 1079
 
6422 hendricks2 1080
$(foreach i,$(components),$(eval $(call OBJECTRULES,$i)))
5197 hendricks2 1081
 
4555 hendricks2 1082
 
6149 hendricks2 1083
### Other special cases
4555 hendricks2 1084
 
6095 hendricks2 1085
# Comment out the following rule to debug a-c.o
6422 hendricks2 1086
$(engine_obj)/a-c.$o: $(engine_src)/a-c.cpp | $(engine_obj)
4555 hendricks2 1087
	$(COMPILE_STATUS)
6549 terminx 1088
	$(RECIPE_IF) $(subst -O$(OPTLEVEL),-O2,$(subst $(ASAN_FLAGS),,$(COMPILER_CXX))) $(engine_cflags) -c $< -o $@ $(RECIPE_RESULT_COMPILE)
4555 hendricks2 1089
 
6422 hendricks2 1090
$(engine_obj)/rev.$o: $(engine_src)/rev.cpp | $(engine_obj)
5765 hendricks2 1091
	$(COMPILE_STATUS)
6422 hendricks2 1092
	$(RECIPE_IF) $(COMPILER_CXX) $(engine_cflags) $(REVFLAG) -c $< -o $@ $(RECIPE_RESULT_COMPILE)
5765 hendricks2 1093
 
4565 hendricks2 1094
 
6149 hendricks2 1095
### Directories
4543 hendricks2 1096
 
7793 pogokeen 1097
$(foreach i,$(components),$($i_obj)):
6424 hendricks2 1098
	-$(call MKDIR,$@)
4553 hendricks2 1099
 
6149 hendricks2 1100
### Phonies
996 terminx 1101
 
6422 hendricks2 1102
clang-tools: $(filter %.c %.cpp,$(foreach i,$(call getdeps,duke3d,game),$(call expandsrcs,$i)))
6781 hendricks2 1103
	echo $^ -- -x c++ $(CXXONLYFLAGS) $(COMPILERFLAGS) $(CWARNS) $(foreach i,$(components),$($i_cflags))
6108 hendricks2 1104
 
6423 hendricks2 1105
$(addprefix clean,$(games)):
6424 hendricks2 1106
	-$(call RM,$(foreach i,$(roles),$($(subst clean,,$@)_$i)$(EXESUFFIX)))
1107
	-$(call RMDIR,$($(subst clean,,$@)_obj))
2388 helixhorne 1108
ifeq ($(PLATFORM),DARWIN)
6424 hendricks2 1109
	-$(call RMDIR,$(foreach i,$(roles),"$($(subst clean,,$@)_$i_proper).app"))
2388 helixhorne 1110
endif
5 Plagman 1111
 
6056 hendricks2 1112
cleantools:
6424 hendricks2 1113
	-$(call RM,$(addsuffix $(EXESUFFIX),$($(subst clean,,$@)_targets)))
1114
	-$(call RMDIR,$($(subst clean,,$@)_obj))
3163 hendricks2 1115
 
6056 hendricks2 1116
clean: cleanduke3d cleantools
6424 hendricks2 1117
	-$(call RMDIR,$(obj))
1118
	-$(call RM,$(ebacktrace_dll))
8094 hendricks2 1119
	-$(call RM,$(voidwrap_lib))
3163 hendricks2 1120
 
6056 hendricks2 1121
printtools:
6422 hendricks2 1122
	echo "$(addsuffix $(EXESUFFIX),$(tools_targets))"
4343 hendricks2 1123
 
6422 hendricks2 1124
rev: $(engine_obj)/rev.$o
6056 hendricks2 1125
 
1126
 
6149 hendricks2 1127
### Compatibility
6056 hendricks2 1128
 
8217 terminx 1129
cleantest: cleankenbuild
1130
cleanutils: cleantools
1131
printutils: printtools
6056 hendricks2 1132
test: kenbuild
1133
utils: tools
1134
veryclean: clean