Subversion Repositories eduke32

Rev

Rev 4553 | 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
 
4553 hendricks2 73
ENGINEOPTS=/DUSE_OPENGL /DPOLYMER /DUSE_LIBPNG
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) \
4326 hendricks2 90
 	/I$(PLATFORM)\include /I$(AUDIOINC)\include /DRENDERTYPE$(RENDERTYPE)=1 /DMIXERTYPE$(MIXERTYPE)=1 /DSDL_FRAMEWORK /DSDL_TARGET=2 /DUSE_LIBVPX
4553 hendricks2 91
 
92
ENET_CFLAGS=/I$(ENET_INC) /I$(ENET_SRC)
4554 hendricks2 93
AUDIOLIB_CFLAGS=/I$(AUDIOLIB_INC) /I$(AUDIOLIB_SRC) /DHAVE_VORBIS /DHAVE_FLAC
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 \
129
	$(ENGINE_OBJ)\compat.$o \
130
	$(ENGINE_OBJ)\crc32.$o \
131
	$(ENGINE_OBJ)\defs.$o \
132
	$(ENGINE_OBJ)\engine.$o \
133
	$(ENGINE_OBJ)\polymost.$o \
134
	$(ENGINE_OBJ)\texcache.$o \
135
	$(ENGINE_OBJ)\dxtfilter.$o \
136
	$(ENGINE_OBJ)\hightile.$o \
137
	$(ENGINE_OBJ)\mdsprite.$o \
138
	$(ENGINE_OBJ)\textfont.$o \
139
	$(ENGINE_OBJ)\smalltextfont.$o \
140
	$(ENGINE_OBJ)\glbuild.$o \
141
	$(ENGINE_OBJ)\kplib.$o \
142
	$(ENGINE_OBJ)\lz4.$o \
143
	$(ENGINE_OBJ)\lzwnew.$o \
144
	$(ENGINE_OBJ)\osd.$o \
145
	$(ENGINE_OBJ)\pragmas.$o \
146
	$(ENGINE_OBJ)\scriptfile.$o \
147
	$(ENGINE_OBJ)\polymer.$o \
148
	$(ENGINE_OBJ)\mutex.$o \
149
	$(ENGINE_OBJ)\winbits.$o \
150
	$(ENGINE_OBJ)\xxhash.$o
151
 
152
ENGINE_EDITOR_OBJS=$(ENGINE_OBJ)\build.$o \
153
	$(ENGINE_OBJ)\startwin.editor.$o \
154
	$(ENGINE_OBJ)\config.$o
155
 
156
ENET_OBJS=$(ENET_OBJ)\callbacks.$o \
157
	$(ENET_OBJ)\host.$o \
158
	$(ENET_OBJ)\list.$o \
159
	$(ENET_OBJ)\packet.$o \
160
	$(ENET_OBJ)\peer.$o \
161
	$(ENET_OBJ)\protocol.$o \
162
	$(ENET_OBJ)\win32.$o \
163
	$(ENET_OBJ)\compress.$o
164
 
165
AUDIOLIB_OBJS=$(AUDIOLIB_OBJ)\drivers.$o \
166
	$(AUDIOLIB_OBJ)\fx_man.$o \
167
	$(AUDIOLIB_OBJ)\multivoc.$o \
168
	$(AUDIOLIB_OBJ)\mix.$o \
169
	$(AUDIOLIB_OBJ)\mixst.$o \
170
	$(AUDIOLIB_OBJ)\pitch.$o \
171
	$(AUDIOLIB_OBJ)\formats.$o \
172
	$(AUDIOLIB_OBJ)\vorbis.$o \
173
	$(AUDIOLIB_OBJ)\flac.$o \
174
	$(AUDIOLIB_OBJ)\xa.$o \
175
	$(AUDIOLIB_OBJ)\driver_nosound.$o
176
 
177
MACT_OBJS=$(DUKE3D_OBJ)\file_lib.$o \
4543 hendricks2 178
	$(DUKE3D_OBJ)\control.$o \
179
	$(DUKE3D_OBJ)\keyboard.$o \
180
	$(DUKE3D_OBJ)\mouse.$o \
181
	$(DUKE3D_OBJ)\joystick.$o \
182
	$(DUKE3D_OBJ)\mathutil.$o \
183
	$(DUKE3D_OBJ)\scriplib.$o
5 Plagman 184
 
