--- mstools/h/ntwin32.mak 2018/08/09 18:21:12 1.1.1.1 +++ mstools/h/ntwin32.mak 2018/08/09 18:25:27 1.1.1.3 @@ -1,174 +1,401 @@ -# ========================================================= -# NTWIN32.MAK -# Win32 Application NMAKE Definitions -# For the Microsoft Win32 SDK for Windows NT Samples -# ========================================================= +# ========================================================================= +# NTWIN32.MAK - Win32 application master NMAKE definitions file for the +# Microsoft Win32 SDK for Windows NT programming samples +# ------------------------------------------------------------------------- +# This files should be included at the top of all MAKEFILEs as follows: +# !include +# ------------------------------------------------------------------------- +# NMAKE Options +# +# Use the table below to determine the additional options for NMAKE to +# generate various application debugging, profiling and performance tuning +# information. +# +# Application Information Type Invoke NMAKE +# ---------------------------- ------------ +# For No Debugging Info nmake nodebug=1 +# For Working Set Tuner Info nmake tune=1 +# For Call Attributed Profiling Info nmake profile=1 +# +# Note: Working Set Tuner and Call Attributed Profiling is for available +# for the Intel x86 and Pentium systems. +# +# Note: The three options above are mutually exclusive (you may use only +# one to compile/link the application). +# +# Note: creating the environment variables NODEBUG, TUNE, and PROFILE is an +# alternate method to setting these options via the nmake command line. +# +# Additional NMAKE Options Invoke NMAKE +# ---------------------------- ------------ +# For No ANSI NULL Compliance nmake no_ansi=1 +# (ANSI NULL is defined as PVOID 0) +# +# ========================================================================= -# --------------------------------------------------------- +# ------------------------------------------------------------------------- # Get CPU Type - exit if CPU environment variable is not defined -# --------------------------------------------------------- +# ------------------------------------------------------------------------- -# declarations for use on Intel 80x86 systems. +# Intel i386, i486, and Pentium systems !IF "$(CPU)" == "i386" CPUTYPE = 1 -DLLENTRY = @12 !ENDIF -# declarations for use on self hosted MIPS systems. +# MIPS R4x000 systems !IF "$(CPU)" == "MIPS" CPUTYPE = 2 -DLLENTRY = +!ENDIF + +# Digital Alpha AXP systems +!IF "$(CPU)" == "ALPHA" +CPUTYPE = 3 !ENDIF !IFNDEF CPUTYPE -!ERROR Must specify CPU Environment Variable ( CPU=i386 or CPU=MIPS ) +!ERROR Must specify CPU environment variable ( CPU=i386, CPU=MIPS, CPU=ALPHA) !ENDIF -# --------------------------------------------------------- -# Target Module Dependant Compile Declarations -# -# Below is a table which describes which flags to use -# depending on the module target: -# -# Module Number of Threads Variables to C run-time -# Target Single/Multiple Include Library -# ----------- ----------------- ------------ ---------- -# MODULE .EXE Single CVARS LIBC.LIB -# MODULE .EXE Multiple CVARSMT LIBCMT.LIB -# MODULE .DLL Single CVARSDLL CRTDLL.LIB -# MODULE .DLL Multiple CVARSMTDLL CRTDLL.LIB +# ------------------------------------------------------------------------- +# Platform Dependent Binaries Declarations # -# Legend: -# MODULE : A Win32 Graphical User Interface module or a -# Win32 Character-Mode User Interface module -# --------------------------------------------------------- +# If you are using the old MIPS compiler then define the following: +# cc = cc +# cvtobj = mip2coff +# ------------------------------------------------------------------------- -cvars = -DWIN32 -cvarsmt = $(cvars) -D_MT -cvarsdll = $(cvars) -D_DLL -cvarsmtdll = $(cvars) -D_MT -D_DLL +# binary declarations for use on Intel i386, i486, and Pentium systems +!IF "$(CPU)" == "i386" +cc = cl386 +# for compatibility with older-style makefiles +cvtobj = REM !!! CVTOBJ is no longer necessary - please remove !!! +!ENDIF -#---------------------------------------------------------- -# Subsystem Dependent Compile Declarations -# -# When compiling for the POSIX Subsystem, psxvars should be -# included. -# -#---------------------------------------------------------- +# binary declarations for use on self hosted MIPS R4x000 systems +!IF "$(CPU)" == "MIPS" +cc = mcl +# for compatibility with older-style makefiles +cvtobj = REM !!! CVTOBJ is no longer necessary - please remove !!! +!ENDIF -psxvars = -D_POSIX_ +# binary declarations for use on self hosted Digital Alpha AXP systems +!IF "$(CPU)" == "ALPHA" +cc = claxp +# for compatibility with older-style makefiles +cvtobj = REM !!! CVTOBJ is no longer necessary - please remove !!! +!ENDIF -# --------------------------------------------------------- +# binary declarations common to all platforms +link = link32 +implib = lib32 +rc = rc +cvtres = cvtres +hc = hc + +# ------------------------------------------------------------------------- # Platform Dependent Compile Flags - must be specified after $(cc) # -# Note: Debug switches are default for current release +# Note: Debug switches are on by default for current release +# +# These switches allow for source level debugging with WinDebug for local +# and global variables. # -# These switches allow for source level debugging -# with WinDebug for local and global variables. +# Both compilers now use the same front end - you must still define either +# _X86_, _MIPS_, or _ALPHA_. These have replaced the i386, MIPS, and ALPHA +# definitions which are not ANSI compliant. # -# i386 flags: +# Common compiler flags: # -c - compile without linking -# -G3 - generate 80386 instructions # -W3 - Set warning level to level 3 # -Zi - generate debugging information # -Od - disable all optimizations +# -Ox - use maximum optimizations +# -Zd - generate only public symbols and line numbers for debugging +# +# i386 specific compiler flags: +# -Gz - stdcall +# +# MS MIPS specific compiler flags: +# none. # -# MIPS flags: +# *** OLD MIPS ONLY *** +# +# The following definitions are for the old MIPS compiler: +# +# OLD MIPS compiler flags: # -c - compile without linking -# -std - produce warnings for non-ANSI standard source code. +# -std - produce warnings for non-ANSI standard source code # -g2 - produce a symbol table for debugging # -O - invoke the global optimizer # -EL - produce object modules targeted for # "little-endian" byte ordering -# --------------------------------------------------------- +# +# If you are using the old MIPS compiler then define the following: +# +# # OLD MIPS Complile Flags +# !IF 0 +# !IF "$(CPU)" == "MIPS" +# cflags = -c -std -o $(*B).obj -EL -DMIPS=1 -D_MIPS_=1 +# !IFDEF NODEBUG +# cdebug = +# !ELSE +# cdebug = -g2 +# !ENDIF +# !ENDIF +# !ENDIF +# +# ------------------------------------------------------------------------- + +# declarations common to all compiler options +ccommon = -c -W3 -# declarations for use on Intel 80x86 systems. !IF "$(CPU)" == "i386" -cdebug = -Zi -Od -cflags = -c -G3 -W3 -Di386=1 -cvtdebug = +cflags = $(ccommon) -D_X86_=1 -D_CRTAPI1=__cdecl -D_CRTAPI2=__cdecl -Dtry=__try -Dleave=__leave -Dexcept=__except -Dfinally=__finally +scall = -Gz +!ELSE +!IF "$(CPU)" == "MIPS" +cflags = $(ccommon) -D_MIPS_=1 +!ELSE +!IF "$(CPU)" == "ALPHA" +cflags = $(ccommon) -D_ALPHA_=1 +!ENDIF +!ENDIF +scall = !ENDIF -# declarations for use on self hosted MIPS systems. -!IF "$(CPU)" == "MIPS" -cdebug = -g2 -cflags = -c -std -o $(*B).obj -EL -DMIPS=1 -cvtdebug = -c +!IF "$(CPU)" == "i386" +!IFDEF NODEBUG +cdebug = -Ox +!ELSE +!IFDEF PROFILE +cdebug = -Gh -Zd -Ox +!ELSE +!IFDEF TUNE +cdebug = -Gh -Zd -Ox +!ELSE +cdebug = -Zi -Od +!ENDIF +!ENDIF +!ENDIF +!ELSE +!IFDEF NODEBUG +cdebug = -Ox +!ELSE +cdebug = -Zi -Od +!ENDIF !ENDIF -# --------------------------------------------------------- -# Target Module Dependent Link Flags - must be specified after $(link) +# ------------------------------------------------------------------------- +# Target Module & Subsystem Dependent Compile Defined Variables - must be +# specified after $(cc) +# +# The following table indicates the various acceptable combinations of +# the C Run-Time libraries LIBC, LIBCMT, and CRTDLL respect to the creation +# of a EXE and/or DLL target object. The appropriate compiler flag macros +# that should be used for each combination are also listed. +# +# Link EXE Create Exe Link DLL Create DLL +# with Using with Using +# ---------------------------------------------------- +# LIBC CVARS None None * +# LIBC CVARS LIBC CVARS +# LIBC CVARS LIBCMT CVARSMT +# LIBCMT CVARSMT None None * +# LIBCMT CVARSMT LIBC CVARS +# LIBCMT CVARSMT LIBCMT CVARSMT +# CRTDLL CVARSDLL None None * +# CRTDLL CVARSDLL LIBC CVARS +# CRTDLL CVARSDLL LIBCMT CVARSMT +# CRTDLL CVARSDLL CRTDLL CVARSDLL * +# +# * - Denotes the Recommended Configuration +# +# When building single-threaded applications you can link your executable +# with either LIBC, LIBCMT, or CRTDLL, although LIBC will provide the best +# performance. +# +# When building multi-threaded applications, either LIBCMT or CRTDLL can +# be used as the C-Runtime library, as both are multi-thread safe. +# +# Note: Any executable which accesses a DLL linked with CRTDLL.LIB must +# also link with CRTDLL.LIB instead of LIBC.LIB or LIBCMT.LIB. +# When using DLLs, it is recommended that all of the modules be +# linked with CRTDLL.LIB. +# +# Note: The macros of the form xDLL are used when linking the object with +# the DLL version of the C Run-Time (that is, CRTDLL.LIB). They are +# not used when the target object is itself a DLL. # -# Note: Debug switches are default for current release -# -# These switches allow for source level debugging -# with WinDebug for local and global variables. -# --------------------------------------------------------- +# ------------------------------------------------------------------------- -linkdebug = -debug:full -debugtype:cv -conflags = -subsystem:console -entry:mainCRTStartup -guiflags = -subsystem:windows -entry:WinMainCRTStartup -psxflags = -subsystem:posix -entry:__PosixProcessStartup +!IFDEF NO_ANSI +noansi = -DNULL=0 +!ENDIF -# --------------------------------------------------------- -# Platform Dependent Binaries Declarations +# for Windows applications that use the C Run-Time libraries +cvars = -DWIN32 $(noansi) +cvarsmt = $(cvars) -D_MT +cvarsdll = $(cvarsmt) -D_DLL + +# for compatibility with older-style makefiles +cvarsmtdll = $(cvarsmt) -D_DLL + +# for POSIX applications +psxvars = -D_POSIX_ + +# resource compiler +rcvars = -DWIN32 $(noansi) + +# ------------------------------------------------------------------------- +# Platform Dependent Link Flags - must be specified after $(link) +# +# Note: $(DLLENTRY) should be appended to each -entry: flag on the link +# line. # -# Note: Debug switches are default for current release +# Note: When creating a DLL that uses C Run-Time functions it is +# recommended to include the entry point function of the name DllMain +# in the DLL's source code. Also, the MAKEFILE should include the +# -entry:_DllMainCRTStartup$(DLLENTRY) option for the creation of +# this DLL. (The C Run-Time entry point _DllMainCRTStartup in turn +# calls the DLL defined DllMain entry point.) # -# These switches allow for source level debugging -# with WinDebug for local and global variables. -# --------------------------------------------------------- +# ------------------------------------------------------------------------- -# declarations for use on Intel 80x86 systems. +# declarations common to all linker options +lcommon = + +# declarations for use on Intel i386, i486, and Pentium systems !IF "$(CPU)" == "i386" -cc = cl386 -cvtobj = REM MIPS-only conversion: +DLLENTRY = @12 +lflags = $(lcommon) -align:0x1000 !ENDIF -# declarations for use on self hosted MIPS systems. +# declarations for use on self hosted MIPS R4x000 systems !IF "$(CPU)" == "MIPS" -cc = cc -cvtobj = mip2coff +DLLENTRY = +lflags = $(lcommon) !ENDIF -link = link +# declarations for use on self hosted Digital Alpha AXP systems +!IF "$(CPU)" == "ALPHA" +DLLENTRY = +lflags = $(lcommon) +!ENDIF -# --------------------------------------------------------- -# Target Module Dependent Link Libraries +# ------------------------------------------------------------------------- +# Target Module Dependent Link Debug Flags - must be specified after $(link) # -# Below is a table which describes which libraries to use -# depending on the module target: +# These switches allow the inclusion of the necessary symbolic information +# for source level debugging with WinDebug, profiling and/or performance +# tuning. # -# Module Number of Threads Variables to C run-time -# Target Single/Multiple Include Library -# ----------- ----------------- ------------ ---------- -# CONSOLE.EXE Single CONLIBS LIBC.LIB -# CONSOLE.EXE Multiple CONLIBSMT LIBCMT.LIB -# CONSOLE.DLL Either CONLIBSDLL CRTDLL.LIB -# WINDOWS.EXE Single GUILIBS LIBC.LIB -# WINDOWS.EXE Multiple GUILIBSMT LIBCMT.LIB -# WINDOWS.DLL Either GUILIBSDLL CRTDLL.LIB -# POSIX.EXE Single PSXLIBS LIBCPSX.LIB -# -# Legend: -# WINDOWS : A Win32 Graphical User Interface module -# CONSOLE : A Win32 Character-Mode User Interface module -# POSIX : A Posix Subsystem Character-Mode User Interface module -# --------------------------------------------------------- - -conlibs = libc.lib ntdll.lib kernel32.lib +# Note: Debug switches are on by default. +# ------------------------------------------------------------------------- -conlibsmt = libcmt.lib ntdll.lib kernel32.lib +!IF "$(CPU)" == "i386" +!IFDEF NODEBUG +ldebug = +!ELSE +!IFDEF PROFILE +ldebug = -debug:partial -debugtype:coff +!ELSE +!IFDEF TUNE +ldebug = -debug:partial -debugtype:coff +!ELSE +ldebug = -debug:full -debugtype:cv +!ENDIF +!ENDIF +!ENDIF +!ELSE +!IFDEF NODEBUG +ldebug = +!ELSE +ldebug = -debug:full -debugtype:cv +!ENDIF +!ENDIF -conlibsdll = crtdll.lib ntdll.lib kernel32.lib +# for compatibility with older-style makefiles +linkdebug = $(ldebug) -guilibs = libc.lib ntdll.lib kernel32.lib user32.lib gdi32.lib \ - winspool.lib comdlg32.lib +# ------------------------------------------------------------------------- +# Subsystem Dependent Link Flags - must be specified after $(link) +# +# These switches allow for source level debugging with WinDebug for local +# and global variables. They also provide the standard application type and +# entry point declarations. +# ------------------------------------------------------------------------- + +# for Windows applications that use the C Run-Time libraries +conlflags = $(lflags) -subsystem:console -entry:mainCRTStartup +guilflags = $(lflags) -subsystem:windows -entry:WinMainCRTStartup + +# for POSIX applications +psxlflags = $(lflags) -subsystem:posix -entry:__PosixProcessStartup + +# for compatibility with older-style makefiles +conflags = $(conlflags) +guiflags = $(guilflags) +psxflags = $(psxlflags) + +# ------------------------------------------------------------------------- +# C Run-Time Target Module Dependent Link Libraries +# +# Below is a table which describes which libraries to use depending on the +# target module type, although the table specifically refers to Graphical +# User Interface apps, the exact same dependencies apply to Console apps. +# That is, you could replace all occurrences of 'GUI' with 'CON' in the +# following: +# +# Desired CRT Libraries Desired CRT Libraries +# Library to link Library to link +# for EXE with EXE for DLL with DLL +# ---------------------------------------------------- +# LIBC GUILIBS None None * +# LIBC GUILIBS LIBC GUILIBS +# LIBC GUILIBS LIBCMT GUILIBSMT +# LIBCMT GUILIBSMT None None * +# LIBCMT GUILIBSMT LIBC GUILIBS +# LIBCMT GUILIBSMT LIBCMT GUILIBSMT +# CRTDLL GUILIBSDLL None None * +# CRTDLL GUILIBSDLL LIBC GUILIBS +# CRTDLL GUILIBSDLL LIBCMT GUILIBSMT +# CRTDLL GUILIBSDLL CRTDLL GUILIBSDLL * +# +# * - Recommended Configurations. +# +# Note: Any executable which accesses a DLL linked with CRTDLL.LIB must +# also link with CRTDLL.LIB instead of LIBC.LIB or LIBCMT.LIB. +# +# Note: For POSIX applications, link with $(psxlibs). +# +# ------------------------------------------------------------------------- -guilibsmt = libcmt.lib ntdll.lib kernel32.lib user32.lib gdi32.lib \ - winspool.lib comdlg32.lib +# optional profiling and tuning libraries +!IF "$(CPU)" == "i386" +!IFDEF PROFILE +optlibs = cap.lib +!ELSE +!IFDEF TUNE +optlibs = wst.lib +!ELSE +optlibs = +!ENDIF +!ENDIF +!ELSE +optlibs = +!ENDIF -guilibsdll = crtdll.lib ntdll.lib kernel32.lib user32.lib gdi32.lib \ - winspool.lib comdlg32.lib +# basic subsystem specific libraries, less the C Run-Time +baselibs = kernel32.lib $(optlibs) +winlibs = $(baselibs) user32.lib gdi32.lib comdlg32.lib winspool.lib + +# for Windows applications that use the C Run-Time libraries +conlibs = libc.lib $(baselibs) +conlibsmt = libcmt.lib $(baselibs) +conlibsdll = crtdll.lib $(baselibs) +guilibs = libc.lib $(winlibs) +guilibsmt = libcmt.lib $(winlibs) +guilibsdll = crtdll.lib $(winlibs) -psxlibs = libcpsx.lib ntdll.lib kernel32.lib psxdll.lib psxrtl.lib +# for POSIX applications +psxlibs = libcpsx.lib psxdll.lib psxrtl.lib