2c314157afe57958be1ed5071176ab64e1758276
[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
169 !       IF ((EXIST($(MSSDK)\include)) && (("$(SYS_NAME)"=="i386_win95" ) || ("$(SYS_NAME)"=="I386_WIN95" )))
170 afscdefs=$(afscdefs) -I$(MSSDK)\include $(afscppdefs) \
171 !       ENDIF
172
173 afscdefs = $(afscdefs) $(AFSDEV_AUXCDEFINES)
174
175 #add a few defines for win9xpanel
176 afscppdefs = -D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_WINNT" /D "_AFXDLL"
177
178 # Compiler switches (except include paths and preprocessor defines)
179 #
180 # Note: if conflicting options are specified, rightmost option applies.
181 #
182 # /Oy-  specifies no frame-pointer omission
183 # /GF   pool strings and place in read-only memory
184 # /Gd   use cdecl calling convention by default
185 # /Gy   enable function-level linking
186 # /GX   enable C++ exceptions (assumes extern C funcs never throw exceptions)
187 # /Os   favor small (over fast) code; seems to avoid 64-bit bugs in VC compiler
188
189 afscflags =\
190         /Oy- \
191         /GF \
192         /Gd \
193         /Gy \
194         /GX \
195         /Os
196
197 # Set optimization and debugging level based on build type.
198
199 !IF ("$(AFSDEV_BUILDTYPE)" == "FREE")
200 #    Apply full optimization; generate full debug info in obj.
201 afscflags = $(afscflags) /Ox /Z7
202 ldebug = $(ldebug) -debugtype:both
203 cdebug = $(cdebug:-Od=)  # avoid annoying override warning (D4025)
204
205 !ELSEIF ("$(AFSDEV_BUILDTYPE)" == "CHECKED")
206 #    Disable optimization; generate full debug info in obj.
207 afscflags = $(afscflags) /Od /Z7
208 ldebug = $(ldebug) -debugtype:both
209 !ENDIF
210
211 # Set compiler warning level
212
213 !IFNDEF AFSDEV_WARNLEVEL
214 AFSDEV_WARNLEVEL = 3
215 !ELSE
216 !IF ("$(AFSDEV_WARNLEVEL)" != "0" && \
217      "$(AFSDEV_WARNLEVEL)" != "1" && \
218      "$(AFSDEV_WARNLEVEL)" != "2" && \
219      "$(AFSDEV_WARNLEVEL)" != "3" && \
220      "$(AFSDEV_WARNLEVEL)" != "4")
221 !ERROR Must define AFSDEV_WARNLEVEL to be one of 0 through 4.
222 !ENDIF
223 !ENDIF
224
225 afscflags = $(afscflags) /W$(AFSDEV_WARNLEVEL)
226
227
228 # Linker switches
229 #
230 # /FIXED:NO   generates a relocation section in the executable
231
232 afslflags =\
233         /FIXED:NO
234
235
236
237 # For checked builds, define DEBUG (but not the MS control flag _DEBUG).
238
239 !IF ("$(AFSDEV_BUILDTYPE)" == "CHECKED")
240 afscdefs = $(afscdefs) -DDEBUG
241 !ENDIF
242
243 # Utilize the debug version of the MSVC runtime, if requested.
244
245 !IFDEF AFSDEV_CRTDEBUG
246 afscdefs = $(afscdefs) -D_DEBUG
247 conlibsdll = $(conlibsdll:msvcrt.lib=msvcrtd.lib)
248 guilibsdll = $(guilibsdll:msvcrt.lib=msvcrtd.lib)
249 !ENDIF
250
251 # Link with binmode.obj; files will be opened in binary mode by default.
252
253 !IFNDEF AFSDEV_TEXTMODE
254 conlibsdll = $(conlibsdll) binmode.obj
255 guilibsdll = $(guilibsdll) binmode.obj
256 !ENDIF
257
258
259 # Define MFC link and library macros
260 #     Note that MFC seems to make extensive use of default libraries,
261 #     thus we do not specify a general /NODEFAULTLIB.
262
263 mfclflags = $(guilflags)
264 mfclflags = $(mfclflags:/NODEFAULTLIB=)
265
266 mfcdlllflags = $(dlllflags)
267 mfcdlllflags = $(mfcdlllflags:/NODEFAULTLIB=)
268
269 mfclibsdll = $(guilibsdll)
270 mfclibsdll = $(mfclibsdll:msvcrtd.lib=)
271 mfclibsdll = $(mfclibsdll:msvcrt.lib=)
272
273 !IFNDEF AFSDEV_CRTDEBUG
274 mfclflags = $(mfclflags) /NODEFAULTLIB:msvcrtd.lib
275 mfcdlllflags = $(mfcdlllflags) /NODEFAULTLIB:msvcrtd.lib
276 !ELSE
277 mfclflags = $(mfclflags) /NODEFAULTLIB:msvcrt.lib
278 mfcdlllflags = $(mfcdlllflags) /NODEFAULTLIB:msvcrt.lib
279 !ENDIF
280
281
282 # Macros for creating/modifying binary targets
283
284 # EXE link macro for console applications
285 EXECONLINK = $(link) /OUT:$@ $(ldebug) $(conlflags) $(afslflags) $(conlibsdll) $**
286
287 # EXE link macro for GUI applications
288 EXEGUILINK = $(link) /OUT:$@ $(ldebug) $(guilflags) $(afslflags) $(guilibsdll) $**
289
290 # EXE link macro for MFC applications
291 EXEMFCLINK = $(link) /OUT:$@ $(ldebug) $(mfclflags) $(afslflags) $(mfclibsdll) $**
292
293 # DLL link macro for console applications
294 DLLCONLINK = $(link) /OUT:$@ $(ldebug) $(dlllflags) $(afslflags) $(conlibsdll) $**
295
296 # DLL link macro for GUI applications
297 DLLGUILINK = $(link) /OUT:$@ $(ldebug) $(dlllflags) $(afslflags) $(guilibsdll) $**
298
299 # DLL link macro for MFC applications
300 DLLMFCLINK = $(link) /OUT:$@ $(ldebug) $(mfcdlllflags) $(afslflags) $(mfclibsdll) $**
301
302 # DLL link macro for resource-only DLLs
303 DLLRESLINK = $(link) /OUT:$@ $(dlllflags:-entry:_DllMainCRTStartup@12=-noentry) $(afslflags) $**
304
305 # Library archive macro
306 LIBARCH = $(implib) /NOLOGO /OUT:$@ $**
307
308 # Language selection macro
309 NTLANG = $(DESTDIR)\bin\NTLang.bat
310
311
312 # EXE\DLL preparation macros
313 #     Rebase to avoid conflicts; strip symbols in free build.
314 !IF ("$(AFSDEV_BUILDTYPE)" == "FREE")
315 EXEPREP = rebase -b 0x00400000 -x $(@D) -q $@
316 DLLPREP = rebase -i $(DESTDIR)\NTDllmap.txt -x $(@D) -q $@
317 !ELSEIF ("$(AFSDEV_BUILDTYPE)" == "CHECKED")
318 EXEPREP = rebase -b 0x00400000 -q $@
319 DLLPREP = rebase -i $(DESTDIR)\NTDllmap.txt -q $@
320 !ENDIF
321
322 # C/C++ compilation macros
323
324 C2OBJ = $(cc) $(cflags) $(cdebug) $(cvarsdll) $(afscflags) $(afscdefs) /c
325 CPP2OBJ = $(cc) $(cflags) $(cdebug) $(cvarsdll) $(afscflags) $(afscdefs) $(afscppdefs) /c
326
327 # Resource compiler macro
328 RC = $(rc) $(rcvars) $(rcflags) $(AFSDEV_AUXRCFLAGS)
329
330 # Lex/Yacc macros
331 LEX = flex -l
332 YACC = bison
333
334 # Inference rules for building and installing targets
335
336 # Compile .c files
337 .c.obj:
338         $(C2OBJ) $*.c
339
340 # Compile .cpp files
341 .cpp.obj:
342         $(CPP2OBJ) $*.cpp
343
344 # Compile .rc (resource) files
345 .rc.res:
346         $(RC) $*.rc
347
348 # Install header files
349 .SUFFIXES: .h
350
351 .h.{$(DESTDIR)\include}.h:
352         $(COPY) $(*B).h $(DESTDIR)\include
353
354 .h.{$(DESTDIR)\include\afs}.h:
355         $(COPY) $(*B).h $(DESTDIR)\include\afs
356
357 .h.{$(DESTDIR)\include\rx}.h:
358         $(COPY) $(*B).h $(DESTDIR)\include\rx
359
360 .h.{$(DESTDIR)\include\WINNT}.h:
361         $(COPY) $(*B).h $(DESTDIR)\include\WINNT
362