Subversion Repositories eduke32

Rev

Rev 5778 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
434 Plagman 1
# EDuke32 Makefile for Microsoft NMake
4553 hendricks2 2
 
3
obj=obj
4
 
4543 hendricks2 5
ENGINE_ROOT=build
4553 hendricks2 6
ENGINE_SRC=$(ENGINE_ROOT)\src
4543 hendricks2 7
ENGINE_INC=$(ENGINE_ROOT)\include
4553 hendricks2 8
ENGINE_OBJ=$(ENGINE_ROOT)\$(obj)
9
 
10
DUKE3D_SRC=source
11
DUKE3D_OBJ=$(DUKE3D_SRC)\$(obj)
4543 hendricks2 12
DUKE3D_INC=$(DUKE3D_SRC)
13
DUKE3D_RSRC=rsrc
4553 hendricks2 14
 
5259 terminx 15
MACT_ROOT=$(DUKE3D_SRC)\jmact
16
MACT_SRC=$(MACT_ROOT)
17
MACT_INC=$(MACT_ROOT)
18
MACT_OBJ=$(MACT_ROOT)\$(obj)
19
 
4553 hendricks2 20
AUDIOLIB_ROOT=$(DUKE3D_SRC)\jaudiolib
21
AUDIOLIB_OBJ=$(AUDIOLIB_ROOT)\$(obj)
22
AUDIOLIB_INC=$(AUDIOLIB_ROOT)\include
23
AUDIOLIB_SRC=$(AUDIOLIB_ROOT)\src
24
 
25
ENET_ROOT=$(DUKE3D_SRC)\enet
26
ENET_OBJ=$(ENET_ROOT)\$(obj)
27
ENET_INC=$(ENET_ROOT)\include
28
ENET_SRC=$(ENET_ROOT)\src
29
 
5 Plagman 30
o=obj
4553 hendricks2 31
res=res
32
asm=masm
5 Plagman 33
 
4553 hendricks2 34
 
35
 
36
 
37
CPLUSPLUS=1
38
 
4326 hendricks2 39
!ifndef WINBITS
40
WINBITS=32
41
!endif
42
 
4320 hendricks2 43
WINLIB=\$(WINBITS)
3278 hendricks2 44
 
4320 hendricks2 45
!if ($(WINBITS)==32)
46
WINMACHINE=/MACHINE:X86
47
!elseif ($(WINBITS)==64)
48
WINMACHINE=/MACHINE:X64
49
!endif
3278 hendricks2 50
 
1652 terminx 51
# the WDK allows us to link against msvcrt.dll instead of msvcrxxx.dll
52
# this path should match build\Makefile.msvc
3282 terminx 53
# WDKROOT="H:\WinDDK\7600.16385.1"
4320 hendricks2 54
PLATFORM=platform\Windows
55
AUDIOINC=source\jaudiolib\third-party\common
56
AUDIOPLATFORM=source\jaudiolib\third-party\Windows
1652 terminx 57
 
4326 hendricks2 58
!ifndef RENDERTYPE
59
RENDERTYPE=WIN
60
!endif
61
!ifndef MIXERTYPE
62
MIXERTYPE=WIN
63
!endif
64
 
5 Plagman 65
!ifdef DEBUG
66
# debugging options
5386 terminx 67
flags_cl=/Od /Zi # /analyze
5 Plagman 68
flags_link=/DEBUG
69
!else
70
# release options
4326 hendricks2 71
flags_cl=/O2 /GL /MP # /I$(WDKROOT)\inc\crt /I$(WDKROOT)\inc\api
72
!if ($(WINBITS)!=64)
73
flags_cl=$(flags_cl) /arch:SSE
74
!endif
3166 helixhorne 75
flags_link=/RELEASE /LTCG # /LIBPATH:$(WDKROOT)\lib\wxp\i386 /LIBPATH:$(WDKROOT)\lib\Crt\i386
5 Plagman 76
!endif
77
 
5287 terminx 78
ENGINEOPTS=/DUSE_OPENGL /DPOLYMER /DUSE_LIBPNG /DUSE_LIBVPX /DHAVE_VORBIS #/DHAVE_FLAC
5 Plagman 79
 
