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)\$(DEST)\checked
73 OJT=$(AFSROOT)\$(OBJ)\checked
75 DESTDIR=$(AFSROOT)\$(DEST)\free
76 OJT=$(AFSROOT)\$(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 !IF ("$(RELDIR)"=="")
127 !MESSAGE Directory assignments:
128 !MESSAGE OJT=[$(OJT)]
129 !MESSAGE OUT=[$(OUT)]
130 !MESSAGE DESTDIR=[$(DESTDIR)]
132 # Definitions provided here are based on WIN32.MAK, a common nmake
133 # file included with the MS SDK and MS VC distributions.
134 # WIN32.MAK, and this nmake file, are targeted to the MSVC compiler;
135 # port this nmake file if additional compiler support is required.
137 !IF ("$(AFSVER_CL)"=="1300")
138 afslflags = $(afslflags) /DEBUG
141 !IF ("$(APPVER)" == "")
149 # Extend and/or supplement definitions in WIN32.MAK.
161 COMPILE_ET = $(DESTDIR)\bin\compile_et
162 RXGEN = $(DESTDIR)\bin\rxgen
165 # Common clean target.
167 $(DEL) /q $(OUT)\*.obj $(OUT)\*.lib $(OUT)\*.dll $(OUT)\*.exe $(OUT)\*.pdb
168 $(DEL) /q $(OUT)\*_component_version_number.* *_component_version_number.*
170 # Common lang target.
174 #################### Compile optional build flags set ###########
178 -I$(DESTDIR)\include \
179 -I$(DESTDIR)\include\afs \
180 -I$(DESTDIR)\include\rx \
181 -DWIN32_LEAN_AND_MEAN \
184 -D_WIN32_WINNT=0x0400 \
186 -DAFS_FREELANCE_CLIENT \
188 $(AFSDEV_AUXCDEFINES)
191 # Compiler switches (except include paths and preprocessor defines)
193 # Note: if conflicting options are specified, rightmost option applies.
195 # /Oy- specifies no frame-pointer omission
196 # /GF pool strings and place in read-only memory
197 # /Gd use cdecl calling convention by default
198 # /Gy enable function-level linking
199 # /GX enable C++ exceptions (assumes extern C funcs never throw exceptions)
200 # /Os favor small (over fast) code; seems to avoid 64-bit bugs in VC compiler
210 cdebug = $(cdebug:-Z7=-Zi) # avoid annoying override warning (D4025)
211 !IF ("APPSVER"=="1300")
212 cdebug = $(cdebug) -Zi
215 !IF ("$(AFSDEV_BUILDTYPE)" == "FREE")
217 afscflags = $(afscflags) /Ox
218 cdebug = $(cdebug:-Od=) # avoid annoying override warning (D4025)
219 cvarsdll = $(cvarsdll:-MDd=-MD)
222 !ELSE # CHECKED BUILD
224 !IF ("$(AFSVER_CL)"=="1200")
225 afscdefs = $(afscdefs) -DDEBUG
228 !IFDEF _CRTDBG_MAP_ALLOC
229 afscflags = $(afscflags) -D_DEBUG -D_CRTDBG_MAP_ALLOC
235 # Set compiler warning level
237 !IFNDEF AFSDEV_WARNLEVEL
240 !IF ("$(AFSDEV_WARNLEVEL)" != "0" && \
241 "$(AFSDEV_WARNLEVEL)" != "1" && \
242 "$(AFSDEV_WARNLEVEL)" != "2" && \
243 "$(AFSDEV_WARNLEVEL)" != "3" && \
244 "$(AFSDEV_WARNLEVEL)" != "4")
245 !ERROR Must define AFSDEV_WARNLEVEL to be one of 0 through 4.
249 afscflags = $(afscflags) /W$(AFSDEV_WARNLEVEL)
251 # C/C++ compilation macros
252 C2OBJ = $(cc) /Fo$@ /Fd$*.pdb $(cflags) $(cdebug) $(cvarsdll) $(afscflags) $(afscdefs) /c
254 # Inference rules for building and installing targets
255 # Compile .c files, from current directory to defined by OUT
269 $(RC) /fo$(OUT)\$(<B).res $<
271 # Compile .rc (resource) files
277 .h.{$(DESTDIR)\include\afs}.h:
278 $(COPY) $< $(DESTDIR)\include\afs
280 .h.{$(DESTDIR)\include\rx}.h:
281 $(COPY) $< $(DESTDIR)\include\rx
283 .h.{$(DESTDIR)\include}.h:
284 $(COPY) $< $(DESTDIR)\include
286 .h.{$(DESTDIR)\include\WINNT}.h:
287 $(COPY) $< $(DESTDIR)\include\WINNT
289 .h.{$(DESTDIR)\include}.h:
290 $(COPY) $(*B).h $(DESTDIR)\include
292 .h.{$(DESTDIR)\include\afs}.h:
293 $(COPY) $(*B).h $(DESTDIR)\include\afs
295 .h.{$(DESTDIR)\include\rx}.h:
296 $(COPY) $(*B).h $(DESTDIR)\include\rx
298 .h.{$(DESTDIR)\include\WINNT}.h:
299 $(COPY) $(*B).h $(DESTDIR)\include\WINNT
301 # Resource compiler macro
302 RC = $(rc) $(rcvars) $(rcflags) $(AFSDEV_AUXRCFLAGS) /d "AFSPRODUCT_VERSION=\"$(AFSPRODUCT_VERSION)\""
304 #################### Link optional build flags set ###########
307 /FIXED:NO /VERBOSE:LIB
309 mfclflags = $(guilflags)
310 mfclflags = $(mfclflags:/NODEFAULTLIB=)
312 mfcdlllflags = $(dlllflags)
313 mfcdlllflags = $(mfcdlllflags:/NODEFAULTLIB=)
315 mfclibsdll = $(guilibsdll)
316 mfclibsdll = $(mfclibsdll:msvcrtd.lib=)
317 mfclibsdll = $(mfclibsdll:msvcrt.lib=)
319 # Link with binmode.obj; files will be opened in binary mode by default.
320 !IF ("$(AFSDEV_BUILDTYPE)" == "FREE")
323 EXEPREP = rebase -b 0x00400000 -x $(@D) -q $@
324 DLLPREP = rebase -i $(DESTDIR)\NTDllmap.txt -x $(@D) -q $@
328 ldebug = /NODEFAULTLIB:LIBC
330 #!IF ("AFSVER_CL"=="1200")
331 #ldebug = $(ldebug) -debugtype:cv
334 # Disable optimization; generate full debug info in obj.
335 afscflags = $(afscflags) /Od /Zi
338 !IF ("AFSVER_CL"=="1200")
339 ldebug = $(ldebug) -debugtype:both
340 ldebug = $(ldebug:-debugtype:cv=)
344 !IFNDEF _CRTDBG_MAP_ALLOC
345 mfclflags = $(mfclflags) /NODEFAULTLIB:msvcrtd.lib
346 mfcdlllflags = $(mfcdlllflags) /NODEFAULTLIB:msvcrtd.lib
348 #v6.0 doesn't work using msvcrtd.lib unless _CRTDBG_MAP_ALLOC is defined, v7.0 requires it
349 !IF ("$(AFSVER_CL)"=="1200")
350 EXEMFCLINK=$(EXEMFCLINK:/NODEFAULTLIB:msvcrtd.lib=)
351 DLLMFCLINK=$(DLLMFCLINK:/NODEFAULTLIB:msvcrtd.lib=)
355 mfclflags = $(mfclflags) /NODEFAULTLIB:msvcrt.lib
356 mfcdlllflags = $(mfcdlllflags) /NODEFAULTLIB:msvcrt.lib
357 conlibsdll = $(conlibsdll:msvcrt.lib=msvcrtd.lib)
358 guilibsdll = $(guilibsdll:msvcrt.lib=msvcrtd.lib)
361 EXEPREP = rebase -b 0x00400000 -q $@
362 DLLPREP = rebase -i $(DESTDIR)\NTDllmap.txt -q $@
367 # EXE link macro for console applications
368 EXECONLINK = $(link) /OUT:$@ /PDB:$*.pdb $(ldebug) $(conlflags) $(afslflags) $(conlibsdll) Advapi32.lib user32.lib version.lib $**
370 # EXE link macro for GUI applications
371 EXEGUILINK = $(link) /OUT:$@ /PDB:$*.pdb $(ldebug) $(guilflags) $(afslflags) $(guilibsdll) $**
373 # EXE link macro for MFC applications
374 EXEMFCLINK = $(link) /OUT:$@ /PDB:$*.pdb $(ldebug) $(mfclflags) $(afslflags) $(mfclibsdll) $**
376 # DLL link macro for console applications
377 DLLCONLINK = $(link) /OUT:$@ /PDB:$*.pdb $(ldebug) $(dlllflags) $(afslflags) $(conlibsdll) $**
379 # DLL link macro for GUI applications
380 DLLGUILINK = $(link) /OUT:$@ /PDB:$*.pdb $(ldebug) $(dlllflags) $(afslflags) $(guilibsdll) $**
381 EXECONLINK = $(link) /OUT:$@ /PDB:$*.pdb $(ldebug) $(conlflags) $(afslflags) $(conlibsdll) Advapi32.lib user32.lib version.lib $**
382 DLLMFCLINK = $(link) /OUT:$@ /PDB:$*.pdb $(ldebug) $(mfcdlllflags) $(afslflags) $(mfclibsdll) $**
385 # DLL link macro for resource-only DLLs
386 DLLRESLINK = $(link) /OUT:$@ $(dlllflags:-entry:_DllMainCRTStartup@12=-noentry) $(afslflags) $**
388 # Library archive macro
389 LIBARCH = $(implib) /NOLOGO /OUT:$@ $**
391 # Language selection macro
392 NTLANG = $(DESTDIR)\bin\NTLang.bat
397 AFSDEV_AUXMIDLFLAGS=/Oi