disable-optimizations-20031209
[openafs.git] / src / config / NTMakefile.i386_nt40
index d5e3428..ce9e91b 100644 (file)
@@ -9,49 +9,48 @@
 #
 # Required definitions:
 #     AFSDEV_BUILDTYPE = [ CHECKED | FREE ]
-#     AFSDEV_INCLUDE = <default include directories>
-#     AFSDEV_LIB = <default library directories>
-#     AFSDEV_BIN = <default build binary directories>
 #
 # Optional definitions:
-#     AFSDEV_DESTDIR = <top-level install directory>  (default is $(AFSROOT)\DEST)
 #     AFSDEV_WARNLEVEL = [0 | 1 | 2 | 3 | 4]  (default is 3)
 #     AFSDEV_AUXCDEFINES = <auxiliary C preprocessor defs> (default is null)
 #     AFSDEV_AUXRCFLAGS = <auxiliary resource compiler flags> (default is null)
+#     AFSDEV_AUXMIDLFLAGS = auxiliary midl flags
 #     AFSDEV_TEXTMODE = <text mode is default if defined>  (default is null)
-#     AFSDEV_CRTDEBUG = <utilize debug C runtime if define> (default is null)
+#     DEBUG_VERBOSE = optional debug statements for testing
+#        AFS_OBJDIR - Location of object directory, either absolute or relative
+#     AFSROOT - ROOT Directory so that $(AFSROOT)\scr is location of source
 #
 ############################################################################
+#              Optional compliation flags
+#              NO_CRTDBG - used to disable some builds for CFTDBG allocate mapping
+#      _CRTDBG_MAP_ALLOC = <utilize crt debug C runtime if define> (default is null)
+#              VADUMP - define VADUMP=1 if you are going to use the vadump utility and you are using V6.0
+#
+####### Special optional defines
 
+!IFNDEF NO_CRTDBG              #don't set _CRTDBG_MAP_ALLOC flag for some module compliations
+#_CRTDBG_MAP_ALLOC=1
+!ENDIF
 
-# Definitions provided here are based on WIN32.MAK, a common nmake
-# file included with the MS SDK and MS VC distributions.
-# WIN32.MAK, and this nmake file, are targeted to the MSVC compiler;
-# port this nmake file if additional compiler support is required.
+#######
 
-# Define default target-type macros required by WIN32.MAK.
-# Allow them to be overriden in an NTMakefile or via an environment variable.
+#sanity checks 
 
-!IFNDEF APPVER
-APPVER = 4.0
+!IF EXISTS("TOOLS.INI")
+!MESSAGE ************CAUTION TOOLS.INI IN EFFECT**********
 !ENDIF
-
-!IFNDEF TARGETOS
-TARGETOS = WINNT
+!IF ("$(AFSROOT)"=="")
+!ERROR AFSROOT is not set
 !ENDIF
-
-# Check that build type is correctly specified.
-
 !IF (DEFINED(PROFILE) || DEFINED(TUNE))
-#    Build type ignored when profiling or tuning.
 AFSDEV_BUILDTYPE = NONE
-
 !ELSE
-#    Build type must be checked or free.
 !IF ("$(AFSDEV_BUILDTYPE)" != "CHECKED" && "$(AFSDEV_BUILDTYPE)" != "FREE")
 !ERROR Must define AFSDEV_BUILDTYPE to be CHECKED or FREE.
 !ENDIF
-
+!ENDIF
+!IF ("$(AFSDEV_BUILDTYPE)" == "FREE")
+!UNDEF _CRTDBG_MAP_ALLOC
 !ENDIF
 
 # Limit default include and library directories to those specified for build.
@@ -77,44 +76,109 @@ INCLUDE = $(AFSDEV_INCLUDE)
 !ENDIF
 LIB = $(AFSDEV_LIB)
 