3166 helixhorne 80
!ifdef CPLUSPLUS
81
ENGINEOPTS=$(ENGINEOPTS) /TP
82
!endif
83
 
4320 hendricks2 84
!if ($(WINBITS)==64)
85
NOASM=1
86
!endif
87
 
5 Plagman 88
CC=cl
89
AS=ml
5768 hendricks2 90
LINK=link /nologo /opt:ref
578 plagman 91
MT=mt
1399 terminx 92
CFLAGS= /MT /J /nologo $(flags_cl)  \
5259 terminx 93
	/I$(DUKE3D_INC) /I$(ENGINE_INC)\msvc /I$(ENGINE_INC) /I$(MACT_ROOT) /I$(AUDIOLIB_ROOT)\include /I$(ENET_ROOT)\include \
5768 hendricks2 94
	/W2 $(ENGINEOPTS) \
5778 hendricks2 95
	/I$(PLATFORM)\include /I$(AUDIOINC)\include /DRENDERTYPE$(RENDERTYPE)=1 /DMIXERTYPE$(MIXERTYPE)=1 /DSDL_USEFOLDER /DSDL_TARGET=2
4553 hendricks2 96
 
97
ENET_CFLAGS=/I$(ENET_INC) /I$(ENET_SRC)
5768 hendricks2 98
AUDIOLIB_CFLAGS=/I$(AUDIOLIB_INC) /I$(AUDIOLIB_SRC)
4553 hendricks2 99
 
4326 hendricks2 100
LIBS=user32.lib gdi32.lib shell32.lib winmm.lib ws2_32.lib comctl32.lib shlwapi.lib oleaut32.lib ole32.lib imm32.lib version.lib \
5341 hendricks2 101
     libogg.a libvorbis.a libvorbisfile.a libvpx.a libpng_mini.a libz_mini.a \
4553 hendricks2 102
     dxguid.lib dsound.lib advapi32.lib libcompat-to-msvc.a
640 terminx 103
 
4326 hendricks2 104
!if ("$(RENDERTYPE)"=="SDL")
105
LIBS=libSDL2main.a libSDL2.a libSDL2_mixer.a $(LIBS)
106
!endif
107
 
1652 terminx 108
LIBS=/NODEFAULTLIB:glu32.lib /NODEFAULTLIB:msvcrt.lib /NODEFAULTLIB:msvcrtd.lib /NODEFAULTLIB:libcmt.lib \
109
    /NODEFAULTLIB:libcmtd.lib $(LIBS)
640 terminx 110
 
4320 hendricks2 111
# NOASM     When defined, uses C instead of assembly code
112
!ifdef NOASM
113
CFLAGS=$(CFLAGS) /DNOASM
114
!endif
115
 
1122 terminx 116
ASFLAGS=/nologo /coff /c
5 Plagman 117
EXESUFFIX=.exe
1195 terminx 118
!ifdef DEBUG
1652 terminx 119
CFLAGS=$(CFLAGS) /DDEBUGGINGAIDS /D "_CRT_SECURE_NO_DEPRECATE"
120
LIBS=$(LIBS)  msvcrtd.lib
1399 terminx 121
!else
1652 terminx 122
# comment msvcrt_winxp.obj if not using the WDK
3166 helixhorne 123
LIBS=$(LIBS)  msvcrt.lib # msvcrt_winxp.obj
1195 terminx 124
!endif
5 Plagman 125
 
4553 hendricks2 126
ENGINE_OBJS= \
127
!ifdef NOASM
128
        $(ENGINE_OBJ)\a-c.$o \
129
!else
130
        $(ENGINE_OBJ)\a.$o \
131
!endif
132
	$(ENGINE_OBJ)\baselayer.$o \
133
	$(ENGINE_OBJ)\cache1d.$o \
4559 hendricks2 134
	$(ENGINE_OBJ)\common.$o \
4553 hendricks2 135
	$(ENGINE_OBJ)\compat.$o \
136
	$(ENGINE_OBJ)\crc32.$o \
137
	$(ENGINE_OBJ)\defs.$o \
5386 terminx 138
	$(ENGINE_OBJ)\colmatch.$o \
4553 hendricks2 139
	$(ENGINE_OBJ)\engine.$o \
4639 terminx 140
        $(ENGINE_OBJ)\glbuild.$o \
