Subversion Repositories eduke32

Rev

Rev 5928 | 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
 
1739 helixhorne 5
include Makefile.common
996 terminx 6
 
4543 hendricks2 7
DUKE3D_SRC=source
8
DUKE3D_INC=$(DUKE3D_SRC)
9
DUKE3D_RSRC=rsrc
10
ENGINE_ROOT=build
11
ENGINE_SRC=$(ENGINE_ROOT)/src
12
ENGINE_INC=$(ENGINE_ROOT)/include
5 Plagman 13
o=o
4543 hendricks2 14
asm=nasm
4553 hendricks2 15
obj=obj
5 Plagman 16
 
5197 hendricks2 17
COMPILERFLAGS += -I$(ENGINE_INC) -I$(MACT_INC) -I$(AUDIOLIB_INC) -I$(ENET_INC)
4543 hendricks2 18
 
4555 hendricks2 19
 
20
# EBacktrace
21
 
22
ifndef EBACKTRACEDLL
23
    EBACKTRACEDLL = ebacktrace1.dll
24
    ifeq ($(findstring x86_64,$(COMPILERTARGET)),x86_64)
25
        EBACKTRACEDLL = ebacktrace1-64.dll
26
    endif
27
endif
28
 
29
 
4543 hendricks2 30
# BUILD Engine
31
 
5747 hendricks2 32
ENGINE=build
33
 
4543 hendricks2 34
ENGINE_CFLAGS=-I$(ENGINE_SRC)
35
 
5748 hendricks2 36
ENGINE_OBJ=$(obj)/$(ENGINE)
4543 hendricks2 37
 
5754 hendricks2 38
ENGINE_OBJS = \
39
    baselayer \
40
    cache1d \
41
    common \
42
    compat \
43
    crc32 \
44
    defs \
45
    engine \
5801 terminx 46
    tiles \
5792 terminx 47
    clip \
5790 terminx 48
    2d \
5788 terminx 49
    hash \
5789 terminx 50
    palette \
5754 hendricks2 51
    polymost \
52
    texcache \
53
    dxtfilter \
54
    hightile \
55
    textfont \
56
    smalltextfont \
57
    kplib \
58
    lz4 \
59
    osd \
60
    pragmas \
61
    scriptfile \
62
    mmulti_null \
63
    mutex \
64
    xxhash \
65
    md4 \
66
    colmatch \
5792 terminx 67
    screenshot \
68
    mhk
5754 hendricks2 69
 
70
ENGINE_EDITOR_OBJS = \
71
    build \
72
    config \
73
    defs \
74
 
4543 hendricks2 75
ifeq (0,$(NOASM))
76
  ENGINE_OBJS+= a
77
else
78
  ENGINE_OBJS+= a-c
79
  ifneq (0,$(USE_ASM64))
80
    ENGINE_OBJS+= a64
81
  endif
82
endif
83
ifeq (1,$(USE_OPENGL))
4639 terminx 84
    ENGINE_OBJS+= glbuild voxmodel mdsprite
4543 hendricks2 85
    ifeq (1,$(POLYMER))
86
        ENGINE_OBJS+= polymer
87
    endif
88
endif
4591 helixhorne 89
ifneq (0,$(LUNATIC))
4543 hendricks2 90
    ENGINE_OBJS+= lunatic
91
endif
92
ifeq ($(PLATFORM),DARWIN)
93
    ENGINE_OBJS += osxbits
5941 hendricks2 94
    ifeq ($(STARTUP_WINDOW),1)
4543 hendricks2 95
        ENGINE_EDITOR_OBJS += startosx.editor
96
    endif
5691 hendricks2 97
    ifeq ($(SDL_TARGET),1)
5778 hendricks2 98
        ifneq ($(SDL_FRAMEWORK),0)
5691 hendricks2 99
            ENGINE_OBJS+=SDLMain
100
        endif
4543 hendricks2 101
    endif
102
endif
103
ifeq ($(PLATFORM),WINDOWS)
104
    ENGINE_OBJS+= winbits
105
    ENGINE_EDITOR_OBJS+= startwin.editor
106
endif
4820 hendricks2 107
ifeq ($(PLATFORM),WII)
108
    ENGINE_OBJS+= wiibits
4821 hendricks2 109
    LINKERFLAGS+= -Wl,-wrap,c_default_exceptionhandler
4820 hendricks2 110
endif
4543 hendricks2 111
ifeq ($(RENDERTYPE),SDL)
112
    ENGINE_OBJS+= sdlayer
113
 
114
    ifeq (1,$(HAVE_GTK2))
115
        ENGINE_OBJS+= gtkbits
116
        ifeq ($(LINKED_GTK),0)
117
            ENGINE_OBJS+= dynamicgtk
118
        endif
119
        ENGINE_EDITOR_OBJS+= startgtk.editor
120
    endif
121
endif
122
ifeq ($(RENDERTYPE),WIN)
123
    ENGINE_OBJS+= winlayer rawinput
124
endif
125
 
126
ENGINE_OBJS_EXP:=$(addprefix $(ENGINE_OBJ)/,$(addsuffix .$o,$(ENGINE_OBJS)))
127
ENGINE_EDITOR_OBJS_EXP:=$(addprefix $(ENGINE_OBJ)/,$(addsuffix .$o,$(ENGINE_EDITOR_OBJS)))
128
 
129
 
4555 hendricks2 130
# MACT
131
 
5747 hendricks2 132
MACT=mact
133
 
5197 hendricks2 134
MACT_ROOT=$(DUKE3D_SRC)/jmact
135
MACT_SRC=$(MACT_ROOT)
136
MACT_INC=$(MACT_ROOT)
5748 hendricks2 137
MACT_OBJ=$(obj)/$(MACT)
4555 hendricks2 138
 
5754 hendricks2 139
MACT_OBJS = \
140
    file_lib \
141
    control \
142
    keyboard \
143
    mouse \
144
    joystick \
145
    scriplib \
146
    animlib \
4555 hendricks2 147
 
5197 hendricks2 148
MACT_OBJS_EXP:=$(addprefix $(MACT_OBJ)/,$(addsuffix .$o,$(MACT_OBJS)))
149
 
150
 
4543 hendricks2 151
# AudioLib
152
 
5747 hendricks2 153
AUDIOLIB=audiolib
154
 
5754 hendricks2 155
AUDIOLIB_OBJS = \
156
    drivers \
157
    fx_man \
158
    multivoc \
159
    mix \
160
    mixst \
161
    pitch \
162
    formats \
163
    vorbis \
164
    flac \
165
    xa \
5927 hendricks2 166
    xmp \
5754 hendricks2 167
    driver_nosound \
4543 hendricks2 168
 
169
AUDIOLIB_ROOT=$(DUKE3D_SRC)/jaudiolib
170
AUDIOLIB_SRC=$(AUDIOLIB_ROOT)/src
171
AUDIOLIB_INC=$(AUDIOLIB_ROOT)/include
5748 hendricks2 172
AUDIOLIB_OBJ=$(obj)/$(AUDIOLIB)
4543 hendricks2 173
 
4713 terminx 174
AUDIOLIB_CFLAGS=-I$(AUDIOLIB_ROOT)/third-party/common/include
4543 hendricks2 175
 
176
ifeq ($(PLATFORM),WINDOWS)
177
    ifeq ($(MIXERTYPE),WIN)
178
        AUDIOLIB_OBJS+= driver_directsound
179
    endif
180
endif
181
 
182
ifeq ($(MIXERTYPE),SDL)
183
    ifneq ($(PLATFORM),DARWIN)
184
        ifneq ($(PLATFORM),WINDOWS)
185
            ifneq ($(PLATFORM),WII)
5780 hendricks2 186
                AUDIOLIB_CFLAGS+=`$(PKG_CONFIG) --cflags vorbis`
4543 hendricks2 187
            endif
188
        endif
189
    endif
190
    AUDIOLIB_OBJS+= driver_sdl
191
endif
192
 
193
AUDIOLIB_OBJS_EXP:=$(addprefix $(AUDIOLIB_OBJ)/,$(addsuffix .$o,$(AUDIOLIB_OBJS)))
194
 
195
 
196
# ENet
197
 
5747 hendricks2 198
ENET=enet
199
 
5754 hendricks2 200
ENET_OBJS = \
201
    callbacks \
202
    host \
203
    list \
204
    packet \
205
    peer \
206
    protocol \
207
    compress \
4543 hendricks2 208
 
