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