141
        $(ENGINE_OBJ)\texcache.$o \
142
        $(ENGINE_OBJ)\kplib.$o \
143
        $(ENGINE_OBJ)\hightile.$o \
4553 hendricks2 144
	$(ENGINE_OBJ)\polymost.$o \
4639 terminx 145
        $(ENGINE_OBJ)\polymer.$o \
146
        $(ENGINE_OBJ)\mdsprite.$o \
147
        $(ENGINE_OBJ)\voxmodel.$o \
4553 hendricks2 148
	$(ENGINE_OBJ)\dxtfilter.$o \
149
	$(ENGINE_OBJ)\textfont.$o \
150
	$(ENGINE_OBJ)\smalltextfont.$o \
151
	$(ENGINE_OBJ)\lz4.$o \
4883 hendricks2 152
	$(ENGINE_OBJ)\md4.$o \
4566 hendricks2 153
	$(ENGINE_OBJ)\mmulti_null.$o \
4553 hendricks2 154
	$(ENGINE_OBJ)\osd.$o \
155
	$(ENGINE_OBJ)\pragmas.$o \
156
	$(ENGINE_OBJ)\scriptfile.$o \
157
	$(ENGINE_OBJ)\mutex.$o \
158
	$(ENGINE_OBJ)\winbits.$o \
159
	$(ENGINE_OBJ)\xxhash.$o
160
 
161
ENGINE_EDITOR_OBJS=$(ENGINE_OBJ)\build.$o \
162
	$(ENGINE_OBJ)\startwin.editor.$o \
163
	$(ENGINE_OBJ)\config.$o
164
 
165
ENET_OBJS=$(ENET_OBJ)\callbacks.$o \
166
	$(ENET_OBJ)\host.$o \
167
	$(ENET_OBJ)\list.$o \
168
	$(ENET_OBJ)\packet.$o \
169
	$(ENET_OBJ)\peer.$o \
170
	$(ENET_OBJ)\protocol.$o \
171
	$(ENET_OBJ)\win32.$o \
172
	$(ENET_OBJ)\compress.$o
173
 
174
AUDIOLIB_OBJS=$(AUDIOLIB_OBJ)\drivers.$o \
175
	$(AUDIOLIB_OBJ)\fx_man.$o \
176
	$(AUDIOLIB_OBJ)\multivoc.$o \
177
	$(AUDIOLIB_OBJ)\mix.$o \
178
	$(AUDIOLIB_OBJ)\mixst.$o \
179
	$(AUDIOLIB_OBJ)\pitch.$o \
180
	$(AUDIOLIB_OBJ)\formats.$o \
181
	$(AUDIOLIB_OBJ)\vorbis.$o \
182
	$(AUDIOLIB_OBJ)\flac.$o \
183
	$(AUDIOLIB_OBJ)\xa.$o \
184
	$(AUDIOLIB_OBJ)\driver_nosound.$o
185
 
186
MACT_OBJS=$(DUKE3D_OBJ)\file_lib.$o \
4543 hendricks2 187
	$(DUKE3D_OBJ)\control.$o \
188
	$(DUKE3D_OBJ)\keyboard.$o \
189
	$(DUKE3D_OBJ)\mouse.$o \
190
	$(DUKE3D_OBJ)\joystick.$o \
191
	$(DUKE3D_OBJ)\scriplib.$o
5768 hendricks2 192
 
4553 hendricks2 193
DUKE3D_OBJS=$(DUKE3D_OBJ)\game.$o \
4543 hendricks2 194
	$(DUKE3D_OBJ)\actors.$o \
195
	$(DUKE3D_OBJ)\anim.$o \
4987 terminx 196
	$(DUKE3D_OBJ)\animsounds.$o \
4543 hendricks2 197
	$(DUKE3D_OBJ)\animvpx.$o \
5611 terminx 198
        $(DUKE3D_OBJ)\cheats.$o \
5613 terminx 199
        $(DUKE3D_OBJ)\sbar.$o \
5614 terminx 200
        $(DUKE3D_OBJ)\screentext.$o \
5618 terminx 201
        $(DUKE3D_OBJ)\screens.$o \
202
        $(DUKE3D_OBJ)\cmdline.$o \
4543 hendricks2 203
	$(DUKE3D_OBJ)\common.$o \
