summaryrefslogtreecommitdiff
path: root/MSVC/Tools/master.mak
blob: 644be1361a1b9751d6c9f65f34be3db91dd1e957 (plain)
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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
!IFNDEF COMMONTOOLSPATH
!ERROR Env Variable COMMONTOOLSPATH must be defined
!ENDIF

#--------------------------------------------------------------------------
#needed so we can say foo.dll: foo.cpp and it will just work
.SUFFIXES: .tlb .il .dll .cpp .js .cs .vb .rc .ocx .reg .resources .txt .resX .wsdl .asmx .lex

#--------------------------------------------------------------------------
#define the names of the compilers we ship
_BC=vbc.exe
_CL=cl.exe
_C1=C1.dll
_CX=c1xx.dll
_C2=c2.dll
_CS=csc.exe
_JS=jsc.exe
_ASSEM=ilasm.exe

# Comment this line out to turn debug mode off
DEBUG=TRUE

#--------------------------------------------------------------------------
#Use the _MAKE_STOP environment variable if you want NMAKE to stop on error
# if not defined (default), NMAKE will IGNORE errors and continue
!IFNDEF _MAKE_STOP
.IGNORE :
!ENDIF
#---------------------------------------------------------------------------

#Allow builds with custom compiler path
!IFDEF CUST_CS
_CS=$(CUST_CS)
!ENDIF

#define the names of some common tools
_TLBIMP=tlbimp.exe
_TLBEXP=tlbexp.exe
_REGASM=regasm.exe
_REGSVR=regsvr32.exe
_RSC=rc.exe
_RESGEN=resgen.exe
_AL=al.exe
_SHAREDNAME=sn.exe
_LEX=flex.exe

#IFDEF OS

_MAKE_IN_DIR = $(COMMONTOOLSPATH)\MakInDir.bat

#ELSE

_MAKE_IN_DIR = call "$(COMMONTOOLSPATH)\MakInDir.bat"

#ENDIF

_GACUTIL=gacutil.exe
_WSDL=wsdl.exe
_XSD=xsd.exe

#define our basic link line for managed code
_LINK=link.exe /INCREMENTAL /NOLOGO /DEBUG /SUBSYSTEM:CONSOLE /MACHINE:IX86 /NODEFAULTLIB:LIBC

#this is used for compiling C# samples
#reset this in individual sample makefile to your imports if required
_IMPORTS=

#this is used for compiling C# samples, that use Resources
#reset this in individual sample makefile to your resource imports if required
_WIN32RES=

#This is used for compiling C# samples that use Assembly and key files
#reset this in individual sample makefile to your resource imports if required
_KEYFILE=

#this is used for compiling C# samples
#set the default out directory to .
_OUTDIR=.

#Set what to clean by default
!IFNDEF _CLEANFILES
_CLEANFILES=*.obj *.tlb *.reg
!ENDIF

#set some command C++ flags
_CFLAGS=$(_CCFLAGS) /c /EHsc /D "_WINDOWS" /D "ZLIB_DLL"

#set debug as the default for c++
_CDFLAGS=$(_CFLAGS) /Zi

#set some command link flags
_LFLAGS=-noentry
_LDFLAGS=-noentry -dll

!IFDEF DEBUG

_CS_DLL_FLAGS=/nologo /t:library /debug+ $(TRACE)
_CS_EXE_FLAGS=/nologo /t:exe /debug+  $(TRACE)

_VB_DLL_FLAGS=/nologo /t:library /debug+ $(TRACE)
_VB_EXE_FLAGS=/nologo /t:exe /debug+  $(TRACE)

_JS_DLL_FLAGS=/nologo /t:library /debug+ $(TRACE)
_JS_EXE_FLAGS=/nologo /t:exe /debug+ $(TRACE)
_RESGEN_FLAGS=

!ELSE

_CS_DLL_FLAGS=/nologo /t:library $(TRACE)
_CS_EXE_FLAGS=/nologo $(TRACE)
_VB_DLL_FLAGS=/nologo /t:library $(TRACE)
_VB_EXE_FLAGS=/nologo /t:exe $(TRACE)
_JS_DLL_FLAGS=/nologo $(TRACE)
_JS_EXE_FLAGS=/nologo /exe $(TRACE)
_RESGEN_FLAGS=

!ENDIF

!IFDEF OS

_RMDIR=rd /s /q