209
ENET_ROOT=$(DUKE3D_SRC)/enet
210
ENET_SRC=$(ENET_ROOT)/src
211
ENET_INC=$(ENET_ROOT)/include
5748 hendricks2 212
ENET_OBJ=$(obj)/$(ENET)
4553 hendricks2 213
 
4543 hendricks2 214
ENET_CFLAGS=
215
 
216
ifeq ($(PLATFORM),WINDOWS)
217
    ENET_OBJS += win32
218
else
219
    ENET_OBJS += unix
220
    ENET_CFLAGS += -DHAS_SOCKLEN_T
221
endif
222
 
223
ENET_OBJS_EXP:=$(addprefix $(ENET_OBJ)/,$(addsuffix .$o,$(ENET_OBJS)))
224
 
4555 hendricks2 225
ifeq ($(NETCODE),0)
226
    ENET_TARGET=
227
else
228
    ENET_TARGET=$(ENET_OBJS_EXP)
229
endif
4543 hendricks2 230
 
4555 hendricks2 231
 
4543 hendricks2 232
# Tools
233
 
5754 hendricks2 234
UTIL_OBJS = \
235
    compat \
236
    pragmas \
237
    kplib \
238
    cache1d \
239
    crc32 \
240
    colmatch \
241
    compat_tools \
4543 hendricks2 242
 
5754 hendricks2 243
UTILS= \
244
    kextract \
245
    kgroup \
246
    transpal \
247
    wad2art \
248
    wad2map \
249
    kmd2tool \
250
    md2tool \
251
    generateicon \
252
    cacheinfo \
253
    arttool \
254
    givedepth \
255
    mkpalette \
256
    unpackssi \
257
    bsuite \
258
 
259
GAMEUTILS= \
260
    ivfrate \
261
 
262
DXUTILS= \
263
    enumdisplay \
264
    getdxdidf \
265
 
266
SDLUTILS= \
267
    makesdlkeytrans \
268
 
5361 hendricks2 269
ifeq ($(PLATFORM),DARWIN)
270
    UTIL_OBJS += osxbits
271
endif
272
 
4543 hendricks2 273
UTIL_OBJS_EXP:=$(addprefix $(ENGINE_OBJ)/,$(addsuffix .$o,$(UTIL_OBJS)))
274
 
275
 
4555 hendricks2 276
# KenBuild (Test Game)
4543 hendricks2 277
 
5747 hendricks2 278
KENBUILD=kenbuild
279
 
5745 hendricks2 280
KENBUILD_ROOT=$(DUKE3D_SRC)/testgame
281
KENBUILD_SRC=$(KENBUILD_ROOT)/src
282
KENBUILD_RSRC=$(KENBUILD_ROOT)/rsrc
5748 hendricks2 283
KENBUILD_OBJ=$(obj)/$(KENBUILD)
4555 hendricks2 284
 
5745 hendricks2 285
KENBUILD_CFLAGS=-I$(KENBUILD_SRC)
4555 hendricks2 286
 
5745 hendricks2 287
KENBUILD_GAME ?= kenbuild
288
KENBUILD_EDITOR ?= kenbuild-editor
4555 hendricks2 289
 
5746 hendricks2 290
KENBUILD_GAME_PROPER ?= KenBuild
291
KENBUILD_EDITOR_PROPER ?= KenBuild Editor
292
 
5754 hendricks2 293
KENBUILD_GAME_OBJS = \
294
    game \
295
    sound_stub \
296
    common \
297
    config \
4555 hendricks2 298
 
5754 hendricks2 299
KENBUILD_EDITOR_OBJS = \
300
    bstub \
301
    common \
302
 
4555 hendricks2 303
ifeq ($(RENDERTYPE),SDL)
5744 hendricks2 304
    ifeq (1,$(HAVE_GTK2))
5745 hendricks2 305
        KENBUILD_GAME_OBJS+= game_banner startgtk.game
306
        KENBUILD_EDITOR_OBJS+= build_banner
5744 hendricks2 307
    endif
4555 hendricks2 308
 
5745 hendricks2 309
    KENBUILD_GAME_OBJS+= game_icon
310
    KENBUILD_EDITOR_OBJS+= build_icon
5 Plagman 311
endif
4555 hendricks2 312
ifeq ($(PLATFORM),WINDOWS)
5745 hendricks2 313
    KENBUILD_GAME_OBJS+= gameres startwin.game
314
    KENBUILD_EDITOR_OBJS+= buildres
4555 hendricks2 315
endif
5 Plagman 316
 
5740 hendricks2 317
ifeq ($(PLATFORM),DARWIN)
5941 hendricks2 318
    ifeq ($(STARTUP_WINDOW),1)
5745 hendricks2 319
        KENBUILD_GAME_OBJS += StartupWinController.game
5740 hendricks2 320
    endif
321
endif
322
 
5745 hendricks2 323
KENBUILD_GAME_OBJS_EXP:=$(addprefix $(KENBUILD_OBJ)/,$(addsuffix .$o,$(KENBUILD_GAME_OBJS)))
324
KENBUILD_EDITOR_OBJS_EXP:=$(addprefix $(KENBUILD_OBJ)/,$(addsuffix .$o,$(KENBUILD_EDITOR_OBJS)))
1739 helixhorne 325
 
4555 hendricks2 326
 
327
# Duke Nukem 3D
328
 
5747 hendricks2 329
DUKE3D=duke3d
330
 
4555 hendricks2 331
DUKE3D_CFLAGS=-I$(DUKE3D_INC)
332
 
5745 hendricks2 333
DUKE3D_GAME_LDFLAGS=
334
DUKE3D_EDITOR_LDFLAGS=
1739 helixhorne 335
 
5749 hendricks2 336
DUKE3D_GAME_STRIPFLAGS=
337
DUKE3D_EDITOR_STRIPFLAGS=
338
 
5748 hendricks2 339
DUKE3D_OBJ=$(obj)/$(DUKE3D)
3219 hendricks2 340
 
5745 hendricks2 341
DUKE3D_GAME ?= eduke32
342
DUKE3D_EDITOR ?= mapster32
3096 hendricks2 343
 
5746 hendricks2 344
DUKE3D_GAME_PROPER ?= EDuke32
345
DUKE3D_EDITOR_PROPER ?= Mapster32
346
 
5754 hendricks2 347
COMMON_GAME_OBJS = \
348
    rev \
3096 hendricks2 349
 
5754 hendricks2 350
COMMON_EDITOR_OBJS = \
351
    m32common \
352
    m32def \
353
    m32exec \
354
    m32vars \
355
    rev \
5 Plagman 356
 
5754 hendricks2 357
DUKE3D_GAME_OBJS = \
358
    game \
359
    global \
360
    actors \
361
    gamedef \
362
    gameexec \
363
    gamevars \
364
    player \
365
    premap \
366
    sector \
367
    anim \
368
    animsounds \
369
    common \
370
    config \
371
    demo \
372
    input \
373
    menus \
374
    namesdyn \
375
    net \
376
    savegame \
377
    rts \
378
    osdfuncs \
379
    osdcmds \
380
    grpscan \
381
    sounds \
382
    soundsdyn \
383
    cheats \
384
    sbar \
385
    screentext \
386
    screens \
387
    cmdline \
388
 
389
DUKE3D_EDITOR_OBJS = \
390
    astub \
391
    common \
392
    grpscan \
393
    sounds_mapster32 \
394
 
1933 helixhorne 395
ifneq ($(USE_LIBVPX),0)
5745 hendricks2 396
    DUKE3D_GAME_OBJS+= animvpx
1933 helixhorne 397
endif
2034 helixhorne 398
 
5745 hendricks2 399
DUKE3D_GAME_MISCDEPS=
4543 hendricks2 400
DUKE3D_EDITOR_MISCDEPS=
2143 helixhorne 401
 
4591 helixhorne 402
# Lunatic object base names. These are not used in targets directly.
5754 hendricks2 403
LUNATIC_OBJS = \
404
    luaJIT_BC_defs_common \
405
    luaJIT_BC_engine_maptext \
406
    luaJIT_BC_engine \
407
    luaJIT_BC_bcarray \
408
    luaJIT_BC_bcheck \
409
    luaJIT_BC_bitar \
410
    luaJIT_BC_xmath \
411
    luaJIT_BC_v \
412
    luaJIT_BC_dump \
413
    luaJIT_BC_dis_x86 \
414
    luaJIT_BC_dis_x64 \
2148 helixhorne 415
 
5754 hendricks2 416
LUNATIC_GAME_OBJS = \
417
    luaJIT_BC_con_lang \
418
    luaJIT_BC_lunacon \
419
    luaJIT_BC_randgen \
420
    luaJIT_BC_stat \