204
	$(DUKE3D_OBJ)\demo.$o \
205
	$(DUKE3D_OBJ)\gamedef.$o \
206
	$(DUKE3D_OBJ)\gameexec.$o \
207
	$(DUKE3D_OBJ)\gamevars.$o \
208
	$(DUKE3D_OBJ)\global.$o \
209
	$(DUKE3D_OBJ)\input.$o \
210
	$(DUKE3D_OBJ)\menus.$o \
211
	$(DUKE3D_OBJ)\namesdyn.$o \
212
    $(DUKE3D_OBJ)\net.$o \
213
	$(DUKE3D_OBJ)\player.$o \
214
	$(DUKE3D_OBJ)\premap.$o \
215
	$(DUKE3D_OBJ)\savegame.$o \
216
	$(DUKE3D_OBJ)\sector.$o \
217
	$(DUKE3D_OBJ)\rev.$o \
218
	$(DUKE3D_OBJ)\rts.$o \
219
	$(DUKE3D_OBJ)\config.$o \
220
	$(DUKE3D_OBJ)\animlib.$o\
221
	$(DUKE3D_OBJ)\osdfuncs.$o \
222
	$(DUKE3D_OBJ)\osdcmds.$o \
223
	$(DUKE3D_OBJ)\grpscan.$o \
224
	$(DUKE3D_OBJ)\winbits.$o \
4553 hendricks2 225
	$(DUKE3D_OBJ)\gameres.$(res) \
4543 hendricks2 226
	$(DUKE3D_OBJ)\startwin.game.$o \
4553 hendricks2 227
	$(MACT_OBJS) \
4543 hendricks2 228
	$(DUKE3D_OBJ)\sounds.$o \
229
	$(DUKE3D_OBJ)\soundsdyn.$o \
602 terminx 230
!ifdef DEBUG
4543 hendricks2 231
	$(DUKE3D_OBJ)\mdump.$o
602 terminx 232
!endif
5 Plagman 233
 
4553 hendricks2 234
DUKE3D_EDITOR_OBJS=$(DUKE3D_OBJ)\astub.$o \
4543 hendricks2 235
	$(DUKE3D_OBJ)\common.$o \
4566 hendricks2 236
	$(DUKE3D_OBJ)\grpscan.$o \
4561 hendricks2 237
	$(DUKE3D_OBJ)\m32common.$o \
4543 hendricks2 238
	$(DUKE3D_OBJ)\m32def.$o \
239
	$(DUKE3D_OBJ)\m32vars.$o \
240
	$(DUKE3D_OBJ)\m32exec.$o \
241
	$(DUKE3D_OBJ)\sounds_mapster32.$o \
242
	$(DUKE3D_OBJ)\rev.$o \
4553 hendricks2 243
	$(DUKE3D_OBJ)\buildres.$(res) \
602 terminx 244
!ifdef DEBUG
4543 hendricks2 245
	$(DUKE3D_OBJ)\mdump.$o
602 terminx 246
!endif
5 Plagman 247
 
4553 hendricks2 248
!if ("$(RENDERTYPE)"=="WIN")
249
ENGINE_OBJS=$(ENGINE_OBJS) $(ENGINE_OBJ)\winlayer.$o $(ENGINE_OBJ)\rawinput.$o
250
!endif
4326 hendricks2 251
!if ("$(RENDERTYPE)"=="SDL")
4553 hendricks2 252
ENGINE_OBJS=$(ENGINE_OBJS) $(ENGINE_OBJ)\sdlayer.$o
5253 hendricks2 253
DUKE3D_OBJS=$(DUKE3D_OBJS) $(DUKE3D_OBJ)\game_icon.$o
254
DUKE3D_EDITOR_OBJS=$(DUKE3D_EDITOR_OBJS) $(DUKE3D_OBJ)\build_icon.$o
4326 hendricks2 255
!endif
256
 
