-
Notifications
You must be signed in to change notification settings - Fork 18
/
Makefile.msvc
158 lines (128 loc) · 3.89 KB
/
Makefile.msvc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
# Duke3D Makefile for Microsoft Make
# Engine options
# USE_POLYMOST - enables Polymost renderer
# USE_OPENGL - enables OpenGL support in Polymost
# Define as 0 to disable OpenGL
# Define as 1 (or 2) for GL 2.0/2.1 profile
# Define as 3 for GL 3.2 Core profile
# USE_ASM - enables the use of assembly code if supported
USE_POLYMOST=1
USE_OPENGL=1
USE_ASM=1
RELEASE=1
# Create Makefile.msvcuser yourself to provide your own overrides
# for configurable values
!if EXIST(Makefile.msvcuser)
!include Makefile.msvcuser
!endif
ENGINEROOT=jfbuild
ENGINEINC=$(ENGINEROOT)\include
SRC=src
RSRC=rsrc
MACTROOT=jfmact
AUDIOLIBROOT=jfaudiolib
CC=cl
RC=rc
LINK=link
OURCFLAGS=/nologo /MD /Zl
OURCXXFLAGS=/nologo /MD /Zl /EHsc
OURCPPFLAGS=/I$(SRC) /I$(ENGINEINC) /I$(MACTROOT) /I$(AUDIOLIBROOT)\include
OURLINKFLAGS=/opt:ref /nologo
OURRFLAGS=/nologo /i$(SRC) /i$(ENGINEINC)
OURLIBS=msvcrt.lib ole32.lib
!if $(RELEASE)
# release options
OURCFLAGS=$(OURCFLAGS) /Ox
OURCXXFLAGS=$(OURCXXFLAGS) /Ox
OURLINKFLAGS=$(OURLINKFLAGS) /RELEASE
!else
# debugging options
OURCFLAGS=$(OURCFLAGS) /Ot /Z7
OURCXXFLAGS=$(OURXXCFLAGS) /Ot /Z7
OURLINKFLAGS=$(OURLINKFLAGS) /DEBUG
!endif
o=obj
res=res
!include $(ENGINEROOT)/Makefile.msvcshared
OURCFLAGS=$(OURCFLAGS) $(BUILDCFLAGS)
OURCXXFLAGS=$(OURCXXFLAGS) $(BUILDCXXFLAGS)
OURCPPFLAGS=$(OURCPPFLAGS) $(BUILDCPPFLAGS)
OURLIBS=$(OURLIBS) $(BUILDLIBS)
OURRFLAGS=$(OURRFLAGS) $(BUILDRFLAGS)
!include $(AUDIOLIBROOT)/Makefile.msvcshared
OURLINKFLAGS=$(OURLINKFLAGS) /LIBPATH:$(AUDIOLIBROOT)\third-party\msvc\lib$(PLATFORM)
GAMEOBJS=$(SRC)\game.$o \
$(SRC)\actors.$o \
$(SRC)\gamedef.$o \
$(SRC)\global.$o \
$(SRC)\menues.$o \
$(SRC)\player.$o \
$(SRC)\premap.$o \
$(SRC)\sector.$o \
$(SRC)\sounds.$o \
$(SRC)\rts.$o \
$(SRC)\config.$o \
$(SRC)\osdfuncs.$o \
$(SRC)\osdcmds.$o \
$(SRC)\grpscan.$o \
$(SRC)\winbits.$o \
$(SRC)\gameres.$(res) \
$(SRC)\startwin_game.$o
GAMEOBJS=$(GAMEOBJS) \
$(MACTROOT)\util_lib.$o \
$(MACTROOT)\file_lib.$o \
$(MACTROOT)\control.$o \
$(MACTROOT)\keyboard.$o \
$(MACTROOT)\mouse.$o \
$(MACTROOT)\mathutil.$o \
$(MACTROOT)\scriplib.$o \
$(MACTROOT)\animlib.$o
EDITOROBJS=$(SRC)\astub.$o \
$(SRC)\buildres.$(res)
# Source-control version stamping
!if [git --version >nul] == 0
GAMEOBJS=$(GAMEOBJS) $(SRC)\version-auto.$o
EDITOROBJS=$(EDITOROBJS) $(SRC)\version-auto.$o
!else
GAMEOBJS=$(GAMEOBJS) $(SRC)\version.$o
EDITOROBJS=$(EDITOROBJS) $(SRC)\version.$o
!endif
# RULES
{$(SRC)}.c{$(SRC)}.$o:
$(CC) /TC /c $(CPPFLAGS) $(OURCPPFLAGS) $(CFLAGS) $(OURCFLAGS) /Fo$@ $<
{$(SRC)}.rc{$(SRC)}.$(res):
$(RC) $(OURRFLAGS) /fo$@ /r $<
{$(MACTROOT)}.c{$(MACTROOT)}.$o:
$(CC) /TC /c $(CPPFLAGS) $(OURCPPFLAGS) $(CFLAGS) $(OURCFLAGS) /Fo$@ $<
# TARGETS
all: duke3d$(EXESUFFIX) build$(EXESUFFIX) ;
duke3d$(EXESUFFIX): $(GAMEOBJS) $(ENGINEROOT)\$(ENGINELIB) $(AUDIOLIBROOT)\$(JFAUDIOLIB)
$(LINK) /OUT:$@ /SUBSYSTEM:WINDOWS $(LINKFLAGS) $(OURLINKFLAGS) $** $(JFAUDIOLIB_LINKFLAGS) $(OURLIBS)
build$(EXESUFFIX): $(EDITOROBJS) $(ENGINEROOT)\$(ENGINELIB) $(ENGINEROOT)\$(EDITORLIB)
$(LINK) /OUT:$@ /SUBSYSTEM:WINDOWS $(LINKFLAGS) $(OURLINKFLAGS) $** $(OURLIBS)
$(ENGINEROOT)\$(ENGINELIB) $(ENGINEROOT)\$(EDITORLIB): ALWAYSBUILD
cd "$(@D)"
$(MAKE) /nologo /f Makefile.msvc /$(MAKEFLAGS) USE_POLYMOST=$(USE_POLYMOST) USE_OPENGL=$(USE_OPENGL) USE_ASM=$(USE_ASM) RELEASE=$(RELEASE) $(@F)
cd "$(MAKEDIR)"
$(AUDIOLIBROOT)\$(JFAUDIOLIB): ALWAYSBUILD
cd "$(@D)"
$(MAKE) /nologo /f Makefile.msvc /$(MAKEFLAGS) RELEASE=$(RELEASE) $(@F)
cd "$(MAKEDIR)"
$(SRC)\version-auto.c: ALWAYSBUILD
cmd /c tools\generateversion.cmd > $@
ALWAYSBUILD: ;
# DEPENDENCIES
!include Makefile.deps
# PHONIES
clean::
-del /q $(GAMEOBJS) $(EDITOROBJS)
veryclean:: clean
-del /q duke3d$(EXESUFFIX) build$(EXESUFFIX)
clean veryclean::
cd "$(ENGINEROOT)"
-$(MAKE) /nologo /f Makefile.msvc $@
cd "$(MAKEDIR)"
clean::
cd "$(AUDIOLIBROOT)"
-$(MAKE) /nologo /f Makefile.msvc $@
cd "$(MAKEDIR)"