421
    luaJIT_BC_control \
422
    luaJIT_BC_defs \
423
    luaJIT_BC_savegame \
424
    luaJIT_BC_fs \
425
 
2143 helixhorne 426
## Lunatic devel
2034 helixhorne 427
ifneq (0,$(LUNATIC))
4237 helixhorne 428
    # TODO: remove debugging modules from release build
429
 
5745 hendricks2 430
    DUKE3D_EDITOR_OBJS+= lunatic_m32 $(LUNATIC_OBJS)
431
    DUKE3D_GAME_OBJS+= lunatic_game $(LUNATIC_OBJS)
2143 helixhorne 432
 
4543 hendricks2 433
    DUKE3D_EDITOR_OBJS+= luaJIT_BC_defs_m32
4237 helixhorne 434
 
3938 helixhorne 435
    ifneq ($(PLATFORM),WINDOWS)
436
        # On non-Windows, we expect to have liblpeg.a (or a symlink to it) in source/.
4319 hendricks2 437
        # On Windows, it will reside in platform/Windows/lib/32/ or lib/64/.
4553 hendricks2 438
        LIBDIRS+= -L$(DUKE3D_SRC)
4543 hendricks2 439
        ifeq ($(realpath $(DUKE3D_SRC)/liblpeg.a),)
3938 helixhorne 440
            # XXX: This cripples "make clean" etc. too, but IMO it's better than warning.
4543 hendricks2 441
            $(error "liblpeg.a not found in $(realpath $(DUKE3D_OBJ)/..)")
3938 helixhorne 442
        endif
443
    endif
444
    LIBS+= -llpeg
5745 hendricks2 445
    DUKE3D_GAME_OBJS+= $(LUNATIC_GAME_OBJS)
2650 helixhorne 446
 
2143 helixhorne 447
    # now, take care of having the necessary symbols (sector, wall, etc.) in the
448
    # executable no matter what the debugging level
449
 
2074 helixhorne 450
    ifeq ($(PLATFORM),DARWIN)
2143 helixhorne 451
        # strip on OSX says: removing global symbols from a final linked no longer supported.
452
        #                    Use -exported_symbols_list at link time when building
453
        # But, following _their_ directions does not give us the symbols! wtf?
5749 hendricks2 454
        DUKE3D_GAME_STRIPFLAGS+= -s $(DUKE3D_OBJ)/lunatic_dynsymlist_osx
455
        DUKE3D_EDITOR_STRIPFLAGS+= -s $(DUKE3D_OBJ)/lunatic_dynsymlist_m32_osx
2143 helixhorne 456
 
5749 hendricks2 457
        DUKE3D_GAME_MISCDEPS+= $(DUKE3D_OBJ)/lunatic_dynsymlist_osx
458
        DUKE3D_EDITOR_MISCDEPS+= $(DUKE3D_OBJ)/lunatic_dynsymlist_m32_osx
459
        LINKERFLAGS+= -pagezero_size 10000 -image_base 100000000
460
        # DUKE3D_GAME_LDFLAGS+= #-Wl,-alias_list -Wl,$(DUKE3D_OBJ)/lunatic_aliases_list #-exported_symbols_list $(DUKE3D_OBJ)/lunatic_dynsymlist_osx
2143 helixhorne 461
    endif
462
    ifeq ($(PLATFORM),WINDOWS)
3423 helixhorne 463
        override STRIP=
5749 hendricks2 464
        DUKE3D_GAME_MISCDEPS+= $(DUKE3D_OBJ)/lunatic_eduke32.def
465
        DUKE3D_EDITOR_MISCDEPS+= $(DUKE3D_OBJ)/lunatic_mapster32.def
2143 helixhorne 466
    endif
3272 hendricks2 467
    ifeq ($(SUBPLATFORM),LINUX)
3423 helixhorne 468
        override STRIP=
5745 hendricks2 469
        DUKE3D_GAME_LDFLAGS+= -Wl,--dynamic-list=$(DUKE3D_SRC)/lunatic/dynsymlist
470
        DUKE3D_EDITOR_LDFLAGS+= -Wl,--dynamic-list=$(DUKE3D_SRC)/lunatic/dynsymlist_m32
2074 helixhorne 471
    endif
2034 helixhorne 472
endif
473
 
3272 hendricks2 474
ifeq ($(SUBPLATFORM),LINUX)
5927 hendricks2 475
    ifneq (0,$(HAVE_XMP))
476
        LIBS += -lxmp-lite
477
    endif
5037 hendricks2 478
    LIBS += -lFLAC -lvorbisfile -lvorbis -logg
996 terminx 479
endif
480
 
5037 hendricks2 481
ifeq ($(PLATFORM),BSD)
5927 hendricks2 482
    ifneq (0,$(HAVE_XMP))
483
        LIBS += -lxmp-lite
484
    endif
5037 hendricks2 485
    LIBS += -lFLAC -lvorbisfile -lvorbis -logg -lexecinfo
486
endif
487
 
996 terminx 488
ifeq ($(PLATFORM),DARWIN)
4646 hendricks2 489
    # LIBDIRS += -L$(AUDIOLIB_ROOT)/third-party/Apple/lib
2537 hendricks2 490
 
5927 hendricks2 491
    ifneq (0,$(HAVE_XMP))
492
        LIBS += -lxmp-lite
493
    endif
4543 hendricks2 494
    LIBS += -lFLAC -lvorbisfile -lvorbis -logg -lm \
495
            -Wl,-framework,Cocoa -Wl,-framework,Carbon -Wl,-framework,OpenGL \
5078 terminx 496
            -Wl,-framework,CoreMIDI -Wl,-framework,AudioUnit \
4548 hendricks2 497
            -Wl,-framework,AudioToolbox -Wl,-framework,IOKit -Wl,-framework,AGL
498
    ifneq (00,$(DARWIN9)$(DARWIN10))
499
        LIBS += -Wl,-framework,QuickTime -lm
500
    endif
2537 hendricks2 501
 
5941 hendricks2 502
    ifeq ($(STARTUP_WINDOW),1)
5745 hendricks2 503
        DUKE3D_GAME_OBJS += GrpFile.game GameListSource.game startosx.game
2426 hendricks2 504
    endif
996 terminx 505
endif
506
 
5 Plagman 507
ifeq ($(PLATFORM),WINDOWS)
5927 hendricks2 508
    ifneq (0,$(HAVE_XMP))
509
        LIBS += -lxmp-lite
510
    endif
5341 hendricks2 511
    LIBS += -lFLAC -lvorbisfile -lvorbis -logg
4553 hendricks2 512
    LIBDIRS += -L$(AUDIOLIB_ROOT)/third-party/Windows/lib$(WINLIB)
5928 terminx 513
    ifeq ($(STARTUP_WINDOW),1)
514
        DUKE3D_GAME_OBJS+= gameres winbits startwin.game
515
        DUKE3D_EDITOR_OBJS+= buildres
516
    else
517
        DUKE3D_GAME_OBJS+= winbits
518
    endif
4084 hendricks2 519
    ifeq ($(MIXERTYPE),WIN)
3219 hendricks2 520
        LIBS+= -ldsound
5213 hendricks2 521
        MIDI_OBJS=music midi mpu401
3219 hendricks2 522
    endif
523
endif
4543 hendricks2 524
 
525
ifeq ($(PLATFORM),WII)
526
    LIBS += -lvorbisidec
527
endif
528
 
3219 hendricks2 529
ifeq ($(RENDERTYPE),SDL)
4084 hendricks2 530
    ifeq (1,$(HAVE_GTK2))
5745 hendricks2 531
        DUKE3D_GAME_OBJS+= game_banner startgtk.game
4770 hendricks2 532
        DUKE3D_EDITOR_OBJS+= build_banner
4084 hendricks2 533
    endif
534
 
5745 hendricks2 535
    DUKE3D_GAME_OBJS+= game_icon
5253 hendricks2 536
    DUKE3D_EDITOR_OBJS+= build_icon
4084 hendricks2 537
endif
538
ifeq ($(MIXERTYPE),SDL)
5213 hendricks2 539
    MIDI_OBJS=sdlmusic
5 Plagman 540
endif
541
 
4591 helixhorne 542
## Construct file names of object files
1473 terminx 543
 
5745 hendricks2 544
COMMON_OBJS_EXP:=$(addprefix $(DUKE3D_OBJ)/,$(addsuffix .$o,$(COMMON_GAME_OBJS)))
4555 hendricks2 545
COMMON_EDITOR_OBJS_EXP:=$(addprefix $(DUKE3D_OBJ)/,$(addsuffix .$o,$(COMMON_EDITOR_OBJS)))
546
 