+#define used in WinNT/2000 installation and program version display
+AFSPRODUCT_VER_MAJOR=1
+AFSPRODUCT_VER_MINOR=3
+AFSPRODUCT_VER_PATCH=5100
+AFSPRODUCT_VER_BUILD=0
+AFSPRODUCT_VERSION=$(AFSPRODUCT_VER_MAJOR).$(AFSPRODUCT_VER_MINOR).$(AFSPRODUCT_VER_PATCH)
+AFSPRODUCT_FILE_VERSION=$(AFSPRODUCT_VER_MAJOR),$(AFSPRODUCT_VER_MINOR),$(AFSPRODUCT_VER_PATCH),$(AFSPRODUCT_VER_BUILD)
+CELLNAME_DEFAULT=Your Cell Name
+CELLSERVDB_INSTALL=CellServDB.GrandCentral
+CELLSERVDB_WEB=http://grand.central.org/dl/cellservdb/CellServDB
+TARGETOS = WINNT
 
-# Put default build binary directories at front of path.
-
-!IFNDEF AFSDEV_BIN
-!ERROR Must define AFSDEV_BIN to be the default build binary directories.
-!ENDIF
-
-!IF ((!DEFINED(PATH)) && ([set PATH=$(AFSDEV_BIN)] != 0))
-#    If env. var. PATH not defined then macro assignment won't set it.
-!ERROR Failed setting environment variable PATH.
+#              Define defaults folder locations
+DEST=dest
+SRC=src
+OBJ=obj
+
+!IF ("$(AFS_OBJDIR)"=="") 
+#########  AFS_OBJDIR is NOT used use default locations
+!  IF ("$(AFSDEV_BUILDTYPE)" == "CHECKED")
+DESTDIR=$(AFSROOT)\$(DEST)\checked
+OJT=$(AFSROOT)\$(OBJ)\checked
+!  ELSE
+DESTDIR=$(AFSROOT)\$(DEST)\free
+OJT=$(AFSROOT)\$(OBJ)\free
+!  ENDIF
+UTIL_CR = $(DESTDIR)\bin\util_cr.exe
+!ELSE
+#########  AFS_OBJDIR is defined, use specific locations for obj and dest
+# there is a special case for config because util_cr is not defined yet!
+!  IF (EXIST($(AFSROOT)\$(AFS_OBJDIR)))
+#  AFS_OBJDIR is relative path
+!    IF ("$(AFSDEV_BUILDTYPE)" == "CHECKED")
+DESTDIR=$(AFSROOT)\$(AFS_OBJDIR)\$(DEST)\checked
+OJT=$(AFSROOT)\$(AFS_OBJDIR)\checked\config
+!    ELSE
+OJT=$(AFSROOT)\$(AFS_OBJDIR)\free\config
+DESTDIR=$(AFSROOT)\$(AFS_OBJDIR)\$(DEST)\free
+!    ENDIF
+!  ELSE
+!    IF (EXIST($(AFS_OBJDIR)))
+#   AFS_OBJDIR is full path
+!    IF ("$(AFSDEV_BUILDTYPE)" == "CHECKED")
+DESTDIR=$(AFS_OBJDIR)\$(DEST)\checked
+OJT=$(AFS_OBJDIR)\checked\config
+!      ELSE
+DESTDIR=$(AFS_OBJDIR)\$(DEST)\free
+OJT=$(AFS_OBJDIR)\free\config
+!      ENDIF
+!    ELSE
+!ERROR Can't find location of DEST directory!
+!    ENDIF
+!  ENDIF
+UTIL_CR = $(DESTDIR)\bin\util_cr.exe
+
+!  IF ("$(MAKEDIR:\config=)"=="$(MAKEDIR)") 
+#    we are NOT doing a config make, use util_cr to generate object directory
+!    IF ( !EXIST($(UTIL_CR)) || (!EXIST($(TMP)\home) && !EXIST($(TEMP)\home)) || (([$(UTIL_CR) _dir "!$(AFSDEV_BUILDTYPE)!src!$(AFS_OBJDIR)!"])!=0))
+!ERROR Can't produce object paths, util_cr not working , TMP or TEMP environment variables not defined
+!    ENDIF
+
+!    IF EXIST($(TMP)\home)
+!INCLUDE $(TMP)\home
+!    ELSE
+!INCLUDE $(TEMP)\home
+!    ENDIF
+!  ENDIF
+!ENDIF #AFS_OBJDIR
+
+!IF ("$(RELDIR)"=="")
+OUT=$(OJT)
+!ELSE
+OUT=$(OJT)\$(RELDIR)
 !ENDIF