4553 hendricks2 185
DUKE3D_OBJS=$(DUKE3D_OBJ)\game.$o \
4543 hendricks2 186
	$(DUKE3D_OBJ)\game_inline.$o \
187
	$(DUKE3D_OBJ)\actors.$o \
188
	$(DUKE3D_OBJ)\actors_inline.$o \
189
	$(DUKE3D_OBJ)\anim.$o \
190
	$(DUKE3D_OBJ)\animvpx.$o \
191
	$(DUKE3D_OBJ)\common.$o \
192
	$(DUKE3D_OBJ)\demo.$o \
193
	$(DUKE3D_OBJ)\gamedef.$o \
194
	$(DUKE3D_OBJ)\gameexec.$o \
195
	$(DUKE3D_OBJ)\gamevars.$o \
196
	$(DUKE3D_OBJ)\global.$o \
197
	$(DUKE3D_OBJ)\input.$o \
198
	$(DUKE3D_OBJ)\menus.$o \
199
	$(DUKE3D_OBJ)\namesdyn.$o \
200
    $(DUKE3D_OBJ)\net.$o \
201
	$(DUKE3D_OBJ)\player.$o \
202
	$(DUKE3D_OBJ)\premap.$o \
203
	$(DUKE3D_OBJ)\savegame.$o \
204
	$(DUKE3D_OBJ)\sector.$o \
205
	$(DUKE3D_OBJ)\sector_inline.$o \
206
	$(DUKE3D_OBJ)\rev.$o \
207
	$(DUKE3D_OBJ)\rts.$o \
208
	$(DUKE3D_OBJ)\config.$o \
209
	$(DUKE3D_OBJ)\animlib.$o\
210
	$(DUKE3D_OBJ)\osdfuncs.$o \
211
	$(DUKE3D_OBJ)\osdcmds.$o \
212
	$(DUKE3D_OBJ)\grpscan.$o \
213
	$(DUKE3D_OBJ)\winbits.$o \
4553 hendricks2 214
	$(DUKE3D_OBJ)\gameres.$(res) \
4543 hendricks2 215
	$(DUKE3D_OBJ)\startwin.game.$o \
4553 hendricks2 216
	$(MACT_OBJS) \
4543 hendricks2 217
	$(DUKE3D_OBJ)\sounds.$o \
218
	$(DUKE3D_OBJ)\soundsdyn.$o \
602 terminx 219
!ifdef DEBUG
4543 hendricks2 220
	$(DUKE3D_OBJ)\mdump.$o
602 terminx 221
!endif
5 Plagman 222
 
4553 hendricks2 223
DUKE3D_EDITOR_OBJS=$(DUKE3D_OBJ)\astub.$o \
4543 hendricks2 224
	$(DUKE3D_OBJ)\common.$o \
225
	$(DUKE3D_OBJ)\mathutil.$o \
226
	$(DUKE3D_OBJ)\m32def.$o \
227
	$(DUKE3D_OBJ)\m32vars.$o \
228
	$(DUKE3D_OBJ)\m32exec.$o \
229
	$(DUKE3D_OBJ)\sounds_mapster32.$o \
230
	$(DUKE3D_OBJ)\rev.$o \
4553 hendricks2 231
	$(DUKE3D_OBJ)\buildres.$(res) \
602 terminx 232
!ifdef DEBUG
4543 hendricks2 233
	$(DUKE3D_OBJ)\mdump.$o
602 terminx 234
!endif
5 Plagman 235
 
4553 hendricks2 236
!if ("$(RENDERTYPE)"=="WIN")
237
ENGINE_OBJS=$(ENGINE_OBJS) $(ENGINE_OBJ)\winlayer.$o $(ENGINE_OBJ)\rawinput.$o
238
!endif
4326 hendricks2 239
!if ("$(RENDERTYPE)"=="SDL")
4553 hendricks2 240
ENGINE_OBJS=$(ENGINE_OBJS) $(ENGINE_OBJ)\sdlayer.$o
241
DUKE3D_OBJS=$(DUKE3D_OBJS) $(DUKE3D_OBJ)\game_icon.$o
242
DUKE3D_EDITOR_OBJS=$(DUKE3D_EDITOR_OBJS) $(DUKE3D_OBJ)\build_icon.$o
4326 hendricks2 243
!endif
244
 