5213 hendricks2 547
MIDI_OBJS_EXP:=$(addprefix $(DUKE3D_OBJ)/,$(addsuffix .$o,$(MIDI_OBJS)))
548
 
5745 hendricks2 549
DUKE3D_GAME_OBJS_EXP:=$(addprefix $(DUKE3D_OBJ)/,$(addsuffix .$o,$(DUKE3D_GAME_OBJS)))
4543 hendricks2 550
DUKE3D_EDITOR_OBJS_EXP:=$(addprefix $(DUKE3D_OBJ)/,$(addsuffix .$o,$(DUKE3D_EDITOR_OBJS)))
5 Plagman 551
 
1595 helixhorne 552
 
5197 hendricks2 553
# Shadow Warrior
554
 
5747 hendricks2 555
SW=sw
556
 
5197 hendricks2 557
SW_ROOT=$(DUKE3D_SRC)/sw
558
SW_SRC=$(SW_ROOT)/src
559
SW_INC=$(SW_SRC)
560
SW_RSRC=$(SW_ROOT)/rsrc
5748 hendricks2 561
SW_OBJ=$(obj)/$(SW)
5197 hendricks2 562
 
563
SW_CFLAGS=-I$(SW_INC)
564
 
5745 hendricks2 565
SW_GAME ?= voidsw
5197 hendricks2 566
SW_EDITOR ?= voidsw-editor
567
 
5746 hendricks2 568
SW_GAME_PROPER ?= VoidSW
569
SW_EDITOR_PROPER ?= VoidSW Editor
570
 
5754 hendricks2 571
SW_GAME_OBJS = \
572
    actor \
573
    ai \
574
    anim \
575
    border \
576
    break \
577
    bunny \
578
    cache \
579
    cheats \
580
    colormap \
581
    common \
582
    config \
583
    console \
584
    coolg \
585
    coolie \
586
    copysect \
587
    demo \
588
    draw \
589
    eel \
590
    game \
591
    girlninj \
592
    goro \
593
    grpscan \
594
    hornet \
595
    interp \
596
    interpsh \
597
    inv \
598
    jplayer \
599
    jsector \
600
    jweapon \
601
    lava \
602
    light \
603
    mclip \
604
    mdastr \
605
    menus \
606
    miscactr \
607
    morph \
608
    net \
609
    ninja \
610
    panel \
611
    player \
612
    predict \
613
    quake \
614
    ripper \
615
    ripper2 \
616
    rooms \
617
    rotator \
618
    rts \
619
    save \
620
    scrip2 \
621
    sector \
622
    serp \
623
    setup \
624
    skel \
625
    skull \
626
    slidor \
627
    sounds \
628
    spike \
629
    sprite \
630
    sumo \
631
    swconfig \
632
    sync \
633
    text \
634
    track \
635
    vator \
636
    vis \
637
    wallmove \
638
    warp \
639
    weapon \
640
    zilla \
641
    zombie \
642
    saveable \
5197 hendricks2 643
 
5754 hendricks2 644
SW_EDITOR_OBJS = \
645
    jnstub \
646
    brooms \
647
    bldscript \
648
    jbhlp \
649
    colormap \
650
    grpscan \
651
    common \
652
 
5197 hendricks2 653
ifeq ($(RENDERTYPE),SDL)
654
    ifeq (1,$(HAVE_GTK2))
5745 hendricks2 655
        SW_GAME_OBJS+= game_banner startgtk.game
5197 hendricks2 656
        SW_EDITOR_OBJS+= build_banner
657
    endif
658
 
5745 hendricks2 659
    SW_GAME_OBJS+= game_icon
5197 hendricks2 660
    SW_EDITOR_OBJS+= game_icon
661
endif
662
ifeq ($(PLATFORM),WINDOWS)
5745 hendricks2 663
    SW_GAME_OBJS+= gameres startwin.game
5744 hendricks2 664
    SW_EDITOR_OBJS+= buildres
5197 hendricks2 665
endif
666
 
5745 hendricks2 667
SW_GAME_OBJS_EXP:=$(addprefix $(SW_OBJ)/,$(addsuffix .$o,$(SW_GAME_OBJS)))
5197 hendricks2 668
SW_EDITOR_OBJS_EXP:=$(addprefix $(SW_OBJ)/,$(addsuffix .$o,$(SW_EDITOR_OBJS)))
669
 
670
 
1103 terminx 671
ifeq ($(PRETTY_OUTPUT),1)
1101 terminx 672
.SILENT:
1103 terminx 673
endif
5197 hendricks2 674
.PHONY: all duke3d test sw veryclean clean cleanduke3d cleantest cleansw cleanutils utils dxutils sdlutils printutils printsdlutils printdxutils rev $(DUKE3D_OBJ)/rev.$o
5 Plagman 675
 
676
# TARGETS
677
 
5197 hendricks2 678
all: duke3d
679
 
5745 hendricks2 680
duke3d: start $(DUKE3D_GAME)$(EXESUFFIX) $(DUKE3D_EDITOR)$(EXESUFFIX)
681
	@ls -l $(DUKE3D_GAME)$(EXESUFFIX)
682
	@ls -l $(DUKE3D_EDITOR)$(EXESUFFIX)
3236 hendricks2 683
 
5745 hendricks2 684
test: start $(KENBUILD_GAME)$(EXESUFFIX) $(KENBUILD_EDITOR)$(EXESUFFIX)
685
	@ls -l $(KENBUILD_GAME)$(EXESUFFIX)
686
	@ls -l $(KENBUILD_EDITOR)$(EXESUFFIX)
4555 hendricks2 687
 
5745 hendricks2 688
sw: start $(SW_GAME)$(EXESUFFIX) $(SW_EDITOR)$(EXESUFFIX)
689
	@ls -l $(SW_GAME)$(EXESUFFIX)
5197 hendricks2 690
	@ls -l $(SW_EDITOR)$(EXESUFFIX)
691
 
5742 hendricks2 692
ebacktrace: start $(EBACKTRACEDLL)
3163 hendricks2 693
	@ls -l $(EBACKTRACEDLL)
1101 terminx 694
 
3163 hendricks2 695
start:
1102 terminx 696
	$(BUILD_STARTED)
1595 helixhorne 697
 
4543 hendricks2 698
utils: $(addsuffix $(EXESUFFIX),$(UTILS) $(GAMEUTILS))
699
	@ls -l $^
3163 hendricks2 700
 
4543 hendricks2 701
dxutils: $(addsuffix $(EXESUFFIX),$(DXUTILS))
702
	@ls -l $^
703
 
704
sdlutils: $(addsuffix $(EXESUFFIX),$(SDLUTILS))
705
	@ls -l $^
706
 
4824 hendricks2 707
ifeq ($(PLATFORM),WII)
708
ifneq ($(ELF2DOL),)
5745 hendricks2 709
$(KENBUILD_GAME)$(DOLSUFFIX): $(KENBUILD_GAME)$(EXESUFFIX)
710
$(KENBUILD_EDITOR)$(DOLSUFFIX): $(KENBUILD_EDITOR)$(EXESUFFIX)
711
$(DUKE3D_GAME)$(DOLSUFFIX): $(DUKE3D_GAME)$(EXESUFFIX)
712
$(DUKE3D_EDITOR)$(DOLSUFFIX): $(DUKE3D_EDITOR)$(EXESUFFIX)
713
$(SW_GAME)$(DOLSUFFIX): $(SW_GAME)$(EXESUFFIX)
5197 hendricks2 714
$(SW_EDITOR)$(DOLSUFFIX): $(SW_EDITOR)$(EXESUFFIX)
4824 hendricks2 715
endif
716
endif
717
 
5745 hendricks2 718
$(KENBUILD_GAME)$(EXESUFFIX): $(KENBUILD_GAME_OBJS_EXP) $(COMMON_OBJS_EXP) $(ENGINE_OBJS_EXP)
1102 terminx 719
	$(LINK_STATUS)
5751 hendricks2 720
	$(RECIPE_IF) $(LINKER) -o $@ $^ $(COMMONFLAGS) $(LINKERFLAGS) $(GUI_LIBS) $(LIBDIRS) $(LIBS) $(RECIPE_RESULT_LINK)
4824 hendricks2 721
ifeq ($(PLATFORM),WII)
722
ifneq ($(ELF2DOL),)
5745 hendricks2 723
	$(ELF2DOL) $(KENBUILD_GAME)$(EXESUFFIX) $(KENBUILD_GAME)$(DOLSUFFIX)