257
!if ("$(MIXERTYPE)"=="WIN")
4553 hendricks2 258
DUKE3D_OBJS=$(DUKE3D_OBJS) $(DUKE3D_OBJ)\midi.$o $(DUKE3D_OBJ)\music.$o $(DUKE3D_OBJ)\mpu401.$o
259
AUDIOLIB_OBJS=$(AUDIOLIB_OBJS) $(AUDIOLIB_OBJ)\driver_directsound.$o
4326 hendricks2 260
!endif
261
!if ("$(MIXERTYPE)"=="SDL")
4553 hendricks2 262
DUKE3D_OBJS=$(DUKE3D_OBJS) $(DUKE3D_OBJ)\sdlmusic.$o
263
AUDIOLIB_OBJS=$(AUDIOLIB_OBJS) $(AUDIOLIB_OBJ)/driver_sdl.$o
4326 hendricks2 264
!endif
265
 
4553 hendricks2 266
DUKE3D_OBJS=$(DUKE3D_OBJS) $(MUSICOBJ)
267
DUKE3D_EDITOR_OBJS=$(DUKE3D_EDITOR_OBJS) $(MUSICOBJ)
4326 hendricks2 268
 
269
 
4553 hendricks2 270
CHECKDIR_ENGINE=@if not exist "$(ENGINE_OBJ)" mkdir "$(ENGINE_OBJ)"
271
CHECKDIR_DUKE3D=@if not exist "$(DUKE3D_OBJ)" mkdir "$(DUKE3D_OBJ)"
272
CHECKDIR_ENET=@if not exist "$(ENET_OBJ)" mkdir "$(ENET_OBJ)"
273
CHECKDIR_AUDIOLIB=@if not exist "$(AUDIOLIB_OBJ)" mkdir "$(AUDIOLIB_OBJ)"
274
 
275
 
5 Plagman 276
# RULES
277
.SUFFIXES: .masm
278
 
4553 hendricks2 279
{$(ENGINE_SRC)}.masm{$(ENGINE_OBJ)}.$o:
280
	$(CHECKDIR_ENGINE)
281
	$(AS) /c $(ASFLAGS) /Fo$@ $<
282
 
283
{$(ENGINE_SRC)\util}.c{$(ENGINE_OBJ)}.$o:
284
	$(CHECKDIR_ENGINE)
285
	$(CC) /c $(CFLAGS) /Fo$@ $<
286
 
287
{$(ENGINE_SRC)\misc}.rc{$(ENGINE_OBJ)}.$(res):
288
	$(CHECKDIR_ENGINE)
289
	$(RC) /i$(ENGINE_INC)\ /fo$@ /r $<
290
 
291
{$(ENGINE_SRC)}.c{$(ENGINE_OBJ)}.$o:
292
	$(CHECKDIR_ENGINE)
293
	$(CC) /c $(CFLAGS) /Fo$@ $<
294
 
295
{$(ENGINE_SRC)}.cc{$(ENGINE_OBJ)}.$o:
296
	$(CHECKDIR_ENGINE)
297
	$(CC) /c $(CFLAGS) /Fo$@ $<
298
 
299
{$(ENGINE_SRC)}.cpp{$(ENGINE_OBJ)}.$o:
300
	$(CHECKDIR_ENGINE)
301
	$(CC) /c $(CFLAGS) /Fo$@ $<
302
 
303
{$(ENGINE_SRC)}.cxx{$(ENGINE_OBJ)}.$o:
304
	$(CHECKDIR_ENGINE)
305
	$(CC) /c $(CFLAGS) /Fo$@ $<
306
 
307
{$(ENET_SRC)}.c{$(ENET_OBJ)}.$o:
308
	$(CHECKDIR_ENET)
309
	$(CC) /c $(CFLAGS) $(ENET_CFLAGS) /Fo$@ $<
310
 
311
{$(AUDIOLIB_SRC)}.c{$(AUDIOLIB_OBJ)}.$o:
312
	$(CHECKDIR_AUDIOLIB)
313
	$(CC) /c $(CFLAGS) $(AUDIOLIB_CFLAGS) /Fo$@ $<
314
 
4543 hendricks2 315
{$(DUKE3D_SRC)\}.masm{$(DUKE3D_OBJ)\}.$o:
4553 hendricks2 316
	$(CHECKDIR_DUKE3D)
5 Plagman 317
	$(AS) /c $(ASFLAGS) /Fo$@ $<
318
 
5259 terminx 319
{$(MACT_ROOT)\}.c{$(DUKE3D_OBJ)\}.$o:
4553 hendricks2 320
	$(CHECKDIR_DUKE3D)
