--- mstools/mfc/src/makefile 2018/08/09 18:21:01 1.1.1.1 +++ mstools/mfc/src/makefile 2018/08/09 18:27:54 1.1.1.4 @@ -1,25 +1,32 @@ -# Makefile : Builds a Foundation class library variant. +# Makefile : Builds a Microsoft Foundation Class library variant. +# +# This is a part of the Microsoft Foundation Classes C++ library. +# Copyright (C) 1992,93 Microsoft Corporation +# All rights reserved. +# +# This source code is only intended as a supplement to the +# Microsoft Foundation Classes Reference and Microsoft +# WinHelp documentation provided with the library. +# See these sources for detailed information regarding the +# Microsoft Foundation Classes product. # # Usage: NMAKE CLEAN (removes all intermediary files) # or: NMAKE options (builds one library variant (see below)) # Note that an NMAKE CLEAN should be performed before building a new variant. # # 'Options' are one of each of: -# "MODEL=M" (defaults to M) -# Any of the following models are accepted: S (small), M (medium), -# C (compact), or L (large). -# "TARGET=N" (defaults to N) -# Any of the following platforms are accepted: R (real-mode DOS), -# W (windows), N (Windows NT). +# "TARGET=W" (defaults to W) +# Any of the following targets are accepted: +# R (console mode), +# W (windows). # "DLL" (defaults to 0) -# If this item is 1, a DLL version of the library is generated. # If this item is 0, then a normal library is generated. -# Only Large model versions of DLLs are supported. +# If this item is 1, a DLL version of the library is generated. # "DEBUG" (defaults to 1) # If this item is 1, debugging support is compiled into # the library. If this item is 0, then debugging support # is disabled. Debug support does not include CodeView information. -# "CODEVIEW=0" (defaults to 2, always) +# "CODEVIEW=0" (defaults to 1, always) # If this item is 1 CodeView information is compiled into # the library. You must use the /CODEVIEW link option # in addition, when linking your executable. If this item @@ -37,314 +44,349 @@ # whole OPT= argument, e.g., "OPT=/J /W3". # "NO_PCH=1" # Set this item to override the default use of precompiled headers +# "PLATFORM=INTEL" (defaults to INTEL) +# This option chooses the appropriate tools and sources for the +# different platforms support by Windows/NT. Currently INTEL and +# MIPS are supported; more will be aded as they become available. # -# The default is to build MODEL=M TARGET=W DEBUG=1 +# The default is to build PLATFORM=INTEL TARGET=W DEBUG=1 # # ############################################################################# -# Standard tools +# Define defaults if not defined -!if "$(MODEL)"=="n" || "$(MODEL)"=="N" -CPP=cl386 -CC=cl386 -MKNT=1 -!else -CPP=cl -CC=cl -!endif +# Only NT 'MODEL' is supported by MFC 2.1 +MODEL=N -############################################################################# -# Parse these options: +# Default to ALPHA platform +!ifndef PLATFORM +PLATFORM=ALPHA +!endif +# Default to DEBUG mode !ifndef DEBUG DEBUG=1 !endif +# Default to NOT DLL !ifndef DLL DLL=0 -!else -# DLL must be large model -MODEL=l !endif +# Default Target to Windows !ifndef TARGET -TARGET=W +TARGET=w +!endif + +# Default Codeview Info +!ifndef CODEVIEW +!if "$(DEBUG)"=="1" +CODEVIEW=1 +!else +CODEVIEW=0 +!endif !endif -!ifndef MODEL -MODEL=M + +############################################################################# +# normalize cases of parameters, or error check + +!if "$(TARGET)"=="W" +!undef TARGET +TARGET=w +!else +!if "$(TARGET)"=="R" +!undef TARGET +TARGET=r +!endif !endif -!ifndef CODEVIEW -CODEVIEW=2 +!if "$(CPU)"=="MIPS" +!if "$(PLATFORM)"!="MIPS" +!error Must set PLATFORM=MIPS for MIPS builds !endif +!endif + +!if "$(CPU)"=="ALPHA" +!if "$(PLATFORM)"!="ALPHA" +!error Must set PLATFORM=ALPHA for ALPHA builds +!endif +!endif + + +############################################################################# +# Parse these options: +# +# DEBUG OPTIONS +# !if "$(DEBUG)" != "0" DEBUGSUF=D DEBDEFS=/D_DEBUG -!ifdef MKNT -DEBOPTS=/Od /Zd -CVTOPTS=-g +DEBOPTS=/Od !else -DEBOPTS=/Odr /f -CVTOPTS= -!endif + +# +# NON-DEBUG OPTIONS +# +!if "$(PLATFORM)"=="INTEL" +DEBUGSUF= +DEBDEFS= +DEBOPTS=/O1 /Gy !else +!if "$(PLATFORM)"=="MIPS" DEBUGSUF= DEBDEFS= -!ifdef MKNT -DEBOPTS=/Os /Zd +DEBOPTS=/Osg /Gs /Gy !else -DEBOPTS=/Oxt +!if "$(PLATFORM)"=="ALPHA" +DEBUGSUF= +DEBDEFS= +DEBOPTS=/Ox +!endif !endif !endif +!endif + +# +# CODEVIEW options +# !if "$(CODEVIEW)" == "1" -!ifdef MKNT -DEBOPTS=$(DEBOPTS) /Zd -!else -DEBOPTS=$(DEBOPTS) /Zi -!endif +CVOPTS=/Z7 !endif + # CVEXTRA used for select CodeView information (main files only) !if "$(CODEVIEW)" == "2" -!ifdef MKNT -CVEXTRA=/Zd -!else -CVEXTRA=/Zi -!endif +CVEXTRA=/Z7 !endif -!if "$(MODEL)"=="s" || "$(MODEL)"=="S" -CL_MODEL=/AS -!else -!if "$(MODEL)"=="m" || "$(MODEL)"=="M" -CL_MODEL=/AM -!else -!if "$(MODEL)"=="c" || "$(MODEL)"=="C" -CL_MODEL=/AC -!else -!if "$(MODEL)"=="l" || "$(MODEL)"=="L" -CL_MODEL=/AL +# +# PLATFORM options +# +!if "$(PLATFORM)"=="INTEL" +CPP=cl +CL_MODEL=/D_X86_ +LIB32=lib !else -!if "$(MODEL)"=="n" || "$(MODEL)"=="N" -# Windows NT -CL_MODEL=/D_NTWIN /Di386 -MKNT=1 +!if "$(PLATFORM)"=="MIPS" +CPP=mcl +CL_MODEL=/D_MIPS_ +LIB32=lib32 +!else +!if "$(PLATFORM)"=="ALPHA" +CPP=claxp +CL_MODEL= +LIB32=lib32 !else -!error MODEL must be one of S, M, L, or N - -!endif -!endif +!error PLATFORM must be one of INTEL or MIPS or ALPHA !endif !endif !endif -!if "$(TARGET)"=="r" || "$(TARGET)"=="R" -!ifdef MKNT -TARGDEFS= -TARGOPTS= -EXPFLAG= -!else -TARGDEFS=/D_DOS +# +# TARGET options +!if "$(TARGET)"=="r" +TARGDEFS=/D_CONSOLE TARGOPTS= -EXPFLAG= -!endif !else - -!if "$(TARGET)"=="w" || "$(TARGET)"=="W" +!if "$(TARGET)"=="w" MKWIN=1 -!ifdef MKNT -TARGDEFS=/D_WINDOWS /DWINVER=0x030a -EXPFLAG= -!else TARGDEFS=/D_WINDOWS -TARGOPTS=/GA /GEs /G2 -EXPFLAG=/GEe -!endif - +TARGOPTS= !else - -!error TARGET must be one of W, R - +!error TARGET must be one of W or R. !endif !endif +# TYPE = Library Type Designator +# c = normal C library +# d = DLL library +TYPE=c -!if "$(OBJ)" == "" -D=$$$(MODEL)$(TARGET)$(DEBUGSUF) -!if "$(DLL)" != "0" -D=$D.dll -!endif +# +# DLL Variants +# +!if "$(DLL)" == "1" +# _USRDLL library (SS!=DS) +TYPE=d +DEXT=.dll +TARGOPTS=/D_USRDLL /D_WINDLL !else -D=$(OBJ) +DEXT= !endif -DEFS=$(DEBDEFS) $(TARGDEFS) -CL_OPT=/W3 $(DEBOPTS) $(TARGOPTS) $(OPT) +# +# Object File Directory +# +!if "$(OBJ)" == "" +D=$$$(MODEL)$(TARGET)$(DEBUGSUF)$(DEXT) # subdirectory specific to variant +!else +D=$(OBJ) # User specified directory +!endif -!if "$(DLL)" == "0" -# Normal library -GOAL=$(MODEL)afxc$(TARGET)$(DEBUGSUF) -!else -# DLL library (SS!=DS) - only Large model supported (compact model is possible) -GOAL=$(MODEL)afxd$(TARGET)$(DEBUGSUF) -CL_MODEL=$(CL_MODEL)w -TARGOPTS=/GD /G2 -# /GD will define _WINDLL +# +# COMPILER OPTIONS +# +!if "$(PLATFORM)"=="ALPHA" +CL_OPT=/W3 /Gf $(DEBOPTS) $(CVOPTS) $(TARGOPTS) +!else +!if "$(PLATFORM)"=="MIPS" +CL_OPT=/W3 /Gf $(DEBOPTS) $(CVOPTS) $(TARGOPTS) +!else +# INTEL +CL_OPT=/W3 /WX /Gf /Zl $(DEBOPTS) $(CVOPTS) $(TARGOPTS) +!endif !endif ############################################################################# -# Library Components +# Options always built from above conditionals -OBJECT=$D\object.obj $D\except.obj $D\dumpcont.obj $D\abort.obj \ - $D\assert.obj $D\archive.obj $D\archivex.obj $D\memory.obj \ - $D\validadd.obj $D\dumpinit.obj $D\version.obj - -FILES=$D\file.obj $D\filetxt.obj $D\filemem.obj $D\filex.obj - -COLLECTIONS=$D\array_b.obj $D\array_d.obj $D\array_o.obj $D\array_p.obj \ - $D\array_s.obj $D\array_w.obj $D\list_o.obj $D\list_p.obj \ - $D\list_s.obj $D\map_pp.obj $D\map_pw.obj $D\map_so.obj \ - $D\map_sp.obj $D\map_ss.obj $D\map_wo.obj $D\map_wp.obj $D\plex.obj +DEFS=$(DEBDEFS) $(TARGDEFS) +GOAL=$(MODEL)afx$(TYPE)$(TARGET)$(DEBUGSUF) -MISC=$D\string.obj $D\stringex.obj $D\time.obj +############################################################################# +# Library Components -WINDOWS=$D\window.obj $D\wingdi.obj $D\winctrl.obj $D\winstr.obj \ - $D\winapp.obj $D\winmain.obj $D\winmenu.obj $D\winmdi.obj $D\trace.obj +OBJECT=$D\objcore.obj $D\except.obj $D\afxver.obj \ + $D\validadd.obj $D\dumpcont.obj $D\dumpflt.obj \ + $D\arccore.obj $D\arcobj.obj $D\arcex.obj + +# non-shared diagnostics +OBJDIAG=$D\dumpinit.obj $D\dumpout.obj \ + $D\afxasert.obj $D\afxmem.obj $D\afxabort.obj + +FILES=$D\filecore.obj $D\filetxt.obj $D\filemem.obj $D\filex.obj $D\filest.obj + +COLLECTIONS1=$D\array_b.obj $D\array_d.obj $D\array_p.obj $D\array_o.obj \ + $D\array_s.obj $D\array_u.obj $D\array_w.obj \ + $D\list_o.obj $D\list_p.obj $D\list_s.obj + +COLLECTIONS2=$D\map_pp.obj $D\map_pw.obj $D\map_so.obj \ + $D\map_sp.obj $D\map_ss.obj $D\map_wo.obj $D\map_wp.obj $D\plex.obj + +MISC=$D\strcore.obj $D\strex.obj $D\timecore.obj + +WINDOWS=\ + $D\wincore.obj $D\winfrm.obj $D\winmdi.obj $D\winhand.obj $D\winmain.obj \ + $D\barcore.obj $D\bartool.obj $D\bardlg.obj \ + $D\dcprev.obj $D\dcmeta.obj + +DIALOG=\ + $D\dlgcore.obj $D\dlgdata.obj $D\dlgfloat.obj \ + $D\winctrl.obj $D\winbtn.obj \ + $D\dlgfile.obj $D\dlgprnt.obj $D\dlgclr.obj $D\dlgfnt.obj $D\dlgfr.obj + +WINMISC=\ + $D\wingdi.obj $D\winstr.obj $D\winmenu.obj \ + $D\auxdata.obj $D\afxtrace.obj + +DOCVIEW=\ + $D\cmdtarg.obj $D\doccore.obj $D\doctempl.obj \ + $D\docsingl.obj $D\docmulti.obj \ + $D\viewcore.obj $D\viewprnt.obj $D\winsplit.obj $D\viewscrl.obj \ + $D\viewform.obj $D\viewedit.obj $D\viewprev.obj + +APPLICATION=\ + $D\appcore.obj $D\appui.obj $D\appgray.obj $D\appdlg.obj $D\appprnt.obj \ + $D\apphelp.obj $D\apphelpx.obj -!ifdef MKNT -WINEXTRAS=$D\winbtn.obj $D\windlgs.obj +!if "$(DEBUG)" == "1" +!ifdef MKWIN +INLINES = $D\afxinl1.obj $D\afxinl2.obj $D\afxinl3.obj !else -WINEXTRAS=$D\penctrl.obj $D\winbtn.obj $D\windlgs.obj +INLINES = $D\afxinl1.obj !endif - -!if "$(DLL)" == "0" -OLE= $D\olemisc.obj $D\olefile.obj $D\olecli.obj $D\oleui.obj $D\oleui2.obj \ - $D\olesvr.obj !else -OLE= # OLE not supported for DLLs +INLINES = !endif -OBJS=$(OBJS) $(OBJECT) $(FILES) $(COLLECTIONS) $(MISC) +OLE= $D\olemisc.obj $D\olefile.obj $D\oledoc.obj $D\olecli.obj \ + $D\oleui.obj $D\oleui2.obj $D\olesvr.obj $D\oletsvr.obj + +OBJS=$(OBJECT) $(OBJDIAG) $(INLINES) $(FILES) $(COLLECTIONS1) $(COLLECTIONS2) $(MISC) !ifdef MKWIN -OBJS=$(OBJS) $(WINDOWS) $(WINEXTRAS) $(OLE) +OBJS=$(OBJS) $(WINDOWS) $(DIALOG) $(WINMISC) $(DOCVIEW) $(APPLICATION) $(OLE) !endif - - +############################################################################# +# Standard tools ############################################################################# # Set CPPFLAGS for use with .cpp.obj and .c.obj rules # Define rule for use with OBJ directory # C++ uses a PCH file -CPPFLAGS=$(CPPFLAGS) $(CL_STANDARD) $(CL_MODEL) $(CL_OPT) $(DEFS) +CPPFLAGS=$(CPPFLAGS) $(CL_MODEL) $(CL_OPT) $(DEFS) $(OPT) !ifndef NO_PCH -PCH_FILE=$D\afxpch.pch -CPPFLAGS=$(CPPFLAGS) /Yu /Fp$(PCH_FILE) +!ifndef PCH_FILE +PCH_FILE=$D\stdafx.pch +!endif + +CPPFLAGS=$(CPPFLAGS) /Yustdafx.h /Fp$(PCH_FILE) !else PCH_FILE= !endif -CFLAGS=$(CFLAGS) $(CL_STANDARD) $(CL_MODEL) $(CL_OPT) $(DEFS) - -.SUFFIXES : .cpp +.SUFFIXES: .cpp .cpp{$D}.obj: -!ifdef MKNT - $(CPP) $(CPPFLAGS) /c /Fo$@ $< -!else - $(CPP) @<< - $(CPPFLAGS) /c /Fo$@ $< -<< -!endif - -.c{$D}.obj: -!ifdef MKNT - $(CC) $(CFLAGS) /c /Fo$@ $< -!else - $(CC) @<< - $(CFLAGS) /c /Fo$@ $< -<< -!endif + $(CPP) $(CPPFLAGS) /c /Fo$D\ $< ############################################################################# -# Goal to build +# Goals to build -goal: $D ..\lib\$(GOAL).lib +goal: create.dir ..\lib\$(GOAL).lib -$D: - IF NOT EXIST $D mkdir $D +create.dir: + @-if not exist $D\*.* mkdir $D clean: - -erase $D\*.obj - -erase $D\*.pch - -rmdir $D - + -if exist $D\*.obj erase $D\*.obj + -if exist $D\*.pch erase $D\*.pch + -rmdir $D ############################################################################# # Precompiled header file !ifndef NO_PCH -INC_DIR=..\include -HDRS=$(INC_DIR)\afx.h $(INC_DIR)\afx.inl $(INC_DIR)\afxcoll.h \ - $(INC_DIR)\afxwin.h $(INC_DIR)\afxwin.inl $(INC_DIR)\afxmsg.h \ - $(INC_DIR)\afxres.h \ - $(INC_DIR)\afxole.h $(INC_DIR)\afxoleui.h +HDRS =..\include\*.h ..\include\*.inl + +$D\objcore.obj $(PCH_FILE): objcore.cpp $(HDRS) + $(CPP) /c /Ycstdafx.h /Fp$(PCH_FILE) $(CL_MODEL) $(CL_OPT) $(DEFS) $(CVEXTRA) $(OPT) /c /Fo$D\objcore.obj objcore.cpp -$D\object.obj $(PCH_FILE): object.cpp $(HDRS) - $(CPP) /c /Yc /Fp$(PCH_FILE) $(CL_STANDARD) $(CL_MODEL) $(CL_OPT) $(DEFS) $(CVEXTRA) /c /Fo$D\object.obj object.cpp !endif ############################################################################ # CodeView for select files + !if "$(CODEVIEW)"=="2" -$D\memory.obj : memory.cpp - $(CPP) $(CPPFLAGS) $(CVEXTRA) /c /Fo$D\memory.obj memory.cpp + +$D\afxmem.obj : afxmem.cpp + $(CPP) $(CPPFLAGS) $(CVEXTRA) /c /Fo$D\afxmem.obj afxmem.cpp !ifdef MKWIN $D\winmain.obj : winmain.cpp - $(CPP) $(CPPFLAGS) $(CVEXTRA) /c /Fo$D\winmain.obj winmain.cpp + $(CPP) $(CPPFLAGS) $(CVEXTRA) /c /Fo$D\winmain.obj winmain.cpp -$D\window.obj : window.cpp - $(CPP) $(CPPFLAGS) $(CVEXTRA) /c /Fo$D\window.obj window.cpp +$D\wincore.obj : wincore.cpp + $(CPP) $(CPPFLAGS) $(CVEXTRA) /c /Fo$D\wincore.obj wincore.cpp -$D\winapp.obj : winapp.cpp - $(CPP) $(CPPFLAGS) $(CVEXTRA) /c /Fo$D\winapp.obj winapp.cpp +$D\appcore.obj : appcore.cpp + $(CPP) $(CPPFLAGS) $(CVEXTRA) /c /Fo$D\appcore.obj appcore.cpp !endif !endif ############################################################################# -# Windows 3.0 loader export/version number -$D\version.obj : version.cpp -!ifdef MKNT - $(CPP) $(CPPFLAGS) $(EXPFLAG) /c /Fo$D\version.obj version.cpp -!else - $(CPP) @<< -$(CPPFLAGS) $(EXPFLAG) /c /Fo$D\version.obj version.cpp -<< -!endif - +# Build the library from the up-to-date objs -############################################################################# -# Library results - -..\lib\$(GOAL).lib: $D $(OBJS) - -erase $@ -!ifdef MKNT - coff -lib -out:..\lib\$(GOAL).lib $(OBJS) -!else - lib /PAGESIZE:128 @<< -..\lib\$(GOAL).lib -y +..\lib\$(GOAL).lib: $(OBJS) + @-if exist $@ erase $@ + @$(LIB32) -out:$@ @<< $(OBJS) -nul -; << -!endif #############################################################################