Subversion Repositories eduke32

Rev

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