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 #define used in WinNT/2000 installation and program version display
57 AFSPRODUCT_VERSION=1.2.11
58 AFSPRODUCT_FILE_VERSION=1,2,1100,0
59 CELLNAME_DEFAULT=Your Cell Name
60 CELLSERVDB_INSTALL=CellServDB.GrandCentral
61 CELLSERVDB_WEB=http://grand.central.org/dl/cellservdb/CellServDB
64 # Define defaults folder locations
69 !IF ("$(AFS_OBJDIR)"=="")
70 ######### AFS_OBJDIR is NOT used use default locations
71 ! IF ("$(AFSDEV_BUILDTYPE)" == "CHECKED")
72 DESTDIR=$(AFSROOT)\$(OBJ)\$(DEST)\checked
73 OJT=$(MAKEDIR:src=obj\checked)
75 DESTDIR=$(AFSROOT)\$(OBJ)\$(DEST)\free
76 OJT=$(MAKEDIR:src=obj\free)
78 UTIL_CR = $(DESTDIR)\bin\util_cr.exe
80 ######### AFS_OBJDIR is defined, use specific locations for obj and dest
81 # there is a special case for config because util_cr is not defined yet!
82 ! IF (EXIST($(AFSROOT)\$(AFS_OBJDIR)))
83 # AFS_OBJDIR is relative path
84 ! IF ("$(AFSDEV_BUILDTYPE)" == "CHECKED")
85 DESTDIR=$(AFSROOT)\$(AFS_OBJDIR)\$(DEST)\checked
86 OJT=$(AFSROOT)\$(AFS_OBJDIR)\checked\config
88 OJT=$(AFSROOT)\$(AFS_OBJDIR)\free\config
89 DESTDIR=$(AFSROOT)\$(AFS_OBJDIR)\$(DEST)\free
92 ! IF (EXIST($(AFS_OBJDIR)))
93 # AFS_OBJDIR is full path
94 ! IF ("$(AFSDEV_BUILDTYPE)" == "CHECKED")
95 DESTDIR=$(AFS_OBJDIR)\$(DEST)\checked
96 OJT=$(AFS_OBJDIR)\checked\config
98 DESTDIR=$(AFS_OBJDIR)\$(DEST)\free
99 OJT=$(AFS_OBJDIR)\free\config
102 !ERROR Can't find location of DEST directory!
105 UTIL_CR = $(DESTDIR)\bin\util_cr.exe
107 ! IF ("$(MAKEDIR:\config=)"=="$(MAKEDIR)")
108 # we are NOT doing a config make, use util_cr to generate object directory
109 ! IF ( !EXIST($(UTIL_CR)) || (!EXIST($(TMP)\home) && !EXIST($(TEMP)\home)) || (([$(UTIL_CR) _dir "!$(AFSDEV_BUILDTYPE)!src!$(AFS_OBJDIR)!"])!=0))
110 !ERROR Can't produce object paths, util_cr not working , TMP or TEMP environment variables not defined
113 ! IF EXIST($(TMP)\home)
116 !INCLUDE $(TEMP)\home
121 !MESSAGE Directory assignments: OJT=[$(OJT)] DESTDIR=[$(DESTDIR)]
123 # Definitions provided here are based on WIN32.MAK, a common nmake
124 # file included with the MS SDK and MS VC distributions.
125 # WIN32.MAK, and this nmake file, are targeted to the MSVC compiler;
126 # port this nmake file if additional compiler support is required.
128 !IF ("$(AFSVER)"=="1300")
129 afslflags = $(afslflags) /DEBUG
132 !IF ("$(APPVER)" == "")
140 # Extend and/or supplement definitions in WIN32.MAK.
152 COMPILE_ET = $(DESTDIR)\bin\compile_et
153 RXGEN = $(DESTDIR)\bin\rxgen
156 # Common clean target.
158 $(DEL) /q $(OJT)\*.obj $(OJT)\*.lib $(OJT)\*.dll $(OJT)\*.exe $(OJT)\*.pdb
159 $(DEL) /q $(OJT)\*_component_version_number.* *_component_version_number.*
161 # Common lang target.
165 #################### Compile optional build flags set ###########
169 -I$(DESTDIR)\include \
170 -I$(DESTDIR)\include\afs \
171 -I$(DESTDIR)\include\rx \
172 -DWIN32_LEAN_AND_MEAN \
176 -DAFS_FREELANCE_CLIENT \
177 $(AFSDEV_AUXCDEFINES)
180 # Compiler switches (except include paths and preprocessor defines)
182 # Note: if conflicting options are specified, rightmost option applies.
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
199 cdebug = $(cdebug:-Z7=-Zi) # avoid annoying override warning (D4025)
200 !IF ("APPSVER"=="1300")
201 cdebug = $(cdebug) -Zi
204 !IF ("$(AFSDEV_BUILDTYPE)" == "FREE")
206 afscflags = $(afscflags) /Ox
207 cdebug = $(cdebug:-Od=) # avoid annoying override warning (D4025)
208 cvarsdll = $(cvarsdll:-MDd=-MD)
210 !ELSE # CHECKED BUILD
212 !IF ("$(AFSVER_CL)"=="1200")
213 afscdefs = $(afscdefs) -DDEBUG
216 !IFDEF _CRTDBG_MAP_ALLOC
217 afscflags = $(afscflags) -D_DEBUG -D_CRTDBG_MAP_ALLOC
222 # Set compiler warning level
224 !IFNDEF AFSDEV_WARNLEVEL
227 !IF ("$(AFSDEV_WARNLEVEL)" != "0" && \
228 "$(AFSDEV_WARNLEVEL)" != "1" && \
229 "$(AFSDEV_WARNLEVEL)" != "2" && \
230 "$(AFSDEV_WARNLEVEL)" != "3" && \
231 "$(AFSDEV_WARNLEVEL)" != "4")
232 !ERROR Must define AFSDEV_WARNLEVEL to be one of 0 through 4.
236 afscflags = $(afscflags) /W$(AFSDEV_WARNLEVEL)
238 # C/C++ compilation macros
239 C2OBJ = $(cc) /Fo$@ /Fd$*.pdb $(cflags) $(cdebug) $(cvarsdll) $(afscflags) $(afscdefs) /c
241 # Inference rules for building and installing targets
242 # Compile .c files, from current directory to defined by OJT
256 $(RC) /fo$(OJT)\$(<B).res $<
258 # Compile .rc (resource) files
264 .h.{$(DESTDIR)\include\afs}.h:
265 $(COPY) $< $(DESTDIR)\include\afs
267 .h.{$(DESTDIR)\include\rx}.h:
268 $(COPY) $< $(DESTDIR)\include\rx
270 .h.{$(DESTDIR)\include}.h:
271 $(COPY) $< $(DESTDIR)\include
273 .h.{$(DESTDIR)\include\WINNT}.h:
274 $(COPY) $< $(DESTDIR)\include\WINNT
276 .h.{$(DESTDIR)\include}.h:
277 $(COPY) $(*B).h $(DESTDIR)\include
279 .h.{$(DESTDIR)\include\afs}.h:
280 $(COPY) $(*B).h $(DESTDIR)\include\afs
282 .h.{$(DESTDIR)\include\rx}.h:
283 $(COPY) $(*B).h $(DESTDIR)\include\rx
285 .h.{$(DESTDIR)\include\WINNT}.h:
286 $(COPY) $(*B).h $(DESTDIR)\include\WINNT
288 # Resource compiler macro
289 RC = $(rc) $(rcvars) $(rcflags) $(AFSDEV_AUXRCFLAGS) /d "AFSPRODUCT_VERSION=\"$(AFSPRODUCT_VERSION)\""
291 #################### Link optional build flags set ###########
294 /FIXED:NO /VERBOSE:LIB
296 mfclflags = $(guilflags)
297 mfclflags = $(mfclflags:/NODEFAULTLIB=)
299 mfcdlllflags = $(dlllflags)
300 mfcdlllflags = $(mfcdlllflags:/NODEFAULTLIB=)
302 mfclibsdll = $(guilibsdll)
303 mfclibsdll = $(mfclibsdll:msvcrtd.lib=)
304 mfclibsdll = $(mfclibsdll:msvcrt.lib=)
306 # Link with binmode.obj; files will be opened in binary mode by default.
307 !IF ("$(AFSDEV_BUILDTYPE)" == "FREE")
310 EXEPREP = rebase -b 0x00400000 -x $(@D) -q $@
311 DLLPREP = rebase -i $(DESTDIR)\NTDllmap.txt -x $(@D) -q $@
315 ldebug = /NODEFAULTLIB:LIBC
317 #!IF ("AFSVER_CL"=="1200")
318 #ldebug = $(ldebug) -debugtype:cv
322 ldebug = $(ldebug) -debugtype:both
323 ldebug = $(ldebug:-debugtype:cv=)
326 !IFNDEF _CRTDBG_MAP_ALLOC
327 mfclflags = $(mfclflags) /NODEFAULTLIB:msvcrtd.lib
328 mfcdlllflags = $(mfcdlllflags) /NODEFAULTLIB:msvcrtd.lib
329 #v6.0 doesn't work using msvcrtd.lib unless _CRTDBG_MAP_ALLOC is defined, v7.0 requires it
331 !IF ("$(AFSVER_CL)"=="1200")
332 EXEMFCLINK=$(EXEMFCLINK:/NODEFAULTLIB:msvcrtd.lib=)
333 DLLMFCLINK=$(DLLMFCLINK:/NODEFAULTLIB:msvcrtd.lib=)
337 mfclflags = $(mfclflags) /NODEFAULTLIB:msvcrt.lib
338 mfcdlllflags = $(mfcdlllflags) /NODEFAULTLIB:msvcrt.lib
339 conlibsdll = $(conlibsdll:msvcrt.lib=msvcrtd.lib)
340 guilibsdll = $(guilibsdll:msvcrt.lib=msvcrtd.lib)
343 EXEPREP = rebase -b 0x00400000 -q $@
344 DLLPREP = rebase -i $(DESTDIR)\NTDllmap.txt -q $@
349 # EXE link macro for console applications
350 EXECONLINK = $(link) /OUT:$@ /PDB:$*.pdb $(ldebug) $(conlflags) $(afslflags) $(conlibsdll) Advapi32.lib user32.lib version.lib $**
352 # EXE link macro for GUI applications
353 EXEGUILINK = $(link) /OUT:$@ /PDB:$*.pdb $(ldebug) $(guilflags) $(afslflags) $(guilibsdll) $**
355 # EXE link macro for MFC applications
356 EXEMFCLINK = $(link) /OUT:$@ /PDB:$*.pdb $(ldebug) $(mfclflags) $(afslflags) $(mfclibsdll) $**
358 # DLL link macro for console applications
359 DLLCONLINK = $(link) /OUT:$@ /PDB:$*.pdb $(ldebug) $(dlllflags) $(afslflags) $(conlibsdll) $**
361 # DLL link macro for GUI applications
362 DLLGUILINK = $(link) /OUT:$@ /PDB:$*.pdb $(ldebug) $(dlllflags) $(afslflags) $(guilibsdll) $**
363 EXECONLINK = $(link) /OUT:$@ /PDB:$*.pdb $(ldebug) $(conlflags) $(afslflags) $(conlibsdll) Advapi32.lib user32.lib version.lib $**
364 DLLMFCLINK = $(link) /OUT:$@ /PDB:$*.pdb $(ldebug) $(mfcdlllflags) $(afslflags) $(mfclibsdll) $**
367 # DLL link macro for resource-only DLLs
368 DLLRESLINK = $(link) /OUT:$@ $(dlllflags:-entry:_DllMainCRTStartup@12=-noentry) $(afslflags) $**
370 # Library archive macro
371 LIBARCH = $(implib) /NOLOGO /OUT:$@ $**
373 # Language selection macro
374 NTLANG = $(DESTDIR)\bin\NTLang.bat
379 AFSDEV_AUXMIDLFLAGS=/Oi