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