!ELSE

_RMDIR=deltree /y

!ENDIF

#default compile and link for c++ files building a dll
#note: name.cpp and name.dll must match
.cpp.dll:
  if not exist $(_OUTDIR) md $(_OUTDIR)
  $(_CL) $(_CDFLAGS) $*.cpp
  $(_LINK) $(_LDFLAGS) $(_LIBS) $*.obj

#default compile and link for c++ files building a exe
#note: name.cpp and name.exe must match
.cpp.exe:
  if not exist $(_OUTDIR) md $(_OUTDIR)
  $(_CL) $(_CDFLAGS) $*.cpp
  $(_LINK) $(_LFLAGS) $(_LIBS) $*.obj

.c.exe:
  if not exist $(_OUTDIR) md $(_OUTDIR)
  $(_CL) $(_CDFLAGS) $*.c
  $(_LINK) $(_LFLAGS) $(_LIBS) $*.obj

.lex.exe:
  if not exist $(_OUTDIR) md $(_OUTDIR)
  $(_LEX) -o$*.c $*.lex
  $(_CL) $(CDFLAGS) $*.c

#default compile and link for c++ files building an obj
#note: name.cpp and name.obj must match
.cpp.obj:
  $(_CL) $(_CDFLAGS) $*.cpp

#default compile and link for c++ files building an exe
#note: name.obj and name.exe must match
.obj.exe:
  $(_LINK) $(_LFLAGS) $(_LIBS) $**

#default compile and link for c++ files building a dll
.obj.dll:
  $(_LINK) $(_LDFLAGS) $(_LIBS) $*.obj

#default compiling vb files
.vb.dll:
  if not exist $(_OUTDIR) md $(_OUTDIR)
  $(_BC) $(_VB_DLL_FLAGS) $(_IMPORTS)  /out:$(_OUTDIR)\$@ $** $(COMMONTOOLSPATH)\QuickStart\QSVersion.vb $(_WIN32RES) $(_KEYFILE)

.vb.exe:
  if not exist $(_OUTDIR) md $(_OUTDIR)
  $(_BC) $(_VB_EXE_FLAGS) $(_IMPORTS)  /out:$(_OUTDIR)\$@ $** $(COMMONTOOLSPATH)\QuickStart\QSVersion.vb $(_WIN32RES) $(_KEYFILE)

#default compiling C# files
.cs.dll:
  if not exist $(_OUTDIR) md $(_OUTDIR)
  $(_CS) $(_CS_DLL_FLAGS) $(_IMPORTS) /out:$(_OUTDIR)\$@ $** $(COMMONTOOLSPATH)\QuickStart\QSVersion.cs $(_WIN32RES) $(_KEYFILE)


#default compiling C# files
.cs.exe:
  if not exist $(_OUTDIR) md $(_OUTDIR)
  $(_CS) $(_CS_EXE_FLAGS) $(_IMPORTS) /out:$(_OUTDIR)\$@ $** $(COMMONTOOLSPATH)\QuickStart\QSVersion.cs $(_WIN32RES) $(_KEYFILE)


#default compiling C# files
.js.dll:
  if not exist $(_OUTDIR) md $(_OUTDIR)
  $(_JS) $(_JS_DLL_FLAGS) $(_IMPORTS) /out:$(_OUTDIR)\$@ $** $(COMMONTOOLSPATH)\QuickStart\QSVersion.js $(_WIN32RES) $(_KEYFILE)


#default compiling C# files
.js.exe:
  if not exist $(_OUTDIR) md $(_OUTDIR)
  $(_JS) $(_JS_EXE_FLAGS) $(_IMPORTS) /out:$(_OUTDIR)\$@ $** $(COMMONTOOLSPATH)\QuickStart\QSVersion.js $(_WIN32RES) $(_KEYFILE)

#default for registering an ocx

.ocx.reg:
  $(_REGSVR) /s $*.ocx

#define for compiling il to an exe
.il.exe:
  $(_ASSEM) $*.il

#define for compiling il to a dll
.il.dll:
  $(_ASSEM) $*.il /DLL

#define for compiling asm to an exe
.asm.exe:
  $(_ASSEM) $*.asm

#define for compiling asm to an exe
.asm.dll:
  $(_ASSEM) $*.asm /DLL