4824 hendricks2 724
endif
725
endif
4555 hendricks2 726
ifneq ($(STRIP),)
5197 hendricks2 727
	$(STRIP) $@
4555 hendricks2 728
endif
729
 
5745 hendricks2 730
$(KENBUILD_EDITOR)$(EXESUFFIX): $(KENBUILD_EDITOR_OBJS_EXP) $(COMMON_EDITOR_OBJS_EXP) $(ENGINE_EDITOR_OBJS_EXP) $(ENGINE_OBJS_EXP)
4555 hendricks2 731
	$(LINK_STATUS)
5751 hendricks2 732
	$(RECIPE_IF) $(LINKER) -o $@ $^ $(COMMONFLAGS) $(LINKERFLAGS) $(GUI_LIBS) $(LIBDIRS) $(LIBS) $(RECIPE_RESULT_LINK)
4824 hendricks2 733
ifeq ($(PLATFORM),WII)
734
ifneq ($(ELF2DOL),)
5745 hendricks2 735
	$(ELF2DOL) $(KENBUILD_EDITOR)$(EXESUFFIX) $(KENBUILD_EDITOR)$(DOLSUFFIX)
4824 hendricks2 736
endif
737
endif
4555 hendricks2 738
ifneq ($(STRIP),)
5197 hendricks2 739
	$(STRIP) $@
4555 hendricks2 740
endif
741
 
5745 hendricks2 742
$(DUKE3D_GAME)$(EXESUFFIX): $(DUKE3D_GAME_OBJS_EXP) $(COMMON_OBJS_EXP) $(MIDI_OBJS_EXP) $(ENGINE_OBJS_EXP) $(MACT_OBJS_EXP) $(AUDIOLIB_OBJS_EXP) $(ENET_TARGET) $(DUKE3D_GAME_MISCDEPS)
4555 hendricks2 743
	$(LINK_STATUS)
5751 hendricks2 744
	$(RECIPE_IF) $(LINKER) -o $@ $^ $(COMMONFLAGS) $(LINKERFLAGS) $(GUI_LIBS) $(DUKE3D_GAME_LDFLAGS) $(LIBDIRS) $(LIBS) $(RECIPE_RESULT_LINK)
4824 hendricks2 745
ifeq ($(PLATFORM),WII)
746
ifneq ($(ELF2DOL),)
5745 hendricks2 747
	$(ELF2DOL) $(DUKE3D_GAME)$(EXESUFFIX) $(DUKE3D_GAME)$(DOLSUFFIX)
4824 hendricks2 748
endif
749
endif
3422 helixhorne 750
ifneq ($(STRIP),)
5749 hendricks2 751
	$(STRIP) $@ $(DUKE3D_GAME_STRIPFLAGS)
1101 terminx 752
endif
2385 hendricks2 753
ifeq ($(PLATFORM),DARWIN)
5746 hendricks2 754
	cp -RPf "platform/Apple/bundles/$(DUKE3D_GAME_PROPER).app" "./"
755
	mkdir -p "$(DUKE3D_GAME_PROPER).app/Contents/MacOS"
756
	cp -f "$(DUKE3D_GAME)$(EXESUFFIX)" "$(DUKE3D_GAME_PROPER).app/Contents/MacOS/"
2385 hendricks2 757
endif
1595 helixhorne 758
 
5745 hendricks2 759
$(DUKE3D_EDITOR)$(EXESUFFIX): $(DUKE3D_EDITOR_OBJS_EXP) $(COMMON_EDITOR_OBJS_EXP) $(ENGINE_EDITOR_OBJS_EXP) $(ENGINE_OBJS_EXP) $(AUDIOLIB_OBJS_EXP) $(DUKE3D_EDITOR_MISCDEPS)
1102 terminx 760
	$(LINK_STATUS)
5751 hendricks2 761
	$(RECIPE_IF) $(LINKER) -o $@ $^ $(COMMONFLAGS) $(LINKERFLAGS) $(GUI_LIBS) $(DUKE3D_EDITOR_LDFLAGS) $(LIBDIRS) $(LIBS) $(RECIPE_RESULT_LINK)
4824 hendricks2 762
ifeq ($(PLATFORM),WII)
763
ifneq ($(ELF2DOL),)
5745 hendricks2 764
	$(ELF2DOL) $(DUKE3D_EDITOR)$(EXESUFFIX) $(DUKE3D_EDITOR)$(DOLSUFFIX)
4824 hendricks2 765
endif
766
endif
3422 helixhorne 767
ifneq ($(STRIP),)
5749 hendricks2 768
	$(STRIP) $@ $(DUKE3D_EDITOR_STRIPFLAGS)
1693 helixhorne 769
endif
2385 hendricks2 770
ifeq ($(PLATFORM),DARWIN)
5746 hendricks2 771
	cp -RPf "platform/Apple/bundles/$(DUKE3D_EDITOR_PROPER).app" "./"
772
	mkdir -p "$(DUKE3D_EDITOR_PROPER).app/Contents/MacOS"
773
	cp -f "$(DUKE3D_EDITOR)$(EXESUFFIX)" "$(DUKE3D_EDITOR_PROPER).app/Contents/MacOS/"
2385 hendricks2 774
endif
5 Plagman 775
 
5745 hendricks2 776
$(SW_GAME)$(EXESUFFIX): $(SW_GAME_OBJS_EXP) $(COMMON_OBJS_EXP) $(MIDI_OBJS_EXP) $(ENGINE_OBJS_EXP) $(MACT_OBJS_EXP) $(AUDIOLIB_OBJS_EXP)
5197 hendricks2 777
	$(LINK_STATUS)
5751 hendricks2 778
	$(RECIPE_IF) $(LINKER) -o $@ $^ $(COMMONFLAGS) $(LINKERFLAGS) $(GUI_LIBS) $(LIBDIRS) $(LIBS) $(RECIPE_RESULT_LINK)
5197 hendricks2 779
ifeq ($(PLATFORM),WII)
780
ifneq ($(ELF2DOL),)
5745 hendricks2 781
	$(ELF2DOL) $(SW_GAME)$(EXESUFFIX) $(SW_GAME)$(DOLSUFFIX)
5197 hendricks2 782
endif
783
endif
784
ifneq ($(STRIP),)
785
	$(STRIP) $@
786
endif
787
 
788
$(SW_EDITOR)$(EXESUFFIX): $(SW_EDITOR_OBJS_EXP) $(COMMON_EDITOR_OBJS_EXP) $(ENGINE_EDITOR_OBJS_EXP) $(ENGINE_OBJS_EXP)
789
	$(LINK_STATUS)
5751 hendricks2 790
	$(RECIPE_IF) $(LINKER) -o $@ $^ $(COMMONFLAGS) $(LINKERFLAGS) $(GUI_LIBS) $(LIBDIRS) $(LIBS) $(RECIPE_RESULT_LINK)
5197 hendricks2 791
ifeq ($(PLATFORM),WII)
792
ifneq ($(ELF2DOL),)
793
	$(ELF2DOL) $(SW_EDITOR)$(EXESUFFIX) $(SW_EDITOR)$(DOLSUFFIX)
794
endif
795
endif
796
ifneq ($(STRIP),)
797
	$(STRIP) $@
798
endif
799
 
800
include $(ENGINE_ROOT)/Makefile.deps
5 Plagman 801
include Makefile.deps
5197 hendricks2 802
include $(SW_ROOT)/Makefile.deps
5 Plagman 803
 
804
# RULES
3057 helixhorne 805
 
3551 terminx 806
$(EBACKTRACEDLL): platform/Windows/src/backtrace.c
3163 hendricks2 807
	$(COMPILE_STATUS)
4543 hendricks2 808
	$(RECIPE_IF) $(CC) $(CONLYFLAGS) -O2 -ggdb -shared -Wall -Wextra -static-libgcc -I$(ENGINE_INC) -o $@ $^ -lbfd -liberty -limagehlp $(RECIPE_RESULT_COMPILE)
2037 helixhorne 809
 
4543 hendricks2 810
libcache1d$(DLLSUFFIX): $(ENGINE_SRC)/cache1d.c
1102 terminx 811
	$(COMPILE_STATUS)
4543 hendricks2 812
	$(RECIPE_IF) $(COMPILER) -Wall -Wextra -DCACHE1D_COMPRESS_ONLY -shared -fPIC $< -o $@ $(RECIPE_RESULT_COMPILE)
1693 helixhorne 813
 
5753 hendricks2 814
%$(EXESUFFIX): $(ENGINE_OBJ)/%.$o $(UTIL_OBJS_EXP) | $(ENGINE_OBJ)
4543 hendricks2 815
	$(ONESTEP_STATUS)