-PATH = $(AFSDEV_BIN);$(PATH)
 
+!MESSAGE Directory assignments: 
+!MESSAGE     OJT=[$(OJT)]
+!MESSAGE     OUT=[$(OUT)] 
+!MESSAGE DESTDIR=[$(DESTDIR)]
 
-# Undefine WIN32.MAK NODEBUG macro.
-# Always generate full debug info, unless profiling or tuning (see below).
+# Definitions provided here are based on WIN32.MAK, a common nmake
+# file included with the MS SDK and MS VC distributions.
+# WIN32.MAK, and this nmake file, are targeted to the MSVC compiler;
+# port this nmake file if additional compiler support is required.
 
-!UNDEF NODEBUG
+# !IF ("$(AFSVER_CL)"=="1300")
+# afslflags = $(afslflags) /DEBUG
+# !ENDIF
 
-# Include WIN32.MAK nmake file
+!IF ("$(APPVER)" == "")
+APPVER=4.0
+!ENDIF
 
-!INCLUDE <WIN32.MAK>
 
 
+!INCLUDE <WIN32.MAK>
 
 # Extend and/or supplement definitions in WIN32.MAK.
 
-# Standard install directory.
-!IFDEF AFSDEV_DESTDIR
-DESTDIR = $(AFSDEV_DESTDIR)
-!ELSE
-DESTDIR = $(AFSROOT)\DEST
-!ENDIF
-
 # Command macros.
-COPY = copy
+COPY = -copy
 DEL = -del
-MKDIR = mkdir
+MKDIR = -mkdir
 REN = ren
 ECHO = echo
 CD = cd
@@ -126,17 +190,15 @@ RXGEN = $(DESTDIR)\bin\rxgen
 MIDL  = midl
 
 # Common clean target.
-# Double colon (::) syntax allows supplemental clean target to be specified.
 clean::
-       $(DEL) /q *.obj *.lib *.dll *.exe
-       $(DEL) /q *_component_version_number.*
+       $(DEL) /q $(OUT)\*.obj $(OUT)\*.lib $(OUT)\*.dll $(OUT)\*.exe $(OUT)\*.pdb
+       $(DEL) /q $(OUT)\*_component_version_number.* *_component_version_number.*
 
 # Common lang target.
-# Double colon (::) syntax allows supplemental lang target to be specified.
 lang::
 
 
-# Compiler include paths and preprocessor defines
+#################### Compile optional build flags set ###########
 
 afscdefs =\
        -I. \
@@ -145,9 +207,13 @@ afscdefs =\
        -I$(DESTDIR)\include\rx \
        -DWIN32_LEAN_AND_MEAN \
        -DSTRICT \
-       -D_WIN32_IE=0x0400
-
-afscdefs = $(afscdefs) $(AFSDEV_AUXCDEFINES)
+       -D_WIN32_IE=0x0400 \
+       -D_WIN32_WINNT=0x0400 \
+       -DAFS_AFSDB_ENV \
+       -DAFS_FREELANCE_CLIENT \
+       -DAFS_64BIT_ENV \
+       -DAFS_64BIT_CLIENT \
+        $(AFSDEV_AUXCDEFINES)
 
 
 # Compiler switches (except include paths and preprocessor defines)
@@ -169,18 +235,25 @@ afscflags =\
        /GX \
        /Os
 
-# Set optimization and debugging level based on build type.
-
 !IF ("$(AFSDEV_BUILDTYPE)" == "FREE")
-#    Apply full optimization; generate full debug info in obj.
-afscflags = $(afscflags) /Ox /Z7
-ldebug = $(ldebug) -debugtype:both
-cdebug = $(cdebug:-Od=)  # avoid annoying override warning (D4025)
 
