Subversion Repositories eduke32

Rev

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