5360 hendricks2 816
	$(RECIPE_IF) $(LINKER) -o $@ $^ $(COMMONFLAGS) $(LINKERFLAGS) $(LIBDIRS) $(LIBS) $(RECIPE_RESULT_ONESTEP)
1101 terminx 817
 
5753 hendricks2 818
%$(EXESUFFIX): $(DUKE3D_OBJ)/%.$o | $(DUKE3D_OBJ)
4543 hendricks2 819
	$(ONESTEP_STATUS)
5360 hendricks2 820
	$(RECIPE_IF) $(LINKER) -o $@ $^ $(COMMONFLAGS) $(LINKERFLAGS) $(LIBDIRS) $(LIBS) $(RECIPE_RESULT_ONESTEP)
4194 helixhorne 821
 
4543 hendricks2 822
enumdisplay$(EXESUFFIX): $(ENGINE_OBJ)/enumdisplay.$o
823
	$(ONESTEP_STATUS)
5360 hendricks2 824
	$(RECIPE_IF) $(LINKER) -o $@ $^ $(COMMONFLAGS) $(LINKERFLAGS) $(LIBDIRS) $(LIBS) -lgdi32 $(RECIPE_RESULT_ONESTEP)
4543 hendricks2 825
getdxdidf$(EXESUFFIX): $(ENGINE_OBJ)/getdxdidf.$o
826
	$(ONESTEP_STATUS)
5360 hendricks2 827
	$(RECIPE_IF) $(LINKER) -o $@ $^ $(COMMONFLAGS) $(LINKERFLAGS) $(LIBDIRS) $(LIBS) -ldinput $(RECIPE_RESULT_ONESTEP)
4543 hendricks2 828
makesdlkeytrans$(EXESUFFIX): $(ENGINE_OBJ)/makesdlkeytrans.$o
829
	$(ONESTEP_STATUS)
5778 hendricks2 830
	$(RECIPE_IF) $(LINKER) -o $@ $^ $(COMMONFLAGS) $(LINKERFLAGS) $(LIBDIRS) $(LIBS) $(RECIPE_RESULT_ONESTEP)
4543 hendricks2 831
arttool$(EXESUFFIX): $(ENGINE_OBJ)/arttool.$o
832
	$(ONESTEP_STATUS)
5752 hendricks2 833
	$(RECIPE_IF) $(L_CXX) $(CXXONLYFLAGS) $(L_CXXONLYFLAGS) -o $@ $^ $(COMMONFLAGS) $(LINKERFLAGS) $(LIBDIRS) $(LIBS) $(STDCPPLIB) $(RECIPE_RESULT_ONESTEP)
4194 helixhorne 834
 
3057 helixhorne 835
#### Lunatic
836
 
2650 helixhorne 837
# Create object files directly with luajit
5753 hendricks2 838
$(DUKE3D_OBJ)/luaJIT_BC_%.$o: source/lunatic/%.lua | $(DUKE3D_OBJ)
2650 helixhorne 839
	$(COMPILE_STATUS)
4543 hendricks2 840
	$(RECIPE_IF) $(LUAJIT) -bg $(LUAJIT_BCOPTS) $< $@ $(RECIPE_RESULT_COMPILE)
2650 helixhorne 841
 
4238 helixhorne 842
# Same thing for defs*.ilua which I'm too reluctant to rename now:
4000 helixhorne 843
# NOTE: The target path must match EXACTLY with that of the DEFS_BC_SIZE
844
# determination in Makefile.common, because it is embedded into the bytecode as
845
# debugging information.
5753 hendricks2 846
$(DUKE3D_OBJ)/luaJIT_BC_%.$o: source/lunatic/%.ilua | $(DUKE3D_OBJ)
4543 hendricks2 847
	$(RECIPE_IF) $(LUAJIT) -bg $(LUAJIT_BCOPTS) $< $@ $(RECIPE_RESULT_COMPILE)
3517 helixhorne 848
 
5753 hendricks2 849
$(DUKE3D_OBJ)/%.$o: $(DUKE3D_SRC)/lunatic/%.c | $(DUKE3D_OBJ)
2034 helixhorne 850
	$(COMPILE_STATUS)
4555 hendricks2 851
	$(RECIPE_IF) $(COMPILER) $(COMMONFLAGS) $(COMPILERFLAGS) $(DUKE3D_CFLAGS) -c $< -o $@ $(RECIPE_RESULT_COMPILE)
2034 helixhorne 852
 
3057 helixhorne 853
# List of exported symbols, OS X
5753 hendricks2 854
$(DUKE3D_OBJ)/lunatic_dynsymlist_osx: $(DUKE3D_SRC)/lunatic/dynsymlist | $(DUKE3D_OBJ)
2074 helixhorne 855
	sed 's/[{};]//g;s/[A-Za-z_][A-Za-z_0-9]*/_&/g' $< > $@
856
 
5753 hendricks2 857
$(DUKE3D_OBJ)/lunatic_dynsymlist_m32_osx: $(DUKE3D_SRC)/lunatic/dynsymlist_m32 | $(DUKE3D_OBJ)
5749 hendricks2 858
	sed 's/[{};]//g;s/[A-Za-z_][A-Za-z_0-9]*/_&/g' $< > $@
859
 
5753 hendricks2 860
#$(DUKE3D_OBJ)/lunatic_aliases_list: $(DUKE3D_OBJ)/lunatic_dynsymlist_osx | $(DUKE3D_OBJ)
3057 helixhorne 861
#	sed 's/_\([A-Za-z_][A-Za-z_0-9]*\)/_\1 \1/g' $< > $@
2074 helixhorne 862
 
3057 helixhorne 863
# List of exported symbols, Windows
5753 hendricks2 864
$(DUKE3D_OBJ)/lunatic_eduke32.def: $(DUKE3D_SRC)/lunatic/dynsymlist | $(DUKE3D_OBJ)
2143 helixhorne 865
	echo EXPORTS > $@
866
	sed 's/[{};]//g' $< >> $@
867
 
5753 hendricks2 868
$(DUKE3D_OBJ)/lunatic_mapster32.def: $(DUKE3D_SRC)/lunatic/dynsymlist_m32 | $(DUKE3D_OBJ)
3248 helixhorne 869
	echo EXPORTS > $@
870
	sed 's/[{};]//g' $< >> $@
871
 
3057 helixhorne 872
####
873
 
4553 hendricks2 874
$(ENGINE_OBJ)/%.$o: $(ENGINE_SRC)/%.nasm | $(ENGINE_OBJ)
1905 helixhorne 875
	$(COMPILE_STATUS)
4543 hendricks2 876
	$(RECIPE_IF) $(AS) $(ASFLAGS) $< -o $@ $(RECIPE_RESULT_COMPILE)
1905 helixhorne 877
 
4553 hendricks2 878
$(ENGINE_OBJ)/%.$o: $(ENGINE_SRC)/%.yasm | $(ENGINE_OBJ)
3334 hendricks2 879
	$(COMPILE_STATUS)
4543 hendricks2 880
	$(RECIPE_IF) $(AS) $(ASFLAGS) $< -o $@ $(RECIPE_RESULT_COMPILE)
3334 hendricks2 881
 
4543 hendricks2 882
# Comment out the following rule to debug a-c.o
4553 hendricks2 883
$(ENGINE_OBJ)/a-c.$o: $(ENGINE_SRC)/a-c.c | $(ENGINE_OBJ)
2458 hendricks2 884
	$(COMPILE_STATUS)
4543 hendricks2 885
	$(RECIPE_IF) $(COMPILER) $(subst -O$(OPTLEVEL),-O2,$(subst $(CLANG_DEBUG_FLAGS),,$(COMMONFLAGS) $(COMPILERFLAGS))) $(ENGINE_CFLAGS) -c $< -o $@ $(RECIPE_RESULT_COMPILE)
2458 hendricks2 886
 
4553 hendricks2 887
$(ENGINE_OBJ)/%.$o: $(ENGINE_SRC)/%.c | $(ENGINE_OBJ)
1102 terminx 888
	$(COMPILE_STATUS)
4543 hendricks2 889
	$(RECIPE_IF) $(COMPILER) $(COMMONFLAGS) $(COMPILERFLAGS) $(ENGINE_CFLAGS) -c $< -o $@ $(RECIPE_RESULT_COMPILE)
1101 terminx 890
 
4553 hendricks2 891
$(ENGINE_OBJ)/%.$o: $(ENGINE_SRC)/%.m | $(ENGINE_OBJ)
1102 terminx 892
	$(COMPILE_STATUS)