5 Plagman 321
	$(CC) /c $(CFLAGS) /Fo$@ $<
322
 
4543 hendricks2 323
{$(DUKE3D_SRC)\util}.c{$(DUKE3D_OBJ)\}.$o:
4553 hendricks2 324
	$(CHECKDIR_DUKE3D)
5 Plagman 325
	$(CC) /c $(CFLAGS) /Fo$@ $<
326
 
4543 hendricks2 327
{$(DUKE3D_SRC)\}.c{$(DUKE3D_OBJ)\}.$o:
4553 hendricks2 328
	$(CHECKDIR_DUKE3D)
5 Plagman 329
	$(CC) /c $(CFLAGS) /Fo$@ $<
330
 
4543 hendricks2 331
{$(DUKE3D_RSRC)\}.c{$(DUKE3D_OBJ)\}.$o:
4553 hendricks2 332
	$(CHECKDIR_DUKE3D)
4326 hendricks2 333
	$(CC) /c $(CFLAGS) /Fo$@ $<
334
 
4543 hendricks2 335
{$(DUKE3D_SRC)\}.cpp{$(DUKE3D_OBJ)\}.$o:
4553 hendricks2 336
	$(CHECKDIR_DUKE3D)
5 Plagman 337
	$(CC) /c $(CFLAGS) /Fo$@ $<
338
 
4553 hendricks2 339
{$(DUKE3D_SRC)\misc}.rc{$(DUKE3D_OBJ)\}.$(res):
340
	$(CHECKDIR_DUKE3D)
4558 hendricks2 341
	$(RC) /i$(ENGINE_INC)\ /i$(DUKE3D_SRC)\ /i$(DUKE3D_RSRC)\ /DPOLYMER /fo$@ /r $<
5 Plagman 342
 
343
 
344
# TARGETS
4553 hendricks2 345
all: eduke32$(EXESUFFIX) mapster32$(EXESUFFIX)
5 Plagman 346
 
4553 hendricks2 347
eduke32$(EXESUFFIX): $(DUKE3D_OBJS) $(ENGINE_OBJS) $(AUDIOLIB_OBJS) $(ENET_OBJS)
4320 hendricks2 348
	$(LINK) /OUT:$@ /SUBSYSTEM:WINDOWS $(WINMACHINE) /LIBPATH:$(PLATFORM)\lib$(WINLIB) /LIBPATH:$(AUDIOPLATFORM)\lib$(WINLIB) $(flags_link) /MAP $** $(LIBS)
5651 terminx 349
	$(MT) -manifest $(DUKE3D_RSRC)\manifest.game.xml -hashupdate -outputresource:$@ -out:$@.manifest
5768 hendricks2 350
 
4553 hendricks2 351
mapster32$(EXESUFFIX): $(DUKE3D_EDITOR_OBJS) $(ENGINE_OBJS) $(ENGINE_EDITOR_OBJS) $(AUDIOLIB_OBJS)
4320 hendricks2 352
	$(LINK) /OUT:$@ /SUBSYSTEM:WINDOWS $(WINMACHINE) /LIBPATH:$(PLATFORM)\lib$(WINLIB) /LIBPATH:$(AUDIOPLATFORM)\lib$(WINLIB) $(flags_link) /MAP $** $(LIBS)
5651 terminx 353
	$(MT) -manifest $(DUKE3D_RSRC)\manifest.build.xml -hashupdate -outputresource:$@ -out:$@.manifest
5768 hendricks2 354
 
5 Plagman 355
!include Makefile.deps
4553 hendricks2 356
!include $(ENGINE_ROOT)\Makefile.deps
5 Plagman 357
 
4553 hendricks2 358
# PHONIES
5 Plagman 359
 
360
clean:
4553 hendricks2 361
	-del /Q eduke32$(EXESUFFIX) mapster32$(EXESUFFIX) $(DUKE3D_OBJS) $(DUKE3D_EDITOR_OBJS) *.pdb *.map *.manifest
5768 hendricks2 362
 
5 Plagman 363
veryclean: clean
4553 hendricks2 364
	-del /Q $(ENGINE_OBJS) $(ENGINE_EDITOR_OBJS) $(ENET_OBJS) $(AUDIOLIB_OBJS)