#define for compiling Service Desc Language to C# (names must match (files & classes))
.wsdl.cs:
!IFDEF _NAMESPACE
!IFDEF _SDLPATH
        $(_WSDL) /l:CS /n:$(_NAMESPACE) /out:$*.cs $(_SDLPATH)
!ELSE
        $(_WSDL) /l:CS /n:$(_NAMESPACE) /out:$*.cs $**
!ENDIF
!ELSE
!IFDEF _SDLPATH
        $(_WSDL) /l:CS /n:$* /out:$*.cs $(_SDLPATH)
!ELSE
        $(_WSDL) /l:CS /n:$* /out:$*.cs $**
!ENDIF
!ENDIF

#define for compiling Service Desc Language to JScript (names must match (files & classes))
.wsdl.js:
!IFDEF _NAMESPACE
!IFDEF _SDLPATH
        $(_WSDL) /l:JS /n:$(_NAMESPACE) /out:$*.js $(_SDLPATH)
!ELSE
        $(_WSDL) /l:JS /n:$(_NAMESPACE) /out:$*.js $**
!ENDIF
!ELSE
!IFDEF _SDLPATH
        $(_WSDL) /l:JS /n:$*JS /out:$*.js $(_SDLPATH)
!ELSE
        $(_WSDL) /l:JS /n:$*JS /out:$*.js $**
!ENDIF
!ENDIF

#define for compiling Service Desc Language to VB (names must match (files & classes))
.wsdl.vb:
!IFDEF _NAMESPACE
!IFDEF _SDLPATH
        $(_WSDL) /l:VB /n:$(_NAMESPACE) /out:$*.vb $(_SDLPATH)
!ELSE
        $(_WSDL) /l:VB /n:$(_NAMESPACE) /out:$*.vb $**
!ENDIF
!ELSE
!IFDEF _SDLPATH
        $(_WSDL) /l:VB /n:$*VB /out:$*.vb $(_SDLPATH)
!ELSE
        $(_WSDL) /l:VB /n:$*VB /out:$*.vb $**
!ENDIF
!ENDIF

#define for compiling Service Desc Language from Web Service to JS
.asmx.js:
!IFDEF _NAMESPACE
!IFDEF _SDLPATH
        $(_WSDL) /l:JS /n:$(_NAMESPACE) /out:$*.js $(_SDLPATH)
!ELSE
        $(_WSDL) /l:JS /n:$(_NAMESPACE) /out:$*.js $**
!ENDIF
!ELSE
!IFDEF _SDLPATH
        $(_WSDL) /l:JS /n:$*JS /out:$*.js $(_SDLPATH)
!ELSE
        $(_WSDL) /l:JS /n:$*JS /out:$*.js $**
!ENDIF
!ENDIF

#define for compiling Service Desc Language from Web Service to CSharp
.asmx.cs:
!IFDEF _NAMESPACE
!IFDEF _SDLPATH
        $(_WSDL) /l:CS /n:$(_NAMESPACE) /out:$*.cs $(_SDLPATH)
!ELSE
        $(_WSDL) /l:CS /n:$(_NAMESPACE) /out:$*.cs $**
!ENDIF
!ELSE
!IFDEF _SDLPATH
        $(_WSDL) /l:CS /n:$* /out:$*.cs $(_SDLPATH)
!ELSE
        $(_WSDL) /l:CS /n:$* /out:$*.cs $**
!ENDIF
!ENDIF

#define for compiling Service Desc Language from Web Service to VB
.asmx.vb:
!IFDEF _NAMESPACE
!IFDEF _SDLPATH
        $(_WSDL) /l:VB /n:$(_NAMESPACE) /out:$*.vb $(_SDLPATH)
!ELSE
        $(_WSDL) /l:VB /n:$(_NAMESPACE) /out:$*.vb $**
!ENDIF
!ELSE
!IFDEF _SDLPATH
        $(_WSDL) /l:VB /n:$*VB /out:$*.vb $(_SDLPATH)
!ELSE
        $(_WSDL) /l:VB /n:$*VB /out:$*.vb $**
!ENDIF
!ENDIF

#define for compiling RESX files to resource files using Resgen
.resX.resources:
  $(_RESGEN) $(_RESGEN_FLAGS) $*.resX $*.resources

#define for compiling .TXT files to resource files using Resgen
.txt.resources:
  $(_RESGEN) $(_RESGEN_FLAGS) $*.txt $*.resources