1 # Copyright 2000, International Business Machines Corporation and others.
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
8 # Common nmake file to be included in each NTMakfile.
10 # Required definitions:
11 # AFSDEV_BUILDTYPE = [ CHECKED | FREE ]
13 # Optional definitions:
14 # AFSDEV_WARNLEVEL = [0 | 1 | 2 | 3 | 4] (default is 3)
15 # AFSDEV_AUXCDEFINES = <auxiliary C preprocessor defs> (default is null)
16 # AFSDEV_AUXRCFLAGS = <auxiliary resource compiler flags> (default is null)
17 # AFSDEV_AUXMIDLFLAGS = auxiliary midl flags
18 # AFSDEV_TEXTMODE = <text mode is default if defined> (default is null)
19 # DEBUG_VERBOSE = optional debug statements for testing
20 # AFS_OBJDIR - Location of object directory, either absolute or relative
21 # AFSROOT - ROOT Directory so that $(AFSROOT)\scr is location of source
23 ############################################################################
24 # Optional compliation flags
25 # NO_CRTDBG - used to disable some builds for CFTDBG allocate mapping
26 # _CRTDBG_MAP_ALLOC = <utilize crt debug C runtime if define> (default is null)
27 # VADUMP - define VADUMP=1 if you are going to use the vadump utility and you are using V6.0
29 ####### Special optional defines
31 !IFNDEF NO_CRTDBG #don't set _CRTDBG_MAP_ALLOC flag for some module compliations
39 !IF EXISTS("TOOLS.INI")
40 !MESSAGE ************CAUTION TOOLS.INI IN EFFECT**********
42 !IF ("$(AFSROOT)"=="")
43 !ERROR AFSROOT is not set
45 !IF (DEFINED(PROFILE) || DEFINED(TUNE))
46 AFSDEV_BUILDTYPE = NONE
48 !IF ("$(AFSDEV_BUILDTYPE)" != "CHECKED" && "$(AFSDEV_BUILDTYPE)" != "FREE")
49 !ERROR Must define AFSDEV_BUILDTYPE to be CHECKED or FREE.
52 !IF ("$(AFSDEV_BUILDTYPE)" == "FREE")
53 !UNDEF _CRTDBG_MAP_ALLOC
56 # Limit default include and library directories to those specified for build.
58 !IFNDEF AFSDEV_INCLUDE
59 !ERROR Must define AFSDEV_INCLUDE to be the default include directories.
62 !IF ((!DEFINED(INCLUDE)) && ([set INCLUDE=$(AFSDEV_INCLUDE)] != 0))
63 # If env. var. INCLUDE not defined then macro assignment won't set it.
64 !ERROR Failed setting environment variable INCLUDE.
66 INCLUDE = $(AFSDEV_INCLUDE)
70 !ERROR Must define AFSDEV_LIB to be the default library directories.
73 !IF ((!DEFINED(LIB)) && ([set LIB=$(AFSDEV_LIB)] != 0))
74 # If env. var. LIB not defined then macro assignment won't set it.
75 !ERROR Failed setting environment variable LIB.
79 #define used in WinNT/2000 installation and program version display
80 AFSPRODUCT_VERSION=1.3.51
81 AFSPRODUCT_FILE_VERSION=1,3,5100,0
82 CELLNAME_DEFAULT=Your Cell Name
83 CELLSERVDB_INSTALL=CellServDB.GrandCentral
84 CELLSERVDB_WEB=http://grand.central.org/dl/cellservdb/CellServDB
87 # Define defaults folder locations
92 !IF ("$(AFS_OBJDIR)"=="")
93 ######### AFS_OBJDIR is NOT used use default locations
94 ! IF ("$(AFSDEV_BUILDTYPE)" == "CHECKED")
95 DESTDIR=$(AFSROOT)\$(DEST)\checked
96 OJT=$(AFSROOT)\$(OBJ)\checked
98 DESTDIR=$(AFSROOT)\$(DEST)\free
99 OJT=$(AFSROOT)\$(OBJ)\free
101 UTIL_CR = $(DESTDIR)\bin\util_cr.exe
103 ######### AFS_OBJDIR is defined, use specific locations for obj and dest
104 # there is a special case for config because util_cr is not defined yet!
105 ! IF (EXIST($(AFSROOT)\$(AFS_OBJDIR)))
106 # AFS_OBJDIR is relative path
107 ! IF ("$(AFSDEV_BUILDTYPE)" == "CHECKED")
108 DESTDIR=$(AFSROOT)\$(AFS_OBJDIR)\$(DEST)\checked
109 OJT=$(AFSROOT)\$(AFS_OBJDIR)\checked\config
111 OJT=$(AFSROOT)\$(AFS_OBJDIR)\free\config
112 DESTDIR=$(AFSROOT)\$(AFS_OBJDIR)\$(DEST)\free
115 ! IF (EXIST($(AFS_OBJDIR)))
116 # AFS_OBJDIR is full path
117 ! IF ("$(AFSDEV_BUILDTYPE)" == "CHECKED")
118 DESTDIR=$(AFS_OBJDIR)\$(DEST)\checked
119 OJT=$(AFS_OBJDIR)\checked\config
121 DESTDIR=$(AFS_OBJDIR)\$(DEST)\free
122 OJT=$(AFS_OBJDIR)\free\config
125 !ERROR Can't find location of DEST directory!
128 UTIL_CR = $(DESTDIR)\bin\util_cr.exe
130 ! IF ("$(MAKEDIR:\config=)"=="$(MAKEDIR)")
131 # we are NOT doing a config make, use util_cr to generate object directory
132 ! IF ( !EXIST($(UTIL_CR)) || (!EXIST($(TMP)\home) && !EXIST($(TEMP)\home)) || (([$(UTIL_CR) _dir "!$(AFSDEV_BUILDTYPE)!src!$(AFS_OBJDIR)!"])!=0))
133 !ERROR Can't produce object paths, util_cr not working , TMP or TEMP environment variables not defined
136 ! IF EXIST($(TMP)\home)
139 !INCLUDE $(TEMP)\home
144 !IF ("$(RELDIR)"=="")
150 !MESSAGE Directory assignments:
151 !MESSAGE OJT=[$(OJT)]
152 !MESSAGE OUT=[$(OUT)]
153 !MESSAGE DESTDIR=[$(DESTDIR)]
155 # Definitions provided here are based on WIN32.MAK, a common nmake
156 # file included with the MS SDK and MS VC distributions.
157 # WIN32.MAK, and this nmake file, are targeted to the MSVC compiler;
158 # port this nmake file if additional compiler support is required.
160 !IF ("$(AFSVER_CL)"=="1300")
161 afslflags = $(afslflags) /DEBUG
164 !IF ("$(APPVER)" == "")
172 # Extend and/or supplement definitions in WIN32.MAK.
184 COMPILE_ET = $(DESTDIR)\bin\compile_et
185 RXGEN = $(DESTDIR)\bin\rxgen
188 # Common clean target.
190 $(DEL) /q $(OUT)\*.obj $(OUT)\*.lib $(OUT)\*.dll $(OUT)\*.exe $(OUT)\*.pdb
191 $(DEL) /q $(OUT)\*_component_version_number.* *_component_version_number.*
193 # Common lang target.
197 #################### Compile optional build flags set ###########
201 -I$(DESTDIR)\include \
202 -I$(DESTDIR)\include\afs \
203 -I$(DESTDIR)\include\rx \
204 -DWIN32_LEAN_AND_MEAN \
207 -D_WIN32_WINNT=0x0400 \
209 -DAFS_FREELANCE_CLIENT \
211 $(AFSDEV_AUXCDEFINES)
214 # Compiler switches (except include paths and preprocessor defines)
216 # Note: if conflicting options are specified, rightmost option applies.
218 # /Oy- specifies no frame-pointer omission
219 # /GF pool strings and place in read-only memory
220 # /Gd use cdecl calling convention by default
221 # /Gy enable function-level linking
222 # /GX enable C++ exceptions (assumes extern C funcs never throw exceptions)
223 # /Os favor small (over fast) code; seems to avoid 64-bit bugs in VC compiler
233 cdebug = $(cdebug:-Z7=-Zi) # avoid annoying override warning (D4025)
234 !IF ("APPSVER"=="1300")
235 cdebug = $(cdebug) -Zi
238 !IF ("$(AFSDEV_BUILDTYPE)" == "FREE")
240 afscflags = $(afscflags) /Ox
241 cdebug = $(cdebug:-Od=) # avoid annoying override warning (D4025)
242 cvarsdll = $(cvarsdll:-MDd=-MD)
245 !ELSE # CHECKED BUILD
247 !IF ("$(AFSVER_CL)"=="1200")
248 afscdefs = $(afscdefs) -DDEBUG
251 !IFDEF _CRTDBG_MAP_ALLOC
252 afscflags = $(afscflags) -D_DEBUG -D_CRTDBG_MAP_ALLOC
258 # Set compiler warning level
260 !IFNDEF AFSDEV_WARNLEVEL
263 !IF ("$(AFSDEV_WARNLEVEL)" != "0" && \
264 "$(AFSDEV_WARNLEVEL)" != "1" && \
265 "$(AFSDEV_WARNLEVEL)" != "2" && \
266 "$(AFSDEV_WARNLEVEL)" != "3" && \
267 "$(AFSDEV_WARNLEVEL)" != "4")
268 !ERROR Must define AFSDEV_WARNLEVEL to be one of 0 through 4.
272 afscflags = $(afscflags) /W$(AFSDEV_WARNLEVEL)
274 # C/C++ compilation macros
275 C2OBJ = $(cc) /Fo$@ /Fd$*.pdb $(cflags) $(cdebug) $(cvarsdll) $(afscflags) $(afscdefs) /c
277 # Inference rules for building and installing targets
278 # Compile .c files, from current directory to defined by OUT
292 $(RC) /fo$(OUT)\$(<B).res $<
294 # Compile .rc (resource) files
300 .h.{$(DESTDIR)\include\afs}.h:
301 $(COPY) $< $(DESTDIR)\include\afs
303 .h.{$(DESTDIR)\include\rx}.h:
304 $(COPY) $< $(DESTDIR)\include\rx
306 .h.{$(DESTDIR)\include}.h:
307 $(COPY) $< $(DESTDIR)\include
309 .h.{$(DESTDIR)\include\WINNT}.h:
310 $(COPY) $< $(DESTDIR)\include\WINNT
312 .h.{$(DESTDIR)\include}.h:
313 $(COPY) $(*B).h $(DESTDIR)\include
315 .h.{$(DESTDIR)\include\afs}.h:
316 $(COPY) $(*B).h $(DESTDIR)\include\afs
318 .h.{$(DESTDIR)\include\rx}.h:
319 $(COPY) $(*B).h $(DESTDIR)\include\rx
321 .h.{$(DESTDIR)\include\WINNT}.h:
322 $(COPY) $(*B).h $(DESTDIR)\include\WINNT
324 # Resource compiler macro
325 RC = $(rc) $(rcvars) $(rcflags) $(AFSDEV_AUXRCFLAGS) /d "AFSPRODUCT_VERSION=\"$(AFSPRODUCT_VERSION)\""
327 #################### Link optional build flags set ###########
330 /FIXED:NO /VERBOSE:LIB
332 mfclflags = $(guilflags)
333 mfclflags = $(mfclflags:/NODEFAULTLIB=)
335 mfcdlllflags = $(dlllflags)
336 mfcdlllflags = $(mfcdlllflags:/NODEFAULTLIB=)
338 mfclibsdll = $(guilibsdll)
339 mfclibsdll = $(mfclibsdll:msvcrtd.lib=)
340 mfclibsdll = $(mfclibsdll:msvcrt.lib=)
342 # Link with binmode.obj; files will be opened in binary mode by default.
343 !IF ("$(AFSDEV_BUILDTYPE)" == "FREE")
346 EXEPREP = rebase -b 0x00400000 -x $(@D) -q $@
347 DLLPREP = rebase -i $(DESTDIR)\NTDllmap.txt -x $(@D) -q $@
351 ldebug = /NODEFAULTLIB:LIBC
353 #!IF ("AFSVER_CL"=="1200")
354 #ldebug = $(ldebug) -debugtype:cv
357 # Disable optimization; generate full debug info in obj.
358 afscflags = $(afscflags) /Od /Zi
361 !IF ("AFSVER_CL"=="1200")
362 ldebug = $(ldebug) -debugtype:both
363 ldebug = $(ldebug:-debugtype:cv=)
367 !IFNDEF _CRTDBG_MAP_ALLOC
368 mfclflags = $(mfclflags) /NODEFAULTLIB:msvcrtd.lib
369 mfcdlllflags = $(mfcdlllflags) /NODEFAULTLIB:msvcrtd.lib
371 #v6.0 doesn't work using msvcrtd.lib unless _CRTDBG_MAP_ALLOC is defined, v7.0 requires it
372 !IF ("$(AFSVER_CL)"=="1200")
373 EXEMFCLINK=$(EXEMFCLINK:/NODEFAULTLIB:msvcrtd.lib=)
374 DLLMFCLINK=$(DLLMFCLINK:/NODEFAULTLIB:msvcrtd.lib=)
378 mfclflags = $(mfclflags) /NODEFAULTLIB:msvcrtd.lib
379 mfcdlllflags = $(mfcdlllflags) /NODEFAULTLIB:msvcrtd.lib
380 conlibsdll = $(conlibsdll:msvcrt.lib=msvcrtd.lib)
381 guilibsdll = $(guilibsdll:msvcrt.lib=msvcrtd.lib)
384 EXEPREP = rebase -b 0x00400000 -q $@
385 DLLPREP = rebase -i $(DESTDIR)\NTDllmap.txt -q $@
390 # EXE link macro for console applications
391 EXECONLINK = $(link) /OUT:$@ /DEBUG /PDB:$*.pdb $(ldebug) $(conlflags) $(afslflags) $(conlibsdll) Advapi32.lib user32.lib version.lib $**
393 # EXE link macro for GUI applications
394 EXEGUILINK = $(link) /OUT:$@ /DEBUG /PDB:$*.pdb $(ldebug) $(guilflags) $(afslflags) $(guilibsdll) $**
396 # EXE link macro for MFC applications
397 EXEMFCLINK = $(link) /OUT:$@ /DEBUG /PDB:$*.pdb $(ldebug) $(mfclflags) $(afslflags) $(mfclibsdll) $**
399 # DLL link macro for console applications
400 DLLCONLINK = $(link) /OUT:$@ /DEBUG /PDB:$*.pdb $(ldebug) $(dlllflags) $(afslflags) $(conlibsdll) $**
402 # DLL link macro for GUI applications
403 DLLGUILINK = $(link) /OUT:$@ /DEBUG /PDB:$*.pdb $(ldebug) $(dlllflags) $(afslflags) $(guilibsdll) $**
404 EXECONLINK = $(link) /OUT:$@ /DEBUG /PDB:$*.pdb $(ldebug) $(conlflags) $(afslflags) $(conlibsdll) Advapi32.lib user32.lib version.lib $**
405 DLLMFCLINK = $(link) /OUT:$@ /DEBUG /PDB:$*.pdb $(ldebug) $(mfcdlllflags) $(afslflags) $(mfclibsdll) $**
408 # DLL link macro for resource-only DLLs
409 DLLRESLINK = $(link) /OUT:$@ $(dlllflags:-entry:_DllMainCRTStartup@12=-noentry) $(afslflags) $**
411 # Library archive macro
412 LIBARCH = $(implib) /NOLOGO /OUT:$@ $**
414 # Language selection macro
415 NTLANG = $(DESTDIR)\bin\NTLang.bat
420 AFSDEV_AUXMIDLFLAGS=/Oi