245
!if ("$(MIXERTYPE)"=="WIN")
4553 hendricks2 246
DUKE3D_OBJS=$(DUKE3D_OBJS) $(DUKE3D_OBJ)\midi.$o $(DUKE3D_OBJ)\music.$o $(DUKE3D_OBJ)\mpu401.$o
247
AUDIOLIB_OBJS=$(AUDIOLIB_OBJS) $(AUDIOLIB_OBJ)\driver_directsound.$o
248
AUDIOLIB_CFLAGS=$(AUDIOLIB_CFLAGS) /DHAVE_DS
4326 hendricks2 249
!endif
250
!if ("$(MIXERTYPE)"=="SDL")
4553 hendricks2 251
DUKE3D_OBJS=$(DUKE3D_OBJS) $(DUKE3D_OBJ)\sdlmusic.$o
252
AUDIOLIB_OBJS=$(AUDIOLIB_OBJS) $(AUDIOLIB_OBJ)/driver_sdl.$o
253
AUDIOLIB_CFLAGS=$(AUDIOLIB_CFLAGS) /DHAVE_SDL
4326 hendricks2 254
!endif
255
 
4553 hendricks2 256
DUKE3D_OBJS=$(DUKE3D_OBJS) $(MUSICOBJ)
257
DUKE3D_EDITOR_OBJS=$(DUKE3D_EDITOR_OBJS) $(MUSICOBJ)
4326 hendricks2 258
 
259
 
4553 hendricks2 260
CHECKDIR_ENGINE=@if not exist "$(ENGINE_OBJ)" mkdir "$(ENGINE_OBJ)"
261
CHECKDIR_DUKE3D=@if not exist "$(DUKE3D_OBJ)" mkdir "$(DUKE3D_OBJ)"
262
CHECKDIR_ENET=@if not exist "$(ENET_OBJ)" mkdir "$(ENET_OBJ)"
263
CHECKDIR_AUDIOLIB=@if not exist "$(AUDIOLIB_OBJ)" mkdir "$(AUDIOLIB_OBJ)"
264
 
265
 
5 Plagman 266
# RULES
267
.SUFFIXES: .masm
268
 
4553 hendricks2 269
{$(ENGINE_SRC)}.masm{$(ENGINE_OBJ)}.$o:
270
	$(CHECKDIR_ENGINE)
271
	$(AS) /c $(ASFLAGS) /Fo$@ $<
272
 
273
{$(ENGINE_SRC)\util}.c{$(ENGINE_OBJ)}.$o:
274
	$(CHECKDIR_ENGINE)
275
	$(CC) /c $(CFLAGS) /Fo$@ $<
276
 
277
{$(ENGINE_SRC)\misc}.rc{$(ENGINE_OBJ)}.$(res):
278
	$(CHECKDIR_ENGINE)
279
	$(RC) /i$(ENGINE_INC)\ /fo$@ /r $<
280
 
281
{$(ENGINE_SRC)}.c{$(ENGINE_OBJ)}.$o:
282
	$(CHECKDIR_ENGINE)
283
	$(CC) /c $(CFLAGS) /Fo$@ $<
284
 
285
{$(ENGINE_SRC)}.cc{$(ENGINE_OBJ)}.$o:
286
	$(CHECKDIR_ENGINE)
287
	$(CC) /c $(CFLAGS) /Fo$@ $<
288
 
289
{$(ENGINE_SRC)}.cpp{$(ENGINE_OBJ)}.$o:
290
	$(CHECKDIR_ENGINE)
291
	$(CC) /c $(CFLAGS) /Fo$@ $<
292
 
293
{$(ENGINE_SRC)}.cxx{$(ENGINE_OBJ)}.$o:
294
	$(CHECKDIR_ENGINE)
295
	$(CC) /c $(CFLAGS) /Fo$@ $<
296
 
297
{$(ENET_SRC)}.c{$(ENET_OBJ)}.$o:
298
	$(CHECKDIR_ENET)
299
	$(CC) /c $(CFLAGS) $(ENET_CFLAGS) /Fo$@ $<
300
 
301
{$(AUDIOLIB_SRC)}.c{$(AUDIOLIB_OBJ)}.$o:
302
	$(CHECKDIR_AUDIOLIB)
303
	$(CC) /c $(CFLAGS) $(AUDIOLIB_CFLAGS) /Fo$@ $<
304
 
4543 hendricks2 305
{$(DUKE3D_SRC)\}.masm{$(DUKE3D_OBJ)\}.$o:
4553 hendricks2 306
	$(CHECKDIR_DUKE3D)
5 Plagman 307
	$(AS) /c $(ASFLAGS) /Fo$@ $<