4644 hendricks2 893
	$(RECIPE_IF) $(COMPILER_OBJC) $(COMMONFLAGS) $(COMPILERFLAGS) $(ENGINE_CFLAGS) -c $< -o $@ $(RECIPE_RESULT_COMPILE)
220 terminx 894
 
4553 hendricks2 895
$(ENGINE_OBJ)/%.$o: $(ENGINE_SRC)/%.cpp | $(ENGINE_OBJ)
1102 terminx 896
	$(COMPILE_STATUS)
5750 hendricks2 897
	$(RECIPE_IF) $(CXX) $(CXXONLYFLAGS) $(COMMONFLAGS) $(COMPILERFLAGS) $(ENGINE_CFLAGS) -c $< -o $@ $(RECIPE_RESULT_COMPILE)
220 terminx 898
 
4553 hendricks2 899
$(ENGINE_OBJ)/%.$o: $(ENGINE_SRC)/misc/%.c | $(ENGINE_OBJ)
1102 terminx 900
	$(COMPILE_STATUS)
4543 hendricks2 901
	$(RECIPE_IF) $(COMPILER) $(COMMONFLAGS) $(COMPILERFLAGS) $(ENGINE_CFLAGS) -c $< -o $@ $(RECIPE_RESULT_COMPILE)
1595 helixhorne 902
 
4553 hendricks2 903
$(ENGINE_OBJ)/%.$o: $(ENGINE_SRC)/util/%.c | $(ENGINE_OBJ)
1765 plagman 904
	$(COMPILE_STATUS)
4543 hendricks2 905
	$(RECIPE_IF) $(COMPILER) $(COMMONFLAGS) $(COMPILERFLAGS) $(ENGINE_CFLAGS) -c $< -o $@ $(RECIPE_RESULT_COMPILE)
1765 plagman 906
 
4553 hendricks2 907
$(ENGINE_OBJ)/%.$o: $(ENGINE_SRC)/util/%.cpp | $(ENGINE_OBJ)
4543 hendricks2 908
	$(COMPILE_STATUS)
5750 hendricks2 909
	$(RECIPE_IF) $(CXX) $(CXXONLYFLAGS) $(COMMONFLAGS) $(COMPILERFLAGS) $(ENGINE_CFLAGS) -c $< -o $@ $(RECIPE_RESULT_COMPILE)
4543 hendricks2 910
 
4553 hendricks2 911
$(ENGINE_OBJ)/%.$o: $(ENGINE_SRC)/util/%.cc | $(ENGINE_OBJ)
4543 hendricks2 912
	$(COMPILE_STATUS)
5750 hendricks2 913
	$(RECIPE_IF) $(CXX) $(CXXONLYFLAGS) $(COMMONFLAGS) $(COMPILERFLAGS) $(ENGINE_CFLAGS) -c $< -o $@ $(RECIPE_RESULT_COMPILE)
4543 hendricks2 914
 
4553 hendricks2 915
$(ENGINE_OBJ)/%.$o: $(DUKE3D_RSRC)/%.c | $(ENGINE_OBJ)
4543 hendricks2 916
	$(COMPILE_STATUS)
917
	$(RECIPE_IF) $(COMPILER) $(COMMONFLAGS) $(COMPILERFLAGS) -c $< -o $@ $(RECIPE_RESULT_COMPILE)
918
 
5197 hendricks2 919
$(MACT_OBJ)/%.$o: $(MACT_SRC)/%.c | $(MACT_OBJ)
920
	$(COMPILE_STATUS)
921
	$(RECIPE_IF) $(COMPILER) $(COMMONFLAGS) $(COMPILERFLAGS) -c $< -o $@ $(RECIPE_RESULT_COMPILE)
922
 
4543 hendricks2 923
$(AUDIOLIB_OBJ)/%.o: $(AUDIOLIB_SRC)/%.c | $(AUDIOLIB_OBJ)
924
	$(COMPILE_STATUS)
925
	$(RECIPE_IF) $(COMPILER) $(COMMONFLAGS) $(COMPILERFLAGS) $(AUDIOLIB_CFLAGS) -c $< -o $@ $(RECIPE_RESULT_COMPILE)
926
 
