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