-!ELSEIF ("$(AFSDEV_BUILDTYPE)" == "CHECKED")
-#    Disable optimization; generate full debug info in obj.
-afscflags = $(afscflags) /Od /Z7
-ldebug = $(ldebug) -debugtype:both
+#afscflags = $(afscflags) /Ox
+cdebug = $(cdebug:-Od=) # avoid annoying override warning (D4025)
+cvarsdll = $(cvarsdll:-MDd=-MD)
+NODEBUG=1
+
+!ELSE          # CHECKED BUILD
+cdebug = $(cdebug:-Z7=-Zi)  # avoid annoying override warning (D4025)
+
+!IF ("$(AFSVER_CL)"=="1200")
+afscdefs = $(afscdefs) -DDEBUG
+!ENDIF
+
+!IFDEF _CRTDBG_MAP_ALLOC
+afscflags = $(afscflags) -D_DEBUG -D_CRTDBG_MAP_ALLOC
+!ENDIF
+
+!UNDEF NODEBUG
 !ENDIF
 
 # Set compiler warning level
@@ -199,41 +272,63 @@ AFSDEV_WARNLEVEL = 3
 
 afscflags = $(afscflags) /W$(AFSDEV_WARNLEVEL)
 
+# C/C++ compilation macros
+C2OBJ   = $(cc) /Fo$@ /Fd$*.pdb $(cflags) $(cdebug) $(cvarsdll) $(afscflags) $(afscdefs) /c  
+CPP2OBJ = $(C2OBJ)
+# Inference rules for building and installing targets
+# Compile .c files, from current directory to defined by OUT
 
-# Linker switches
-#
-# /FIXED:NO   generates a relocation section in the executable
+.SUFFIXES: .c .rc 
 
-afslflags =\
-       /FIXED:NO
+.c{$(OUT)\}.obj:
+       $(C2OBJ) $<
+   
+.c.obj:
+   $(C2OBJ) $<
 
+.cpp{$(OUT)\}.obj:
+       $(CPP2OBJ) $<
 
+.rc{$(OUT)\}.res:
+       $(RC) /fo$(OUT)\$(<B).res $<
 
-# For checked builds, define DEBUG (but not the MS control flag _DEBUG).
+# Compile .rc (resource) files
+#.rc.res:
+#      $(RC) $*.rc
 
-!IF ("$(AFSDEV_BUILDTYPE)" == "CHECKED")
-afscdefs = $(afscdefs) -DDEBUG
-!ENDIF
+.SUFFIXES: .h
 
-# Utilize the debug version of the MSVC runtime, if requested.
+.h.{$(DESTDIR)\include\afs}.h:
+       $(COPY) $< $(DESTDIR)\include\afs
 
-!IFDEF AFSDEV_CRTDEBUG
-afscdefs = $(afscdefs) -D_DEBUG
-conlibsdll = $(conlibsdll:msvcrt.lib=msvcrtd.lib)
-guilibsdll = $(guilibsdll:msvcrt.lib=msvcrtd.lib)
-!ENDIF
+.h.{$(DESTDIR)\include\rx}.h:
+       $(COPY) $< $(DESTDIR)\include\rx
 
-# Link with binmode.obj; files will be opened in binary mode by default.
+.h.{$(DESTDIR)\include}.h:
+       $(COPY) $< $(DESTDIR)\include
 
-!IFNDEF AFSDEV_TEXTMODE
-conlibsdll = $(conlibsdll) binmode.obj
-guilibsdll = $(guilibsdll) binmode.obj
-!ENDIF
+.h.{$(DESTDIR)\include\WINNT}.h:
+       $(COPY) $< $(DESTDIR)\include\WINNT
 
+.h.{$(DESTDIR)\include}.h:
+       $(COPY) $(*B).h $(DESTDIR)\include
 