927
$(ENET_OBJ)/%.o: $(ENET_SRC)/%.c $(ENET_INC)/enet/*.h | $(ENET_OBJ)
928
	$(COMPILE_STATUS)
929
	$(RECIPE_IF) $(COMPILER) $(COMMONFLAGS) $(COMPILERFLAGS) $(ENET_CFLAGS) -c $< -o $@ $(RECIPE_RESULT_COMPILE)
930
 
5745 hendricks2 931
$(KENBUILD_OBJ)/%.$o: $(KENBUILD_SRC)/%.c | $(KENBUILD_OBJ)
4555 hendricks2 932
	$(COMPILE_STATUS)
5745 hendricks2 933
	$(RECIPE_IF) $(COMPILER) $(COMMONFLAGS) $(COMPILERFLAGS) $(KENBUILD_CFLAGS) -c $< -o $@ $(RECIPE_RESULT_COMPILE)
4555 hendricks2 934
 
5765 hendricks2 935
$(KENBUILD_OBJ)/%.$o: $(KENBUILD_OBJ)/%.c
936
	$(COMPILE_STATUS)
937
	$(RECIPE_IF) $(COMPILER) $(COMMONFLAGS) $(COMPILERFLAGS) $(KENBUILD_CFLAGS) -c $< -o $@ $(RECIPE_RESULT_COMPILE)
938
 
5745 hendricks2 939
$(KENBUILD_OBJ)/%.$o: $(KENBUILD_SRC)/%.m | $(KENBUILD_OBJ)
5197 hendricks2 940
	$(COMPILE_STATUS)
5745 hendricks2 941
	$(RECIPE_IF) $(COMPILER_OBJC) $(COMMONFLAGS) $(COMPILERFLAGS) $(KENBUILD_CFLAGS) -c $< -o $@ $(RECIPE_RESULT_COMPILE)
5197 hendricks2 942
 
5745 hendricks2 943
$(KENBUILD_OBJ)/%.$o: $(KENBUILD_RSRC)/%.rc | $(KENBUILD_OBJ)
4555 hendricks2 944
	$(COMPILE_STATUS)
5745 hendricks2 945
	$(RECIPE_IF) $(RC) -i $< -o $@ --include-dir=$(ENGINE_INC) --include-dir=$(KENBUILD_SRC) --include-dir=$(KENBUILD_RSRC) $(RECIPE_RESULT_COMPILE)
4555 hendricks2 946
 
5745 hendricks2 947
$(KENBUILD_OBJ)/%.$o: $(KENBUILD_RSRC)/%.c | $(KENBUILD_OBJ)
4555 hendricks2 948
	$(COMPILE_STATUS)
5745 hendricks2 949
	$(RECIPE_IF) $(COMPILER) $(COMMONFLAGS) $(COMPILERFLAGS) $(KENBUILD_CFLAGS) -c $< -o $@ $(RECIPE_RESULT_COMPILE)
4555 hendricks2 950
 
5765 hendricks2 951
$(KENBUILD_OBJ)/%_banner.c: $(KENBUILD_RSRC)/%.bmp | $(KENBUILD_OBJ)
5197 hendricks2 952
	echo "#include \"gtkpixdata_shim.h\"" > $@
953
	gdk-pixbuf-csource --extern --struct --raw --name=startbanner_pixdata $^ | sed 's/load_inc//' >> $@
954
 
4555 hendricks2 955
$(DUKE3D_OBJ)/%.$o: $(DUKE3D_SRC)/%.c | $(DUKE3D_OBJ)
956
	$(COMPILE_STATUS)
957
	$(RECIPE_IF) $(COMPILER) $(COMMONFLAGS) $(COMPILERFLAGS) $(DUKE3D_CFLAGS) -c $< -o $@ $(RECIPE_RESULT_COMPILE)
958
 
5765 hendricks2 959
$(DUKE3D_OBJ)/%.$o: $(DUKE3D_OBJ)/%.c
960
	$(COMPILE_STATUS)
961
	$(RECIPE_IF) $(COMPILER) $(COMMONFLAGS) $(COMPILERFLAGS) $(DUKE3D_CFLAGS) -c $< -o $@ $(RECIPE_RESULT_COMPILE)
962
 
4565 hendricks2 963
$(DUKE3D_OBJ)/rev.$o: $(DUKE3D_SRC)/rev.c | $(DUKE3D_OBJ)
964
	$(COMPILE_STATUS)
965
	$(RECIPE_IF) $(COMPILER) $(COMMONFLAGS) $(COMPILERFLAGS) $(DUKE3D_CFLAGS) $(REVFLAG) -c $< -o $@ $(RECIPE_RESULT_COMPILE)
966
 
4555 hendricks2 967
$(DUKE3D_OBJ)/%.$o: $(DUKE3D_SRC)/util/%.c | $(DUKE3D_OBJ)
968
	$(COMPILE_STATUS)
969
	$(RECIPE_IF) $(COMPILER) $(COMMONFLAGS) $(COMPILERFLAGS) $(DUKE3D_CFLAGS) -c $< -o $@ $(RECIPE_RESULT_COMPILE)
970
 
4553 hendricks2 971
$(DUKE3D_OBJ)/%.$o: $(DUKE3D_SRC)/%.m | $(DUKE3D_OBJ)
4543 hendricks2 972
	$(COMPILE_STATUS)
4644 hendricks2 973
	$(RECIPE_IF) $(COMPILER_OBJC) $(COMMONFLAGS) $(COMPILERFLAGS) $(DUKE3D_CFLAGS) -c $< -o $@ $(RECIPE_RESULT_COMPILE)
4543 hendricks2 974
 
4553 hendricks2 975
$(DUKE3D_OBJ)/%.$o: $(DUKE3D_SRC)/%.cpp | $(DUKE3D_OBJ)
4543 hendricks2 976
	$(COMPILE_STATUS)
5750 hendricks2 977
	$(RECIPE_IF) $(CXX) $(CXXONLYFLAGS) $(COMMONFLAGS) $(COMPILERFLAGS) $(DUKE3D_CFLAGS) -c $< -o $@ $(RECIPE_RESULT_COMPILE)
4543 hendricks2 978
 
4553 hendricks2 979
$(DUKE3D_OBJ)/%.$o: $(DUKE3D_SRC)/misc/%.rc | $(DUKE3D_OBJ)
4543 hendricks2 980
	$(COMPILE_STATUS)
4555 hendricks2 981
	$(RECIPE_IF) $(RC) -i $< -o $@ --include-dir=$(ENGINE_INC) --include-dir=$(DUKE3D_SRC) --include-dir=$(DUKE3D_RSRC) -DPOLYMER=$(POLYMER) $(RECIPE_RESULT_COMPILE)
4543 hendricks2 982
 
4553 hendricks2 983
$(DUKE3D_OBJ)/%.$o: $(DUKE3D_RSRC)/%.c | $(DUKE3D_OBJ)
4543 hendricks2 984
	$(COMPILE_STATUS)
4558 hendricks2 985
	$(RECIPE_IF) $(COMPILER) $(COMMONFLAGS) $(COMPILERFLAGS) $(DUKE3D_CFLAGS) -c $< -o $@ $(RECIPE_RESULT_COMPILE)
4543 hendricks2 986
 
5765 hendricks2 987
$(DUKE3D_OBJ)/%_banner.c: $(DUKE3D_RSRC)/%.bmp | $(DUKE3D_OBJ)
4770 hendricks2 988
	echo "#include \"gtkpixdata_shim.h\"" > $@
5333 hendricks2 989
	gdk-pixbuf-csource --extern --struct --raw --name=startbanner_pixdata $^ | sed 's/load_inc//' >> $@
4770 hendricks2 990
 
5197 hendricks2 991
$(SW_OBJ)/%.$o: $(SW_SRC)/%.c | $(SW_OBJ)
992
	$(COMPILE_STATUS)
993
	$(RECIPE_IF) $(COMPILER) $(COMMONFLAGS) $(COMPILERFLAGS) $(SW_CFLAGS) -c $< -o $@ $(RECIPE_RESULT_COMPILE)
994
 
5765 hendricks2 995
$(SW_OBJ)/%.$o: $(SW_OBJ)/%.c
996
	$(COMPILE_STATUS)
997
	$(RECIPE_IF) $(COMPILER) $(COMMONFLAGS) $(COMPILERFLAGS) $(SW_CFLAGS) -c $< -o $@ $(RECIPE_RESULT_COMPILE)
998
 
5197 hendricks2 999
$(SW_OBJ)/%.$o: $(SW_SRC)/%.m | $(SW_OBJ)
1000
	$(COMPILE_STATUS)
5740 hendricks2 1001
	$(RECIPE_IF) $(COMPILER_OBJC) $(COMMONFLAGS) $(COMPILERFLAGS) $(SW_CFLAGS) -c $< -o $@ $(RECIPE_RESULT_COMPILE)
5197 hendricks2 1002
 
1003
$(SW_OBJ)/%.$o: $(SW_RSRC)/%.rc | $(SW_OBJ)
1004
	$(COMPILE_STATUS)
1005
	$(RECIPE_IF) $(RC) -i $< -o $@ --include-dir=$(ENGINE_INC) --include-dir=$(SW_SRC) --include-dir=$(SW_RSRC) $(RECIPE_RESULT_COMPILE)
1006
 
1007
$(SW_OBJ)/%.$o: $(SW_RSRC)/%.c | $(SW_OBJ)
1008
	$(COMPILE_STATUS)
1009
	$(RECIPE_IF) $(COMPILER) $(COMMONFLAGS) $(COMPILERFLAGS) $(SW_CFLAGS) -c $< -o $@ $(RECIPE_RESULT_COMPILE)
1010
 
5765 hendricks2 1011
$(SW_OBJ)/%_banner.c: $(SW_RSRC)/%.bmp | $(SW_OBJ)
4770 hendricks2 1012
	echo "#include \"gtkpixdata_shim.h\"" > $@
5 Plagman 1013
	gdk-pixbuf-csource --extern --struct --raw --name=startbanner_pixdata $^ | sed 's/load_inc//' >> $@
1014
 
5748 hendricks2 1015
$(obj):
4807 hendricks2 1016
	-mkdir $@ $(DONT_PRINT) $(DONT_FAIL)
4553 hendricks2 1017
 
5748 hendricks2 1018
$(ENGINE_OBJ) $(MACT_OBJ) $(AUDIOLIB_OBJ) $(ENET_OBJ) $(KENBUILD_OBJ) $(DUKE3D_OBJ) $(SW_OBJ): | $(obj)
1019
	-mkdir $@ $(DONT_PRINT) $(DONT_FAIL)
1020
 
4756 helixhorne 1021
## PHONIES
996 terminx 1022
 
5598 terminx 1023
veryclean: clean
5197 hendricks2 1024
 
4756 helixhorne 1025
# Delete executables, object files created from sources in source/, and
1026
# miscellaneous generated files related to Lunatic on non-Linux.
5197 hendricks2 1027
cleanduke3d:
5749 hendricks2 1028
	-rm -f $(DUKE3D_GAME)$(EXESUFFIX) $(DUKE3D_EDITOR)$(EXESUFFIX)
2388 helixhorne 1029
ifeq ($(PLATFORM),DARWIN)
5746 hendricks2 1030
	-rm -rf "$(DUKE3D_GAME_PROPER).app" "$(DUKE3D_EDITOR_PROPER).app"
2388 helixhorne 1031
endif
5 Plagman 1032
 
4555 hendricks2 1033
cleantest:
5748 hendricks2 1034
	-rm -f $(KENBUILD_GAME)$(EXESUFFIX) $(KENBUILD_EDITOR)$(EXESUFFIX)
4555 hendricks2 1035
 
5197 hendricks2 1036
cleansw:
5748 hendricks2 1037
	-rm -f $(SW_GAME)$(EXESUFFIX) $(SW_EDITOR)$(EXESUFFIX)
5197 hendricks2 1038
 
3163 hendricks2 1039
cleanutils:
5748 hendricks2 1040
	-rm -f $(addsuffix $(EXESUFFIX),$(UTILS) $(GAMEUTILS))
3163 hendricks2 1041
 
5598 terminx 1042
clean: cleanduke3d cleanutils
5748 hendricks2 1043
	-rm -rf $(obj)/
1044
	-rm -f $(EBACKTRACEDLL)
3163 hendricks2 1045
 
1046
printutils:
4543 hendricks2 1047
	echo "$(addsuffix $(EXESUFFIX),$(UTILS) $(GAMEUTILS))"
4343 hendricks2 1048
 
4543 hendricks2 1049
printdxutils:
1050
	echo "$(addsuffix $(EXESUFFIX),$(DXUTILS))"
1051
 
1052
printsdlutils:
1053
	echo "$(addsuffix $(EXESUFFIX),$(SDLUTILS))"
1054
 
4565 hendricks2 1055
rev: $(DUKE3D_OBJ)/rev.$o