windows-updates-including-dont-lose-tokens-20011110
[openafs.git] / src / config / NTMakefile.i386_nt40
1 # Copyright 2000, International Business Machines Corporation and others.
2 # All Rights Reserved.
3
4 # This software has been released under the terms of the IBM Public
5 # License.  For details, see the LICENSE file in the top-level source
6 # directory or online at http://www.openafs.org/dl/license10.html
7
8 # Common nmake file to be included in each NTMakfile.
9 #
10 # Required definitions:
11 #     AFSDEV_BUILDTYPE = [ CHECKED | FREE ]
12 #     AFSDEV_INCLUDE = <default include directories>
13 #     AFSDEV_LIB = <default library directories>
14 #     AFSDEV_BIN = <default build binary directories>
15 #
16 # Optional definitions:
17 #     AFSDEV_DESTDIR = <top-level install directory>  (default is $(AFSROOT)\DEST)
18 #     AFSDEV_WARNLEVEL = [0 | 1 | 2 | 3 | 4]  (default is 3)
19 #     AFSDEV_AUXCDEFINES = <auxiliary C preprocessor defs> (default is null)
20 #     AFSDEV_AUXRCFLAGS = <auxiliary resource compiler flags> (default is null)
21 #     AFSDEV_TEXTMODE = <text mode is default if defined>  (default is null)
22 #     AFSDEV_CRTDEBUG = <utilize debug C runtime if define> (default is null)
23 #
24 ############################################################################
25
26
27 # Definitions provided here are based on WIN32.MAK, a common nmake
28 # file included with the MS SDK and MS VC distributions.
29 # WIN32.MAK, and this nmake file, are targeted to the MSVC compiler;
30 # port this nmake file if additional compiler support is required.
31
32 # Define default target-type macros required by WIN32.MAK.
33 # Allow them to be overriden in an NTMakefile or via an environment variable.
34
35 !IFNDEF APPVER
36 APPVER = 4.0
37 !ENDIF
38
39 #define used in WinNT/2000 installation and program version display
40 AFSPRODUCT_VERSION=1.2.2 a
41 CELLNAME_DEFAULT=Your Cell Name
42 CELLSERVDB_INSTALL=CellServDB.GrandCentral
43 CELLSERVDB_WEB=http://grand.central.org/dl/cellservdb/CellServDB
44 #NMAKE_DEFINES=-DDEBUG_VERBOSE
45
46 !IFNDEF TARGETOS
47 TARGETOS = WINNT
48 !ENDIF
49
50 # Check that build type is correctly specified.
51
52 !IF (DEFINED(PROFILE) || DEFINED(TUNE))
53 #    Build type ignored when profiling or tuning.
54 AFSDEV_BUILDTYPE = NONE
55
56 !ELSE
57 #    Build type must be checked or free.
58 !IF ("$(AFSDEV_BUILDTYPE)" != "CHECKED" && "$(AFSDEV_BUILDTYPE)" != "FREE")
59 !ERROR Must define AFSDEV_BUILDTYPE to be CHECKED or FREE.
60 !ENDIF
61
62 !ENDIF
63
64 # Limit default include and library directories to those specified for build.
65
66 !IFNDEF AFSDEV_INCLUDE
67 !ERROR Must define AFSDEV_INCLUDE to be the default include directories.
68 !ENDIF
69
70 !IF ((!DEFINED(INCLUDE)) && ([set INCLUDE=$(AFSDEV_INCLUDE)] != 0))
71 #    If env. var. INCLUDE not defined then macro assignment won't set it.
72 !ERROR Failed setting environment variable INCLUDE.
73 !ENDIF
74 INCLUDE = $(AFSDEV_INCLUDE)
75
76
77 !IFNDEF AFSDEV_LIB
78 !ERROR Must define AFSDEV_LIB to be the default library directories.
79 !ENDIF
80
81 !IF ((!DEFINED(LIB)) && ([set LIB=$(AFSDEV_LIB)] != 0))
82 #    If env. var. LIB not defined then macro assignment won't set it.
83 !ERROR Failed setting environment variable LIB.
84 !ENDIF
85 LIB = $(AFSDEV_LIB)
86
87
88 # Put default build binary directories at front of path.
89
90 !IFNDEF AFSDEV_BIN
91 !ERROR Must define AFSDEV_BIN to be the default build binary directories.
92 !ENDIF
93
94 !IF ((!DEFINED(PATH)) && ([set PATH=$(AFSDEV_BIN)] != 0))
95 #    If env. var. PATH not defined then macro assignment won't set it.
96 !ERROR Failed setting environment variable PATH.
97 !ENDIF
98 PATH = $(AFSDEV_BIN);$(PATH)
99
100
101 # Undefine WIN32.MAK NODEBUG macro.
102 # Always generate full debug info, unless profiling or tuning (see below).
103
104 !UNDEF NODEBUG
105
106 # Include WIN32.MAK nmake file
107
108 !INCLUDE <WIN32.MAK>
109
110
111
112 # Extend and/or supplement definitions in WIN32.MAK.
113
114 # Standard install directory.
115 !IFDEF AFSDEV_DESTDIR
116 DESTDIR = $(AFSDEV_DESTDIR)
117 !ELSE
118 DESTDIR = $(AFSROOT)\DEST
119 !ENDIF
120
121 # Command macros.
122 COPY = copy
123 DEL = -del
124 #DEL = $(DESTDIR)\BIN\rmbat        # win 98 must use batch file
125 MKDIR = mkdir
126 REN = ren
127 ECHO = echo
128 CD = cd
129 MC = mc -vcsU
130 MAKECMD = nmake.exe
131
132 COMPILE_ET = $(DESTDIR)\bin\compile_et
133 RXGEN = $(DESTDIR)\bin\rxgen
134 MIDL  = midl
135
136 # Common clean target.
137 # Double colon (::) syntax allows supplemental clean target to be specified.
138 clean::
139         $(DEL) /q *.obj *.lib *.dll *.exe
140         $(DEL) /q *_component_version_number.*
141
142 # Common lang target.
143 # Double colon (::) syntax allows supplemental lang target to be specified.
144 lang::
145
146
147 # Compiler include paths and preprocessor defines
148
149 afscdefs =\
150         -I. \
151         -I$(DESTDIR)\include \
152         -I$(DESTDIR)\include\afs \
153         -I$(DESTDIR)\include\rx \
154         -DWIN32_LEAN_AND_MEAN \
155         -DSTRICT \
156         -D_WIN32_IE=0x0400 \
157      -DAFS_AFSDB_ENV \
158      -DAFS_FREELANCE_CLIENT
159
160 afscdefs = $(afscdefs) $(AFSDEV_AUXCDEFINES) $(NMAKE_DEFINES)
161
162
163 # Compiler switches (except include paths and preprocessor defines)
164 #
165 # Note: if conflicting options are specified, rightmost option applies.
166 #
167 # /Oy-  specifies no frame-pointer omission
168 # /GF   pool strings and place in read-only memory
169 # /Gd   use cdecl calling convention by default
170 # /Gy   enable function-level linking
171 # /GX   enable C++ exceptions (assumes extern C funcs never throw exceptions)
172 # /Os   favor small (over fast) code; seems to avoid 64-bit bugs in VC compiler
173
174 afscflags =\
175         /Oy- \
176         /GF \
177         /Gd \
178         /Gy \
179         /GX \
180         /Os
181
182 # Set optimization and debugging level based on build type.
183
184 !IF ("$(AFSDEV_BUILDTYPE)" == "FREE")
185 #    Apply full optimization; generate full debug info in obj.
186 afscflags = $(afscflags) /Ox /Z7
187 ldebug = $(ldebug) -debugtype:both
188 cdebug = $(cdebug:-Od=)  # avoid annoying override warning (D4025)
189
190 !ELSEIF ("$(AFSDEV_BUILDTYPE)" == "CHECKED")
191 #    Disable optimization; generate full debug info in obj.
192 afscflags = $(afscflags) /Od /Z7
193 ldebug = $(ldebug) -debugtype:both
194 !ENDIF
195
196 # Set compiler warning level
197
198 !IFNDEF AFSDEV_WARNLEVEL
199 AFSDEV_WARNLEVEL = 3
200 !ELSE
201 !IF ("$(AFSDEV_WARNLEVEL)" != "0" && \
202      "$(AFSDEV_WARNLEVEL)" != "1" && \
203      "$(AFSDEV_WARNLEVEL)" != "2" && \
204      "$(AFSDEV_WARNLEVEL)" != "3" && \
205      "$(AFSDEV_WARNLEVEL)" != "4")
206 !ERROR Must define AFSDEV_WARNLEVEL to be one of 0 through 4.
207 !ENDIF
208 !ENDIF
209
210 afscflags = $(afscflags) /W$(AFSDEV_WARNLEVEL)
211
212
213 # Linker switches
214 #
215 # /FIXED:NO   generates a relocation section in the executable
216
217 afslflags =\
218         /FIXED:NO
219
220
221
222 # For checked builds, define DEBUG (but not the MS control flag _DEBUG).
223
224 !IF ("$(AFSDEV_BUILDTYPE)" == "CHECKED")
225 afscdefs = $(afscdefs) -DDEBUG
226 !ENDIF
227
228 # Utilize the debug version of the MSVC runtime, if requested.
229
230 !IFDEF AFSDEV_CRTDEBUG
231 afscdefs = $(afscdefs) -D_DEBUG
232 conlibsdll = $(conlibsdll:msvcrt.lib=msvcrtd.lib)
233 guilibsdll = $(guilibsdll:msvcrt.lib=msvcrtd.lib)
234 !ENDIF
235
236 # Link with binmode.obj; files will be opened in binary mode by default.
237
238 !IFNDEF AFSDEV_TEXTMODE
239 conlibsdll = $(conlibsdll) binmode.obj
240 guilibsdll = $(guilibsdll) binmode.obj
241 !ENDIF
242
243
244 # Define MFC link and library macros
245 #     Note that MFC seems to make extensive use of default libraries,
246 #     thus we do not specify a general /NODEFAULTLIB.
247
248 mfclflags = $(guilflags)
249 mfclflags = $(mfclflags:/NODEFAULTLIB=)
250
251 mfcdlllflags = $(dlllflags)
252 mfcdlllflags = $(mfcdlllflags:/NODEFAULTLIB=)
253
254 mfclibsdll = $(guilibsdll)
255 mfclibsdll = $(mfclibsdll:msvcrtd.lib=)
256 mfclibsdll = $(mfclibsdll:msvcrt.lib=)
257
258 !IFNDEF AFSDEV_CRTDEBUG
259 mfclflags = $(mfclflags) /NODEFAULTLIB:msvcrtd.lib
260 mfcdlllflags = $(mfcdlllflags) /NODEFAULTLIB:msvcrtd.lib
261 !ELSE
262 mfclflags = $(mfclflags) /NODEFAULTLIB:msvcrt.lib
263 mfcdlllflags = $(mfcdlllflags) /NODEFAULTLIB:msvcrt.lib
264 !ENDIF
265
266
267 # Macros for creating/modifying binary targets
268
269 # EXE link macro for console applications
270 EXECONLINK = $(link) /OUT:$@ $(ldebug) $(conlflags) $(afslflags) $(conlibsdll) $**
271
272 # EXE link macro for GUI applications
273 EXEGUILINK = $(link) /OUT:$@ $(ldebug) $(guilflags) $(afslflags) $(guilibsdll) $**
274
275 # EXE link macro for MFC applications
276 EXEMFCLINK = $(link) /OUT:$@ $(ldebug) $(mfclflags) $(afslflags) $(mfclibsdll) $**
277
278 # DLL link macro for console applications
279 DLLCONLINK = $(link) /OUT:$@ $(ldebug) $(dlllflags) $(afslflags) $(conlibsdll) $**
280
281 # DLL link macro for GUI applications
282 DLLGUILINK = $(link) /OUT:$@ $(ldebug) $(dlllflags) $(afslflags) $(guilibsdll) $**
283
284 # DLL link macro for MFC applications
285 DLLMFCLINK = $(link) /OUT:$@ $(ldebug) $(mfcdlllflags) $(afslflags) $(mfclibsdll) $**
286
287 # DLL link macro for resource-only DLLs
288 DLLRESLINK = $(link) /OUT:$@ $(dlllflags:-entry:_DllMainCRTStartup@12=-noentry) $(afslflags) $**
289
290 # Library archive macro
291 LIBARCH = $(implib) /NOLOGO /OUT:$@ $**
292
293 # Language selection macro
294 NTLANG = $(DESTDIR)\bin\NTLang.bat
295
296
297 # EXE\DLL preparation macros
298 #     Rebase to avoid conflicts; strip symbols in free build.
299 !IF ("$(AFSDEV_BUILDTYPE)" == "FREE")
300 EXEPREP = rebase -b 0x00400000 -x $(@D) -q $@
301 DLLPREP = rebase -i $(DESTDIR)\NTDllmap.txt -x $(@D) -q $@
302 !ELSEIF ("$(AFSDEV_BUILDTYPE)" == "CHECKED")
303 EXEPREP = rebase -b 0x00400000 -q $@
304 DLLPREP = rebase -i $(DESTDIR)\NTDllmap.txt -q $@
305 !ENDIF
306
307 # C/C++ compilation macros
308 C2OBJ = $(cc) $(cflags) $(cdebug) $(cvarsdll) $(afscflags) $(afscdefs) /c
309 CPP2OBJ = $(cc) $(cflags) $(cdebug) $(cvarsdll) $(afscflags) $(afscdefs) /c
310
311 # Resource compiler macro
312 RC = $(rc) $(rcvars) $(rcflags) $(AFSDEV_AUXRCFLAGS) /d "AFSPRODUCT_VERSION=\"$(AFSPRODUCT_VERSION)\""
313
314 # Lex/Yacc macros
315 LEX = flex -l
316 YACC = bison
317
318 # Inference rules for building and installing targets
319
320 # Compile .c files
321 .c.obj:
322         $(C2OBJ) $*.c
323
324 # Compile .cpp files
325 .cpp.obj:
326         $(CPP2OBJ) $*.cpp
327
328 # Compile .rc (resource) files
329 .rc.res:
330         $(RC) $*.rc
331
332 # Install header files
333 .SUFFIXES: .h
334
335 .h.{$(DESTDIR)\include}.h:
336         $(COPY) $(*B).h $(DESTDIR)\include
337
338 .h.{$(DESTDIR)\include\afs}.h:
339         $(COPY) $(*B).h $(DESTDIR)\include\afs
340
341 .h.{$(DESTDIR)\include\rx}.h:
342         $(COPY) $(*B).h $(DESTDIR)\include\rx
343
344 .h.{$(DESTDIR)\include\WINNT}.h:
345         $(COPY) $(*B).h $(DESTDIR)\include\WINNT