-# Define MFC link and library macros
-#     Note that MFC seems to make extensive use of default libraries,
-#     thus we do not specify a general /NODEFAULTLIB.
+.h.{$(DESTDIR)\include\afs}.h:
+       $(COPY) $(*B).h $(DESTDIR)\include\afs
+
+.h.{$(DESTDIR)\include\rx}.h:
+       $(COPY) $(*B).h $(DESTDIR)\include\rx
+
+.h.{$(DESTDIR)\include\WINNT}.h:
+       $(COPY) $(*B).h $(DESTDIR)\include\WINNT
+
+# Resource compiler macro
+RC = $(rc) $(rcvars) $(rcflags) $(AFSDEV_AUXRCFLAGS) /d "AFSPRODUCT_VERSION=\"$(AFSPRODUCT_VERSION)\""
+
+#################### Link optional build flags set ###########
+
+afslflags =\
+       /FIXED:NO /VERBOSE:LIB
 
 mfclflags = $(guilflags)
 mfclflags = $(mfclflags:/NODEFAULTLIB=)
@@ -245,19 +340,57 @@ mfclibsdll = $(guilibsdll)
 mfclibsdll = $(mfclibsdll:msvcrtd.lib=)
 mfclibsdll = $(mfclibsdll:msvcrt.lib=)
 
-!IFNDEF AFSDEV_CRTDEBUG
+# Link with binmode.obj; files will be opened in binary mode by default.
+!IF ("$(AFSDEV_BUILDTYPE)" == "FREE")
+
+ldebug=
+EXEPREP = rebase -b 0x00400000 -x $(@D) -q $@
+DLLPREP = rebase -i $(DESTDIR)\NTDllmap.txt -x $(@D) -q $@
+
+!ELSE  #CHECKED BUILD
+
+# Generate debug information and pdb files 
+ldebug = /DEBUG /PDB:$*.pdb /NODEFAULTLIB:LIBC 
+
+#!IF ("AFSVER_CL"=="1200")
+#ldebug = $(ldebug) -debugtype:cv 
+#!ENDIF
+
+# Disable optimization; generate full debug info in obj.
+afscflags = $(afscflags) /Od /Zi
+
+!IFDEF VADUMP
+!IF ("AFSVER_CL"=="1200")
+ldebug = $(ldebug) -debugtype:both
+ldebug = $(ldebug:-debugtype:cv=)
+!ENDIF #AFSVER_CL == 1200
+!ENDIF #VADUMPT
+
+!IFNDEF _CRTDBG_MAP_ALLOC
 mfclflags = $(mfclflags) /NODEFAULTLIB:msvcrtd.lib
 mfcdlllflags = $(mfcdlllflags) /NODEFAULTLIB:msvcrtd.lib
-!ELSE
-mfclflags = $(mfclflags) /NODEFAULTLIB:msvcrt.lib
-mfcdlllflags = $(mfcdlllflags) /NODEFAULTLIB:msvcrt.lib
-!ENDIF
 
+#v6.0 doesn't work using msvcrtd.lib unless _CRTDBG_MAP_ALLOC is defined, v7.0 requires it
+!IF ("$(AFSVER_CL)"=="1200")
+EXEMFCLINK=$(EXEMFCLINK:/NODEFAULTLIB:msvcrtd.lib=)
+DLLMFCLINK=$(DLLMFCLINK:/NODEFAULTLIB:msvcrtd.lib=)
+!ENDIF #AFSVER_CL == 1200
+
+!ELSE #_CRTDBG_MAP_ALLOC
+mfclflags = $(mfclflags) /NODEFAULTLIB:msvcrtd.lib
+mfcdlllflags = $(mfcdlllflags) /NODEFAULTLIB:msvcrtd.lib
+conlibsdll = $(conlibsdll:msvcrt.lib=msvcrtd.lib)
+guilibsdll = $(guilibsdll:msvcrt.lib=msvcrtd.lib)
+!ENDIF #_CRTDBG_MAP_ALLOC
+
+EXEPREP = rebase -b 0x00400000 -q $@
+DLLPREP = rebase -i $(DESTDIR)\NTDllmap.txt -q $@
+
+!ENDIF #CHECKED BUILD
 
-# Macros for creating/modifying binary targets
 
 # EXE link macro for console applications