308
 
4543 hendricks2 309
{$(DUKE3D_SRC)\jmact}.c{$(DUKE3D_OBJ)\}.$o:
4553 hendricks2 310
	$(CHECKDIR_DUKE3D)
5 Plagman 311
	$(CC) /c $(CFLAGS) /Fo$@ $<
312
 
4543 hendricks2 313
{$(DUKE3D_SRC)\util}.c{$(DUKE3D_OBJ)\}.$o:
4553 hendricks2 314
	$(CHECKDIR_DUKE3D)
5 Plagman 315
	$(CC) /c $(CFLAGS) /Fo$@ $<
316
 
4543 hendricks2 317
{$(DUKE3D_SRC)\}.c{$(DUKE3D_OBJ)\}.$o:
4553 hendricks2 318
	$(CHECKDIR_DUKE3D)
5 Plagman 319
	$(CC) /c $(CFLAGS) /Fo$@ $<
320
 
4543 hendricks2 321
{$(DUKE3D_RSRC)\}.c{$(DUKE3D_OBJ)\}.$o:
4553 hendricks2 322
	$(CHECKDIR_DUKE3D)
4326 hendricks2 323
	$(CC) /c $(CFLAGS) /Fo$@ $<
324
 
4543 hendricks2 325
{$(DUKE3D_SRC)\}.cpp{$(DUKE3D_OBJ)\}.$o:
4553 hendricks2 326
	$(CHECKDIR_DUKE3D)
5 Plagman 327
	$(CC) /c $(CFLAGS) /Fo$@ $<
328
 
4553 hendricks2 329
{$(DUKE3D_SRC)\misc}.rc{$(DUKE3D_OBJ)\}.$(res):
330
	$(CHECKDIR_DUKE3D)
4543 hendricks2 331
	$(RC) /i$(ENGINE_INC)\ /i$(DUKE3D_SRC)\ /DPOLYMER /fo$@ /r $<
5 Plagman 332
 
333
 
334
# TARGETS
4553 hendricks2 335
all: eduke32$(EXESUFFIX) mapster32$(EXESUFFIX)
5 Plagman 336
 
4553 hendricks2 337
eduke32$(EXESUFFIX): $(DUKE3D_OBJS) $(ENGINE_OBJS) $(AUDIOLIB_OBJS) $(ENET_OBJS)
4320 hendricks2 338
	$(LINK) /OUT:$@ /SUBSYSTEM:WINDOWS $(WINMACHINE) /LIBPATH:$(PLATFORM)\lib$(WINLIB) /LIBPATH:$(AUDIOPLATFORM)\lib$(WINLIB) $(flags_link) /MAP $** $(LIBS)
4543 hendricks2 339
	$(MT) -manifest $(DUKE3D_RSRC)$(WINLIB)\manifest.game.xml -hashupdate -outputresource:$@ -out:$@.manifest
5 Plagman 340
 
4553 hendricks2 341
mapster32$(EXESUFFIX): $(DUKE3D_EDITOR_OBJS) $(ENGINE_OBJS) $(ENGINE_EDITOR_OBJS) $(AUDIOLIB_OBJS)
4320 hendricks2 342
	$(LINK) /OUT:$@ /SUBSYSTEM:WINDOWS $(WINMACHINE) /LIBPATH:$(PLATFORM)\lib$(WINLIB) /LIBPATH:$(AUDIOPLATFORM)\lib$(WINLIB) $(flags_link) /MAP $** $(LIBS)
4543 hendricks2 343
	$(MT) -manifest $(DUKE3D_RSRC)$(WINLIB)\manifest.build.xml -hashupdate -outputresource:$@ -out:$@.manifest
640 terminx 344
 
5 Plagman 345
!include Makefile.deps
4553 hendricks2 346
!include $(ENGINE_ROOT)\Makefile.deps
5 Plagman 347
 
4553 hendricks2 348
# PHONIES
5 Plagman 349
 
350
clean:
4553 hendricks2 351
	-del /Q eduke32$(EXESUFFIX) mapster32$(EXESUFFIX) $(DUKE3D_OBJS) $(DUKE3D_EDITOR_OBJS) *.pdb *.map *.manifest
5 Plagman 352
 
353
veryclean: clean
4553 hendricks2 354
	-del /Q $(ENGINE_OBJS) $(ENGINE_EDITOR_OBJS) $(ENET_OBJS) $(AUDIOLIB_OBJS)