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