-EXECONLINK = $(link) /OUT:$@ $(ldebug) $(conlflags) $(afslflags) $(conlibsdll) $**
+EXECONLINK = $(link) /OUT:$@ $(ldebug) $(conlflags) $(afslflags) $(conlibsdll) Advapi32.lib user32.lib  version.lib $**
 
 # EXE link macro for GUI applications
 EXEGUILINK = $(link) /OUT:$@ $(ldebug) $(guilflags) $(afslflags) $(guilibsdll) $**
@@ -269,9 +402,8 @@ EXEMFCLINK = $(link) /OUT:$@ $(ldebug) $(mfclflags) $(afslflags) $(mfclibsdll) $
 DLLCONLINK = $(link) /OUT:$@ $(ldebug) $(dlllflags) $(afslflags) $(conlibsdll) $**
 
 # DLL link macro for GUI applications
-DLLGUILINK = $(link) /OUT:$@ $(ldebug) $(dlllflags) $(afslflags) $(guilibsdll) $**
-
-# DLL link macro for MFC applications
+DLLGUILINK = $(link) /OUT:$@ $(ldebug) $(dlllflags) $(afslflags) $(guilibsdll)  $**
+EXECONLINK = $(link) /OUT:$@ $(ldebug) $(conlflags) $(afslflags) $(conlibsdll) Advapi32.lib user32.lib version.lib $**
 DLLMFCLINK = $(link) /OUT:$@ $(ldebug) $(mfcdlllflags) $(afslflags) $(mfclibsdll) $**
 
 # DLL link macro for resource-only DLLs
@@ -283,53 +415,13 @@ LIBARCH = $(implib) /NOLOGO /OUT:$@ $**
 # Language selection macro
 NTLANG = $(DESTDIR)\bin\NTLang.bat
 
+######### MIDL FLAGS
 
-# EXE\DLL preparation macros
-#     Rebase to avoid conflicts; strip symbols in free build.
-!IF ("$(AFSDEV_BUILDTYPE)" == "FREE")
-EXEPREP = rebase -b 0x00400000 -x $(@D) -q $@
-DLLPREP = rebase -i $(DESTDIR)\NTDllmap.txt -x $(@D) -q $@
-!ELSEIF ("$(AFSDEV_BUILDTYPE)" == "CHECKED")
-EXEPREP = rebase -b 0x00400000 -q $@
-DLLPREP = rebase -i $(DESTDIR)\NTDllmap.txt -q $@
+!IFDEF OSISXP
+AFSDEV_AUXMIDLFLAGS=/Oi
 !ENDIF
 
-# C/C++ compilation macros
-C2OBJ = $(cc) $(cflags) $(cdebug) $(cvarsdll) $(afscflags) $(afscdefs) /c
-CPP2OBJ = $(cc) $(cflags) $(cdebug) $(cvarsdll) $(afscflags) $(afscdefs) /c
-
-# Resource compiler macro
-RC = $(rc) $(rcvars) $(rcflags) $(AFSDEV_AUXRCFLAGS)
-
 # Lex/Yacc macros
 LEX = flex -l
 YACC = bison
 
-# Inference rules for building and installing targets
-
-# Compile .c files
-.c.obj:
-       $(C2OBJ) $*.c
-
-# Compile .cpp files
-.cpp.obj:
-       $(CPP2OBJ) $*.cpp
-
-# Compile .rc (resource) files
-.rc.res:
-       $(RC) $*.rc
-
-# Install header files
-.SUFFIXES: .h
-
-.h.{$(DESTDIR)\include}.h:
-       $(COPY) $(*B).h $(DESTDIR)\include
-
-.h.{$(DESTDIR)\include\afs}.h:
-       $(COPY) $(*B).h $(DESTDIR)\include\afs
-
-.h.{$(DESTDIR)\include\rx}.h:
-       $(COPY) $(*B).h $(DESTDIR)\include\rx
-
-.h.{$(DESTDIR)\include\WINNT}.h:
-       $(COPY) $(*B).h $(DESTDIR)\include\WINNT