home *** CD-ROM | disk | FTP | other *** search
Text File | 1997-05-06 | 34.5 KB | 1,276 lines |
- #-----------------------------------------------------------------------------
- # Copyright (c) 1993, 1995 by Borland International
- #
- # $Revision: 10.30 $
- #
- # Common makefile generator for example makefiles
- #
- # Usage for each makefile using this include, specify system and model:
- # SYSTEM=WIN16 is implied unless MODEL=f, in which case WIN32 is implied
- # MODEL=d (DLL) is implied unless SYSTEM=WIN32, in which case MODEL=f
- #
- # make SYSTEM=WIN16 MODEL=s builds 16bit Windows small model static
- # make SYSTEM=WIN16 MODEL=m builds 16bit Windows medium model static
- # make SYSTEM=WIN16 MODEL=c builds 16bit Windows compact model static
- # make SYSTEM=WIN16 MODEL=l builds 16bit Windows large model static
- # make SYSTEM=WIN16 MODEL=d builds 16bit Windows large model DLL
- # make SYSTEM=WIN32 MODEL=f builds 32bit Windows static version
- # make SYSTEM=WIN32 MODEL=d builds 32bit Windows DLL version
- # make SYSTEM=WIN32 MODEL=t builds 32bit app with cw32mt, bidst, etc.
- # make SYSTEM=WIN32 MODEL=t USEDLL=1 links to cw32mti, bidsti, etc.
- # make SYSTEM=DOS16 MODEL=s builds 16bit DOS small model static
- # make SYSTEM=DOS16 MODEL=m builds 16bit DOS medium model static
- # make SYSTEM=DOS16 MODEL=c builds 16bit DOS compact model static
- # make SYSTEM=DOS16 MODEL=l builds 16bit DOS large model static
- # make SYSTEM=CON32 MODEL=f builds 32bit static console app
- # make SYSTEM=CON32 MODEL=d builds 32bit DLL console app
- # -DDEBUG <or> DEBUG=1 add to enable debug info for TDW & TD32
- # -DDIAGS <or> DIAGS=1 add to enable runtime diagnostics
- # MAKEARGS= make command args used to run generated makefile
- # TARGET= name.extension of a single target to make (rather than all)
- #
- # For backward compatibility, SYSTEM may also be specied by -D, e.g. -DWIN32
- #
- # A specific makefile for the requested model will be generated as required.
- # The generated makefile will then be run to produce the target executables.
- # This generated makefile will be named {model}.MAK, where {model} is the
- # concatenation of the SYSTEM, MODEL, DIAGS, and DEBUG values. A zero-length
- # sentry file named {model}.MOD is produced to identify the built components.
- # Changing the model, system, diag, or debug values forces a complete rebuild.
- #
- # BCEXAMPLEDIR must be defined as the directory of this file and other *.gen
- # BCEXAMPLEDIR is defined by default to $(MAKEDIR)\..\EXAMPLES in BUILTINS.MAK
- # This may be redefined as an environment variable or on the MAKE command line
- #
- # The specification makefile in the project directory consists of a series of
- # definitions described below, followed by an include of this file or another
- # gen file which wrappers this file, i.e. !include $(BCEXAMPLEDIR)\owlmake.gen
- # Editing the specification makefile forces regeneration of target makefiles.
- #
- # Defines to specify *.EXE targets, generation of $(EXERULE):
- # EXE= Base name of .exe for app with no .rc file
- # EXERES= Base name of .exe for app with .rc -> .res file of same name
- # RESEXE= .res file(s) for EXE (define RESEXE_ also if more dependencies)
- # RESEXE_= Dependent files for $(RESEXE), other than the corresponding .RC
- # DEFEXE= .def file for EXE, otherwise temp one will be generated
- # OBJEXE= Object file names, needed only if other than $(EXE).obj
- # LIBEXE= Library file names for extra libs if needed
- # MAPEXE(=)Name for map file, else none will be generated
- # CCFEXE= Additional compiler flags for EXE, added after standard options
- # EXEBIN= Name with extension of executable if different from $(EXE).exe
- # EXE_= Additional dependencies for EXE, other than RESEXE and OBJEXE
- # DOSSTUB= Specific stub to bind when running a Windows app under DOS
- #
- # Defines to specify *.DLL targets, generation of $(DLLRULE):
- # DLL= Base name of .dll for dynamic library with no .rc file
- # DLLRES= Base name of .dll for with .rc file with same base name
- # OBJDLL= Explicit list of .obj files for DLL, if other than $(DLL).obj
- # LIBDLL= Library file names for extra libs if needed for DLL
- # RESDLL= .res file(s) for DLL (use dependency line if >1 RC file)
- # RESDLL_= Dependent files for $(RESDLL), other than the corresponding .RC
- # DEFDLL= .def file for DLL, otherwise generates one based on DLL
- # MAPDLL(=)Name for map file, else none will be generated
- # CCFDLL= Additional compiler flags for EXE, added after standard options
- # DLLBIN= Name with extension of dynamic library if not $(DLL).dll
- #
- # Defines to specify *.HLP targets:
- # HLP= Helpfile base name, assumes .hlp made from .hpj
- # HLP_= Optional dependency files for helpfile, if more than $(HLP).hpj
- #
- # Defines to specify *.LIB targets:
- # LIBBIN= Static library to build (with extension), requires OBJLIB=
- # OBJLIB= Required list of object files for building static library LIBBIN
- #
- # Defines to specify additional targets to be included in generated makefile:
- # TARGETS= Additional targets to build, rules must be defined in RULES
- # RULES= Additional rules and dependencies to be appended to the makefile
- # Lines before the final line must be terminated with a caret (^)
- #
- # Defines to restrict the models or operating environments for the makefile:
- # MODELS= Optional list of supported models, else all valid models allowed
- # SYSTEMS= Optional list of supported systems, else all platforms supported
- # MODEL= Forces a particular model, regardless of command line argument
- # SYSTEM= Forces a particular system, regardless of command line argument
- #
- # Defines to specify additional user include paths and libraries:
- # USERINCPATH= Search path for include files, put before other include paths
- # USERLIBPATH= Search path for user libraries specified without directories
- # USERLIBS = User libraries for EXEs and DLLs, won't be put as dependents
- #
- # Other defines:
- # ALIGN=<1|2|4|8> Specifies the alignment
- # RTLFIRST=1 Force the RTL library before all other libraries
- # CODEGUARD=<1|2> Build with CodeGuard: 1=basic data, 2=full checking
- # CPUOPT=<2|3|4|5> Optimize for specific CPU
- # MATHOPT=<0|1|2> 0=no math libs, 1=emulation, 2=coprocessor
- # BCC32I Use BCC32I.EXE instead of BCC32.EXE [32-bit only]
- # ILINK Uses ILINK32 instead of TLINK32 to link
- # REDEFINE_BOOL Enable mapping of 'BOOL' to 'bool'
- # NAMESPACE Assumes ClassLib, OCF, and OWL are using namespaces
- # VCL Use namespaces, VCL-compatible options, and CP32MT(i)
- # USEDLL Use DLL versions of standard libs (rtl, bids...)
- #
- # These are available when building non DOS targets:
- # OSMAJOR Operating system major version number
- # OSMINOR Operating system minor version number
- #
- # For generating makefiles with multiple similar .exe targets:
- # Generate a template EXE target rule using the EXE options for a sample EXE
- # Then define rules for each EXE by substituting text within a previous rule
- # $(EXERULE) is the automatically generated rule for the sample EXE target
- # The following macros must be defined to override automatic EXE targeting
- # EXEALL= The list of all .exe targets, including extensions
- # EXEMAKE= The list of all rules for the targets in EXEALL (may be macros)
- #
- # Similarly, for generating makefiles with multiple similar .dll targets:
- # Substitute text in $(DLLRULE), $(DLLRULE:old=new), and define the following
- # DLLALL= The list of all .exe targets, including extensions
- # DLLMAKE= The list of all rules for the targets in DLLALL (may be macros)
- #
- # When building VCL-compatible programs, both BCROOT and BCBROOT need
- # to be defined. If BC5\BIN is on your path first, then BCROOT is
- # defined by default. If C++Builder is on your path first, BCBROOT
- # is defined by default. You must define the other one (or both)
- # explicitly as an environment variable in order for the makefile to
- # locate the OWL source in the BC5 tree and the VCL libraries in the
- # BCB tree.
- #
- # BCROOT defaults to: $(BCBROOT) ; one of these is always
- # BCBROOT defaults to: $(BCROOT) ; defined by default
- #
- # VCLINCDIR defaults to: $(BCBROOT)\include;($BCBROOT)\include\vcl
- # VCLOBJDIR defaults to: $(BCBROOT)\lib\obj
- # VCLLIBDIR defaults to: $(BCBROOT)\lib
- #-----------------------------------------------------------------------------
-
- #-----------------------------------------------------------------------------
- # The following defaults set compiler and link options for machine targeting
- # They may be modified below or overridden by environment or command line
- #-----------------------------------------------------------------------------
-
- !ifndef CPUOPT
- CPUOPT = 3 # =2 for 286, =3 for 386, =4 for 486, =5 for pentium
- !endif
-
- !ifndef MATHOPT
- MATHOPT = 1 # =0 for no math libs, =1 for emulation, =2 for math coprocessor
- !endif
-
-
- #-----------------------------------------------------------------------------
-
- .swap
-
- #
- # Macros enclosed with underbars are for internal use only, i.e. _MODEL_
- # Other macros defined outside this file will not be altered unless incorrect
- #
-
- #-----------------------------------------------------------------------------
- # Define macros for inserting spaces $(sp) and newlines $(nl)
- #-----------------------------------------------------------------------------
-
- _sp_ = | |
- sp = $(_sp_:|=)
-
- _nl_ = |^
- |
- nl = $(_nl_:|=)
-
- #----------------------------------------------------------------------------
- # Validate or select target operating system
- #----------------------------------------------------------------------------
-
- !ifndef SYSTEMS
- SYSTEMS = WIN16 DOS16 WIN32 CON32
- !endif
-
- !ifndef SYSTEM
- ! if $d(WIN32) || "$(MODEL)"=="f" || "$(MODEL)" == "t" || $d(MT) || $d(VCL)
- SYSTEM = WIN32
- ! elif $d(CON32)
- SYSTEM = CON32
- ! elif $d(WIN16)
- SYSTEM = WIN16
- ! elif $d(DOS16)
- SYSTEM = DOS16
- ! else #default
- ! if !$d(MODEL)
- SYSTEM = WIN32
- MODEL = d
- ! else
- SYSTEM = WIN16
- ! endif
- ! endif
- !endif
-
- _SYSTEMS_ = " $(SYSTEMS) "
- _SYSTEMX_ = |$(SYSTEM)|
- _SYSTEM_ = $(_SYSTEMX_:|= )
- !if $(_SYSTEMS_:$(_SYSTEM_)=)==$(_SYSTEMS_)
- ! error $(SYSTEM) system not supported
- !endif
-
- #
- # Check for errors
- #
- !if $d(ILINK) && $d(WIN16)
- ! error Cannot build 16-bit targets with ILINK.
- !endif
- !if $d(VCL) && $(SYSTEM) == WIN16
- ! error VCL compatibility requires SYSTEM=WIN32
- !endif
- !if $d(VCL) && $(ALIGN) == 4
- ! error VCL compatibility requires ALIGN=4
- !endif
-
- #
- # Generate boolean flags for use in platform testing
- #
- !if $(SYSTEM:32=)!=$(SYSTEM)
- _32BIT_=1
- !else
- _32BIT_=0
- !endif
- !if $(SYSTEM:WIN=)!=$(SYSTEM)
- _GUI_=1
- !else
- _GUI_=0
- !endif
-
- #-----------------------------------------------------------------------------
- # The following defaults set the linker OS version
- # They may be modified below or overridden by environment or command line
- #-----------------------------------------------------------------------------
- !if ($d(OSMAJOR) && !$d(OSMINOR)) || (!$d(OSMAJOR) && $d(OSMINOR))
- ! error Both OSMAJOR and OSMINOR must be passed, not just one.
- !endif
-
- !if $d(OSMAJOR) && SYSTEM == DOS16
- ! error OSMAJOR cannot be set for DOS targets.
- !endif
-
- !if $d(OSMINOR) && SYSTEM == DOS16
- ! error OSMINOR cannot be set for DOS targets.
- !endif
-
- #
- # default to 3.10 - NOTE: must be explicit about .10!
- #
- !if !$d(OSMAJOR) && !$d(OSMINOR)
- OSMAJOR = 3
- OSMINOR = 10
- !endif
-
- #
- # Default alignment
- #
- !ifndef ALIGN
- ! if $d(VCL)
- ALIGN=4
- ! elif $(_32BIT_)
- ALIGN=1
- ! else
- ALIGN=1
- ! endif
- !endif
-
- #-----------------------------------------------------------------------------
- # Directory & search paths
- #-----------------------------------------------------------------------------
-
- #
- # If neither or only one of the two root variables is defined,
- # read the file bcroot.inc and let it define whatever it wants to.
- #
- !if !$d(BCROOT) || !$d(BCBROOT)
- ! include $(MAKEDIR)\bcroot.inc
- ! if !$d(BCROOT) && !$d(BCBROOT)
- BCROOT = $(MAKEDIR)\..
- ! endif
- !endif
-
- #
- # At least one of the roots is certainly defined now.
- # If only one is defined, make them both the same.
- #
- !if !$d(BCROOT)
- BCROOT = $(BCBROOT)
- !elif !$d(BCBROOT)
- BCBROOT = $(BCROOT)
- !endif
-
- #
- # Where to find command-line tools, headers, and libraries
- #
- !ifndef BCBINDIR
- BCBINDIR = $(BCROOT)\bin
- !endif
- !ifndef BCINCDIR
- BCINCDIR = $(BCROOT)\include
- !endif
- !ifndef BCLIBDIR
- BCLIBDIR = $(BCROOT)\lib
- !endif
-
- #
- # Where to find VCL libraries, objs, and headers
- #
- !if $d(VCL)
- ! if !$d(VCLLIBDIR)
- VCLLIBDIR = $(BCBROOT)\lib
- ! endif
- ! if !$d(VCLOBJDIR)
- VCLOBJDIR = $(VCLLIBDIR)\obj
- ! endif
- ! if !$d(VCLINCDIR)
- ! if "$(BCBROOT)" != "$(BCROOT)"
- VCLINCDIR = $(BCBROOT)\include;$(BCBROOT)\include\vcl
- ! else
- VCLINCDIR = $(BCBROOT)\include\vcl
- ! endif
- ! endif
- INCLUDE = $(INCLUDE);$(VCLINCDIR)
- !endif
-
- !ifdef USERLIBPATH
- LIBRARYPATH = $(USERLIBPATH)$(sp)
- !endif
- #!ifdef VCL
- #LIBRARYPATH = $(VCLLIBDIR);$(LIBRARYPATH)
- #!endif
-
- !ifdef SYSINCPATH
- _SYSINCPATH_ = $(SYSINCPATH)
- !endif
- !ifdef USERINCPATH
- INCLUDEPATH = $(USERINCPATH);$(_SYSINCPATH_)
- !else
- INCLUDEPATH = $(_SYSINCPATH_)
- !endif
- !ifdef VCL
- INCLUDEPATH = $(INCLUDEPATH);$(VCLINCDIR)
- !endif
- INCLUDEPATH = $(INCLUDEPATH);$(BCINCDIR)
-
- #----------------------------------------------------------------------------
- # Validate or select compiler/library model
- #----------------------------------------------------------------------------
-
- #
- # Set allowable models for each platform
- #
- !if $(_32BIT_)
- ! if $d(VCL)
- _MODELS_ = dt
- ! else
- _MODELS_ = dfxt
- ! endif
- !elif $(_GUI_)
- _MODELS_ = smcldx
- !else #DOS16
- _MODELS_ = smclh
- !endif
-
- !ifndef MODELS
- MODELS = $(_MODELS_:x=)
- !endif
-
- #
- # Validate model if defined, else get default model
- #
- !ifndef MODEL
- ! if $(_32BIT_)
- ! if $d(VCL)
- MODEL = t #WIN32 threaded
- ! elif $(_GUI_)
- MODEL = f #WIN32
- ! else
- MODEL = f #CON32
- ! endif
- ! elif $(_GUI_)
- MODEL = d #WIN16
- ! else
- MODEL = s #DOS16
- ! endif
- !endif
-
- #
- # Set MT for multithreading
- #
- !if "$(MODEL)"=="t"
- MT = 1
- !endif
- !if $d(VCL)
- MT = 1
- !endif
-
- #
- # If model is not valid for this example, display error message and exit
- #
- !if ("$(MODELS:$(MODEL)=)"=="$(MODELS)")||("$(_MODELS_:$(MODEL)=)"=="$(_MODELS_)")
-
- #
- # Convert MODEL to English
- #
- ! if $(MODEL)==s
- ERRSTR=Small model
- ! elif $(MODEL)==m
- ERRSTR=Medium model
- ! elif $(MODEL)==c
- ERRSTR=Compact model
- ! elif $(MODEL)==l
- ERRSTR=Large model
- ! elif $(MODEL)==h
- ERRSTR=Huge model
- ! elif $(MODEL)==d
- ERRSTR=DLL target
- ! elif $(MODEL)==f
- ERRSTR=Static target
- ! elif $(MODEL)==x
- ERRSTR=External DLL
- ! elif $(MODEL)==t
- ERRSTR=Multithread target
- ! else
- ERRSTR=$(MODEL) model
- !endif
-
- #
- # Use message to get everything on one line without path interfering
- #
- ! message Error $(ERRSTR), $(SYSTEM) is not supported for this program
- ! message Error Use MODEL=?, where ? is a supported model ($(MODELS))
- ! error Usage Error
- !endif
-
- #
- # Set internal model for compiler and link libraries
- #
- !if $(MODEL) == d || $(MODEL) == x
- USEDLL = 1
- !endif
- _MODEL_ = $(MODEL)
- !if $(_32BIT_)
- _MODEL_ = f
- !else
- ! ifdef USEDLL
- _MODEL_ = l
- ! endif
- DMODEL = l
- !endif
-
- #
- # Set parameters for .DEF file
- #
- !ifndef STACKSIZE #used for 16-bit only
- STACKSIZE = 16384
- !endif
-
- !ifndef HEAPSIZE #used for 16-bit only
- ! ifdef USEDLL
- HEAPSIZE = 4096
- ! else
- HEAPSIZE = 4096
- ! endif
- !endif
-
- #----------------------------------------------------------------------------
- # Check target options and dependencies, setup defaults
- #----------------------------------------------------------------------------
-
- #
- # Set .RES file if one implied by xxxRES, set target file names
- #
- !ifdef EXERES
- EXE = $(EXERES)
- ! ifndef RESEXE
- RESEXE = $(EXE).res
- ! endif
- !endif
- !ifdef EXE
- ! ifndef EXEBIN
- EXEBIN = $(EXE).exe
- ! endif
- ! ifndef CFGEXE
- CFGEXE = cfgexe
- ! endif
- !endif
-
- !if $(SYSTEM)==DOS16
- ! undef RESEXE
- ! undef DLL
- ! undef DLLRES
- ! undef DLLBIN
- !endif
-
- !ifdef DLLRES
- DLL = $(DLLRES)
- ! ifndef RESDLL
- RESDLL = $(DLL).res
- ! endif
- !endif
- !ifdef DLL
- ! ifndef CFGDLL
- CFGDLL = cfgdll
- ! endif
- ! ifndef DLLBIN
- DLLBIN = $(DLL).dll
- ! endif
- !endif
-
- !ifdef HLP
- HLPBIN = $(HLP: =.hlp ).hlp
- !endif
-
- #----------------------------------------------------------------------------
- # Debug & diagnostic flags
- #----------------------------------------------------------------------------
- !if $(DEBUG) != 0
- DEBUG = 1
- ! if $(_32BIT_)
- LDBG = -v
- ! else
- LDBG = -v -Vt
- ! endif
- !else
- DEBUG = 0
- !endif
-
- !if $(DIAGS) != 0 # default diags use precondition, check, trace & warn
- DIAGS = 1
- __DEBUG=2
- __TRACE=1
- __WARN=1
- !else
- DIAGS = 0
- !endif
-
- !ifdef __DEBUG
- CDIAG = -D__DEBUG=$(__DEBUG)
- !endif
- !ifdef __TRACE
- CDIAG = $(CDIAG) -D__TRACE
- !endif
- !ifdef __WARN
- CDIAG = $(CDIAG) -D__WARN
- !endif
-
- #----------------------------------------------------------------------------
- # Library names
- # STDLIBS - RTL libs for use by current model
- # STDDLIBS - RTL libs for use by DLLs
- # C0 - Startup code for current model
- # C0D - Startup code for DLLs
- #----------------------------------------------------------------------------
- RTLPFX=cw
- RTLDIR=$(BCLIBDIR)
-
- !if $(_32BIT_)
-
- ! if $d(VCL)
- RTLPFX=cp
- RTLDIR=$(VCLLIBDIR)
- ! endif
-
- STDDLIBS = $(BCLIBDIR)\import32
- ! if $d(MT)
- STDDLIBS = $(STDDLIBS) $(RTLDIR)\$(RTLPFX)32mti
- ! else
- STDDLIBS = $(STDDLIBS) $(RTLDIR)\$(RTLPFX)32i
- ! endif
- C0D = $(RTLDIR)\c0d32
- ! if $(_GUI_)
- _SYSCODE_ = n
- C0 = $(RTLDIR)\c0w32
- ! else #CON32
- C0 = $(RTLDIR)\c0x32
- _SYSCODE_ = c
- ! endif
-
- ! if $d(DEBUG)
- VCLLIB = $(VCLLIBDIR)\vcld.lib
- ! else
- VCLLIB = $(VCLLIBDIR)\vcl.lib
- ! endif
-
- ! ifdef USEDLL
- STDLIBS = $(STDDLIBS)
- ! else
- ! if $d(MT)
- STDLIBS = $(BCLIBDIR)\import32 $(RTLDIR)\$(RTLPFX)32mt
- ! else
- STDLIBS = $(BCLIBDIR)\import32 $(RTLDIR)\$(RTLPFX)32
- ! endif
- ! endif
-
- ! if $d(VCL)
- STDLIBS = $(STDLIBS) $(VCLLIB)
- ! endif
-
- ! if $d(CODEGUARD) # Codeguard must preceed all user/frmwk libraries
- _RTLFIRST_= $(BCLIBDIR)\cg32 $(_RTLFIRST_)
- ! endif
-
- !elif $(_GUI_) #WIN16
- C0 = $(BCLIBDIR)\c0w$(_MODEL_)
- C0D = $(BCLIBDIR)\c0d$(DMODEL)
- STDDLIBS=$(BCLIBDIR)\import $(BCLIBDIR)\crtldll
- ! if $d(USEDLL)
- STDLIBS = $(STDDLIBS)
- ! else
- ! if $d(RTLFIRST)
- _RTLFIRST_ = $(BCLIBDIR)\$(RTLPFX)$(_MODEL_)$(sp)
- STDLIBS =$(BCLIBDIR)\import $(BCLIBDIR)\mathw$(_MODEL_)
- ! else
- STDLIBS =$(BCLIBDIR)\import $(BCLIBDIR)\mathw$(_MODEL_) $(BCLIBDIR)\$(RTLPFX)$(_MODEL_)
- ! endif
- ! endif
- ! if $d(FASTTHIS)
- SYSTEM = WIN16F
- _SYSCODE_ = f
-
- ! elif $d(PASCAL)
- SYSTEM = WIN16P
- _SYSCODE_ = p
-
- ! else
- SYSTEM = WIN16
- _SYSCODE_ = w
- ! endif
-
- ! if $d(CODEGUARD) # Codeguard must preceed all user/frmwk libraries
- _RTLFIRST_= $(BCLIBDIR)\cg16 $(_RTLFIRST_)
- ! endif
-
- !else #DOS16
-
- ! if "$(MATHOPT)"=="2"
- _MATHLIB_ = $(BCLIBDIR)\fp87 $(BCLIBDIR)\math$(_MODEL_)
- ! elif "$(MATHOPT)"=="1"
- _MATHLIB_ = $(BCLIBDIR)\emu $(BCLIBDIR)\math$(_MODEL_)
- !endif
- STDLIBS = $(_MATHLIB_) $(BCLIBDIR)\c$(_MODEL_)
- C0 = $(BCLIBDIR)\c0$(_MODEL_)
- SYSTEM = DOS16
- _SYSCODE_ = d
-
- !endif
-
- !ifdef USERLIBS
- _USERLIBS_ = $(USERLIBS)+$(nl)
- !endif
-
- !ifdef SYSLIBS
- _SYSLIBS_ = $(SYSLIBS)+$(nl)
- !endif
-
- !ifdef SYSLIBSD
- _SYSLIBSD_ = $(SYSLIBSD)+$(nl)
- !else
- _SYSLIBSD_ = $(_SYSLIBS_)
- !endif
-
- !ifdef LIBDLL
- _LIBDLL_ = $(LIBDLL)$(sp)
- !endif
-
- !ifdef LIBEXE
- _LIBEXE_ = $(LIBEXE)$(sp)
- !endif
-
- #
- # Set makefile name based on platform, model, debug/diagnostic mode
- #
- !if $d(VCL)
- KEY = v
- !else
- KEY = $(MODEL)
- !endif
- _MODELNAME_ = $(SYSTEM)$(KEY)$(DIAGS)$(DEBUG)
-
- #----------------------------------------------------------------------------
- # Options independent of build options
- #----------------------------------------------------------------------------
- !if $d(REDEFINE_BOOL)
- CFLAGS = $(CFLAGS) -DBI_REDEFINE_BOOL
- CFLAGSD = $(CFLAGSD) -DBI_REDEFINE_BOOL
- !endif
- !if $d(VCL)
- NAMESPACE = 1
- !endif
- !if $d(NAMESPACE)
- CFLAGS = $(CFLAGS) -DBI_NAMESPACE
- CFLAGSD = $(CFLAGSD) -DBI_NAMESPACE
- !endif
-
- #----------------------------------------------------------------------------
- # Tools and options for 32bit Windows and console apps
- #----------------------------------------------------------------------------
- !if $(_32BIT_)
- ! if !$d(BCC32I)
- BCC = $(BCBINDIR)\bcc32.exe
- ! else
- BCC = $(BCBINDIR)\bcc32i.exe
- ! endif
- BRCC = $(BCBINDIR)\brcc32.exe
- ! if $d(ILINK)
- TLINK = $(BCBINDIR)\ilink32 # incremental linker
- ! else
- TLINK = $(BCBINDIR)\tlink32 # standard linker
- ! endif
- ! if $(DEBUG)
- COPTS = -$(CPUOPT) -i55 -d -k -Od -v
- ! else
- COPTS = -$(CPUOPT) -i55 -d -k- -O1gmpv
- ! endif
- ! if $d(VCL)
- COPTS = $(COPTS) -b- -Vx -Ve
- ! endif
-
- CFGFILE = bcc32.cfg
-
- ! ifdef USEDLL
- CFLAGS = $(CFLAGS) -W -D_RTLDLL $(COPTS)
- CFLAGSD = $(CFLAGSD) -WDE -D_RTLDLL $(COPTS) # Building DLL's
- ! else # Using DLL libraries
- CFLAGS = $(CFLAGS) -W $(COPTS)
- CFLAGSD = $(CFLAGSD) -WDE $(COPTS) # Building DLL's
- ! endif # Using static libraries
-
- ! if !$d(MT)
- CFLAGS = $(CFLAGS) -WM-
- CFLAGSD = $(CFLAGSD) -WM-
- ! endif
-
- ! if $d(CODEGUARD) # d=add data, c=add calls, t=check this
- CFLAGS = $(CFLAGS) -vGd -vGt
- ! if $(CODEGUARD) == 2
- CFLAGS= $(CFLAGS) -vGc
- ! endif
- ! endif
-
- ! if $d(ALIGN)
- CFLAGS = $(CFLAGS) -a$(ALIGN)
- ! endif
-
- ! if $(_GUI_) #WIN32
- LFLAGS = -Tpe -aa -c $(LDBG)
- LFLAGSD = -Tpd -aa -c $(LDBG)
- ! else #CON32
- LFLAGS = -Tpe -ap -c $(LDBG)
- LFLAGSD = -Tpd -ap -c $(LDBG)
- ! endif
- ! if $d(VCL)
- LFLAGS = $(LFLAGS) -j$(VCLOBJDIR)
- LFLAGSD = $(LFLAGSD) -j$(VCLOBJDIR)
- ! endif
-
- LFLAGS = /V$(OSMAJOR).$(OSMINOR) $(LFLAGS)
- LFLAGSD = /V$(OSMAJOR).$(OSMINOR) $(LFLAGSD)
-
- #----------------------------------------------------------------------------
- # Tools and options for 16bit Windows and DOS
- #----------------------------------------------------------------------------
- !else
- BCC = $(BCBINDIR)\bcc.exe
- BRCC = $(BCBINDIR)\brcc.exe
- TLINK = $(BCBINDIR)\tlink.exe
- RLINK = $(BCBINDIR)\rlink.exe -K
- ! if $(DEBUG)
- COPTS = -$(CPUOPT) -d -k -Od -v
- ! else
- COPTS = -$(CPUOPT) -d -k- -O1gmpv
- ! endif
- ! if $(_MODEL_) != s && $(_MODEL_) != m
- COPTS = $(COPTS) -dc # -dc shouldn't be used in small & medium models
- ! endif
- CFGFILE = turboc.cfg
-
- ! if $d(FASTTHIS) && $d(PASCAL)
- _CENTRY_ = -D_FASTTHIS -p
- ! elif $d(FASTTHIS)
- _CENTRY_ = -D_FASTTHIS
- ! elif $d(PASCAL)
- _CENTRY_ = -p
- ! endif
-
- ! if $d(USEDLL) # using DLL libraries
- CFLAGS = $(CFLAGS) -WS -D_RTLDLL $(COPTS) -m$(_MODEL_) $(_CENTRY_)
- CFLAGSD = $(CFLAGSD) -WD -xc -D_RTLDLL $(COPTS) -m$(DMODEL) $(_CENTRY_) # DLLs
- LFLAGS = -Tw -c -C -Oc -Oi -Oa $(LDBG)
- ! elif $(_GUI_) # using static libraries
- CFLAGS = $(CFLAGS) -WSE $(COPTS) -m$(_MODEL_) $(_CENTRY_)
- CFLAGSD = $(CFLAGSD) -WDE -xc $(COPTS) -m$(DMODEL) $(_CENTRY_) # DLLs
- LFLAGS = -Tw -c -C -Oc -Oi -Oa $(LDBG)
- ! else # using 16-bit DOS
- CFLAGS = $(CFLAGS) $(COPTS) -m$(_MODEL_) $(_CENTRY_)
- LFLAGS = -c -C $(LDBG)
- ! endif
- LFLAGSD = -Twd -c -C -Oc -Oi -Oa $(LDBG)
-
- ! if $d(CODEGUARD) # d=add data, c=add calls, t=check this
- CFLAGS = $(CFLAGS) -vGd -vGt
- ! if $(CODEGUARD) == 2
- CFLAGS= $(CFLAGS) # -vGc !valid for 16-bit tools currently
- ! endif
- ! endif
-
- ! if $d(ALIGN)
- CFLAGS = $(CFLAGS) -a$(ALIGN)
- ! endif
-
- !endif #if/else $(_32BIT_)
-
- #----------------------------------------------------------------------------
- # Common tools and options
- #----------------------------------------------------------------------------
- HC = $(BCBINDIR)\hc31.exe
- IMPLIB = $(BCBINDIR)\implib.exe -c
- TLIB = $(BCBINDIR)\tlib.exe
-
- #----------------------------------------------------------------------------
- # Configure DLL target
- #----------------------------------------------------------------------------
-
- !ifdef DLL
- ! ifndef OBJDLL # if no explicit objs, assume one with same base name as DLL
- OBJDLL = $(DLL).obj
- ! endif
-
- #
- # Generate default .DEF file if none defined
- #
- ! ifdef DEFDLL
- _DEFDLL_ = $(DEFDLL)
- ! elif $(_32BIT_)
- _DEFDLL_ = &&|^
- LIBRARY $(DLLBIN:.=;)^
- EXETYPE WINDOWS^
- CODE PRELOAD MOVEABLE DISCARDABLE^
- DATA PRELOAD MOVEABLE MULTIPLE^
- |
- !else
- _DEFDLL_ = &&|^
- LIBRARY $(DLLBIN:.=;)^
- EXETYPE WINDOWS^
- CODE PRELOAD MOVEABLE DISCARDABLE^
- DATA PRELOAD MOVEABLE SINGLE^
- HEAPSIZE $(HEAPSIZE)^
- |
- ! endif
-
- ! ifdef RESDLL # explicit .res file or space-separated list of .res files
- ! if !$(_32BIT_) && "$(RESDLL)" != "$(RESDLL: =)" # >1 16-bit .res file
- _RESDLL_ = ^
- $(RLINK) @&&|^
- -fi$(RESDLL: = -fi)^
- $(DLLBIN)^
- |
- ! else
- _RESDLL_ = ,$(RESDLL)
- ! endif
- ! endif
-
- ! ifdef MAPDLL
- ! if "$(MAPDLL)"=="1"
- MAPDLL=
- ! endif
- _MAPDLL_ = -m -s $(MAPDLL)
- ! else
- _MAPDLL_ = -x
- ! endif
-
- #
- # Construct rule for DLL target - possibility that OBJDLL is blank
- #
- DLLRULE =^
- $(DLLBIN): $(OBJDLL) $(RESDLL) $(DEFDLL) $(LIBDLL)^
- $(TLINK) @&&|^
- $(LFLAGSD) -L$(LIBRARYPATH)+^
- $(C0D) $(OBJDLL)^
- $(DLLBIN)^
- $(_MAPDLL_)^
- $(_RTLFIRST_)$(_LIBDLL_)$(_USERLIBS_)$(_SYSLIBSD_)$(STDLIBS)^
- |,$(_DEFDLL_)$(_RESDLL_)^
- $(IMPLIB) $(DLL) $(DLLBIN)^
-
- ! ifndef DLLALL
- DLLALL = $(DLLBIN)
- ! endif
- _DLLALL_ = " $(DLLALL) "
- ! ifndef DLLMAKE
- DLLMAKE = $(DLLRULE)
- ! endif
-
- !endif
-
- #----------------------------------------------------------------------------
- # Configure LIBBIN target
- #----------------------------------------------------------------------------
-
- !ifdef LIBBIN
- ! ifndef CFGEXE
- CFGEXE = cfgexe
- ! endif
- _LIBOBJ1_ = .obj $(OBJLIB)
- _LIBOBJ2_ = $(_LIBOBJ1_:.obj =+)
- _LIBOBJ_ = $(_LIBOBJ2_:.obj=)
- !endif
-
- #----------------------------------------------------------------------------
- # Configure EXE target
- #----------------------------------------------------------------------------
-
- !ifdef EXE
-
- #
- # Generate default .DEF file if none defined
- #
- ! if $(SYSTEM)==DOS16
- ! undef DEFEXE
- ! elif $d(DEFEXE)
- _DEFEXE_ = ,$(DEFEXE)
- ! elif !$(_32BIT_) #WIN16
- ! ifdef DOSSTUB
- _DEFEXE_ = ,&&|^
- EXETYPE WINDOWS^
- STUB '$(DOSSTUB)'^
- CODE PRELOAD MOVEABLE DISCARDABLE^
- DATA PRELOAD MOVEABLE MULTIPLE^
- HEAPSIZE $(HEAPSIZE)^
- STACKSIZE $(STACKSIZE)^
- |
- ! else
- _DEFEXE_ = ,&&|^
- EXETYPE WINDOWS^
- CODE PRELOAD MOVEABLE DISCARDABLE^
- DATA PRELOAD MOVEABLE MULTIPLE^
- HEAPSIZE $(HEAPSIZE)^
- STACKSIZE $(STACKSIZE)^
- |
- ! endif
- ! elif $(_GUI_) #WIN32
- _DEFEXE_ = ,&&|^
- EXETYPE WINDOWS^
- CODE PRELOAD MOVEABLE DISCARDABLE^
- DATA PRELOAD MOVEABLE MULTIPLE^
- |
- ! else #CON32
- _DEFEXE_ = ,&&|^
- CODE PRELOAD MOVEABLE DISCARDABLE^
- DATA PRELOAD MOVEABLE MULTIPLE^
- |
- ! endif
-
- ! ifdef RESEXE # explicit .res file or space-separated list of .res files
- ! if !$(_32BIT_) && "$(RESEXE)" != "$(RESEXE: =)" # >1 16-bit .res file
- _RESEXE_ = ^
- $(RLINK) @&&|^
- -fi$(RESEXE: = -fi)^
- $(EXEBIN)^
- |
- ! else
- _RESEXE_ = ,$(RESEXE)
- ! endif
- ! endif
-
- ! ifndef OBJEXE # if no explicit objs, assume one with same base name as EXE
- OBJEXE = $(EXE).obj
- ! endif
- ! ifdef MAPEXE
- ! if "$(MAPEXE)"=="1"
- MAPEXE=
- ! endif
- _MAPEXE_ = -m -s $(MAPEXE)
- ! else
- _MAPEXE_ = -x
- ! endif
-
- #
- # Construct rule for EXE target
- #
- EXERULE =^
- $(EXEBIN): $(OBJEXE) $(RESEXE) $(DEFEXE) $(LIBEXE) $(EXE_)^
- $(TLINK) @&&|^
- $(LFLAGS) -L$(LIBRARYPATH) $(C0)+^
- $(OBJEXE)^
- $(EXEBIN)^
- $(_MAPEXE_)^
- $(_RTLFIRST_)$(_USERLIBS_)$(_SYSLIBS_)$(_LIBEXE_)$(STDLIBS)^
- |$(_DEFEXE_)$(_RESEXE_)^
-
- ! ifndef EXEALL
- EXEALL = $(EXEBIN)
- ! endif
- _EXEALL_ = " $(EXEALL) "
- ! ifndef EXEMAKE
- EXEMAKE = $(EXERULE)
- ! endif
-
- !endif
-
- #----------------------------------------------------------------------------
- # Define config file cleanup if any config files generated
- #----------------------------------------------------------------------------
-
- !if $d(EXE) || $d(LIBBIN) || $d(DLL)
- ! ifndef CFGCLN
- CFGCLN = cfgcln
- ! endif
- !else
- !undef CFGCLN
- !endif
-
- #----------------------------------------------------------------------------
- # Run makefile - dependent upon generated makefile and generated model sentry
- #----------------------------------------------------------------------------
-
- !ifndef MAKEFILE
- MAKEFILE = $(_MODELNAME_).mak
- !endif
-
- _SENTRY_ = $(_MODELNAME_).mod
-
- !ifdef TARGET
- _TARGXX_ = |$(TARGET)|
- _TARGBB_ = $(_TARGXX_:|= )
- ! if $(_EXEALL_:$(_TARGBB_)=) != $(_EXEALL_)
- _TARGET_ = $(CFGEXE) $(TARGET) $(CFGCLN)
- ! elif $(_DLLALL_:$(_TARGBB_)=) != $(_DLLALL_)
- _TARGET_ = $(CFGDLL) $(TARGET) $(CFGCLN)
- ! else
- ! error TARGET=$(TARGET)^
- $(TARGET) is not in target list (all: ...) for makefile $(MAKEFILE)
- ! endif
- !endif
-
- all: $(MAKEFILE) $(_SENTRY_)
- @$(MAKEDIR)\$(MAKE) -f$(MAKEFILE) $(MAKEARGS) $(_TARGET_)
-
- #----------------------------------------------------------------------------
- # Generate makefile
- #----------------------------------------------------------------------------
-
- ECHOOPTS= $(nl)Generating $(MAKEFILE)$(nl)
- ECHOOPTS= $(ECHOOPTS) SYSTEM is $(SYSTEM).$(nl)
- ECHOOPTS= $(ECHOOPTS) MODEL is $(MODEL).$(nl)
- !if $d(USEDLL)
- ECHOOPTS= $(ECHOOPTS) DLL versions of RTL/BIDS/OWL libraries.$(nl)
- !else
- ECHOOPTS= $(ECHOOPTS) Static versions of RTL/BIDS/OWL libraries.$(nl)
- !endif
- !if $d(NAMESPACE)
- ECHOOPTS= $(ECHOOPTS) Namespaces are ON.$(nl)
- !endif
- !if $d(VCL)
- ECHOOPTS= $(ECHOOPTS) VCL compatibility is ON.$(nl)
- !endif
- ECHOOPTS= $(ECHOOPTS) OS version $(OSMAJOR).$(OSMINOR).$(nl)
- ECHOOPTS= $(ECHOOPTS) CPU set to $(CPUOPT)86.$(nl)
- !if $(MATHOPT)==0
- ECHOOPTS= $(ECHOOPTS) Math libraries set to none.$(nl)
- !elif $(MATHOPT)==1
- ECHOOPTS= $(ECHOOPTS) Math libraries set to emulation.$(nl)
- !elif $(MATHOPT)==2
- ECHOOPTS= $(ECHOOPTS) Math libraries set to coprocessor.$(nl)
- !endif
- ECHOOPTS= $(ECHOOPTS) Alignment set to $(ALIGN).$(nl)
- !if $(DIAGS)==1
- ECHOOPTS= $(ECHOOPTS) Diagnostics messages are on.$(nl)
- !else
- ECHOOPTS= $(ECHOOPTS) Diagnostics messages are off.$(nl)
- !endif
- !if $(DEBUG)==1
- ECHOOPTS= $(ECHOOPTS) Debugging information is generated.$(nl)
- !else
- ECHOOPTS= $(ECHOOPTS) Debugging information is not generated.$(nl)
- !endif
- !if $d(BCC32I)
- ECHOOPTS= $(ECHOOPTS) Compiler: BCC32I (Intel).$(nl)
- !elif $(_32BIT_)==1
- ECHOOPTS= $(ECHOOPTS) Compiler: BCC32 (standard).$(nl)
- !else
- ECHOOPTS= $(ECHOOPTS) Compiler: BCC (standard).$(nl)
- !endif
- !if $d(ILINK)
- ECHOOPTS= $(ECHOOPTS) Linker: ILINK32 (incremental).$(nl)
- !elif $(_32BIT_)==1
- ECHOOPTS= $(ECHOOPTS) Linker: TLINK32 (standard).$(nl)
- !else
- ECHOOPTS= $(ECHOOPTS) Linker: TLINK (standard).$(nl)
- !endif
- !if $(CODEGUARD)==0
- ECHOOPTS= $(ECHOOPTS) No CodeGuard information generated.$(nl)
- !elif $(CODEGUARD)==1
- ECHOOPTS= $(ECHOOPTS) Basic CodeGuard information generated.$(nl)
- !else
- ECHOOPTS= $(ECHOOPTS) Full CodeGuard information generated.$(nl)
- !endif
- !if $d(USERINCPATH)
- ECHOOPTS= $(ECHOOPTS) User include path: $(USERINCPATH).$(nl)
- !endif
- !if $d(USERINCPATH)
- ECHOOPTS= $(ECHOOPTS) User lib path: $(USERLIBPATH).$(nl)
- !endif
- !if $d(USERLIBS)
- ECHOOPTS= $(ECHOOPTS) User libraries: $(USERLIBS).$(nl)
- !endif
-
- #
- $(MAKEFILE) :: makefile
- @type &&|
- $(ECHOOPTS)
- |
- @if exist $(MAKEFILE) del $(MAKEFILE)
- @rename &&%
- .autodepend
-
- all: $(CFGDLL) $(DLLALL) $(CFGEXE) $(LIBBIN) $(EXEALL) $(HLPBIN) $(TARGETS) $(CFGCLN)
- @echo SYSTEM=$(SYSTEM) MODEL=$(MODEL) DIAGS=$(DIAGS) DEBUG=$(DEBUG)
-
- #
- # Standard implicit rules
- #
- .rc.res:
- $(BRCC) -r -i$(INCLUDEPATH) $$<
- .cpp.obj:
- $(BCC) {$$< }
- .c.obj:
- $(BCC) {$$< }
- !ifdef HLP
- .hpj.hlp:
- $(HC) $$<
- !endif
-
- #
- # Dependencies
- #
- !ifdef HLP_
-
- $(HLPBIN) : $(HLP_)
- !endif
- !ifdef RESEXE_
-
- $(RESEXE) : $(RESEXE_)
- !endif
- !ifdef RESDLL_
-
- $(RESDLL) : $(RESDLL_)
- !endif
-
- #
- # DLL target - also makes import library
- #
- !ifdef DLL
-
- #
- # Generate compiler configuration file for DLL source files
- #
- !if "$(CFGDLL)" == "cfgdll"
- cfgdll:
- @copy &&|
- -I$(INCLUDEPATH)
- -c $(CFLAGSD)
- -w $(CDIAG) $(CPCHD) $(CCFDLL)
- | $(CFGFILE) >NUL
- !endif
-
- #
- # Link DLL and generate import library
- #
- $(DLLMAKE)
- !endif # $d(DLL)
-
- #
- # Generate compiler configuration file for EXE and LIB source files
- #
- !if ($d(EXE) || $d(LIBBIN)) && "$(CFGEXE)" == "cfgexe"
- cfgexe:
- @copy &&|
- -I$(INCLUDEPATH)
- -c $(CFLAGS)
- -w $(CDIAG) $(CPCH) $(CCFEXE)
- | $(CFGFILE) >NUL
- !endif
-
- #
- # LIBBIN target
- #
- !ifdef LIBBIN
-
- $(LIBBIN) : $(OBJLIB)
- @if exist $(LIBBIN) del $(LIBBIN)
- $(TLIB) $(LIBBIN) $(_LIBOBJ_)
- !endif
-
- #
- # EXE target
- #
- !ifdef EXE
- $(EXEMAKE)
- !endif
- !if "$(CFGCLN)" == "cfgcln"
- cfgcln:
- @del $(CFGFILE)
- !endif
- $(RULES)
- % $(MAKEFILE)
-
- #----------------------------------------------------------------------------
- # Generate model sentries, clean files of other models
- #----------------------------------------------------------------------------
-
- #
- # Generate model sentry, name contains model information
- #
- $(_SENTRY_):
- @if exist *.mod del *.mod
- -@type NUL >$(_SENTRY_) # ignore return code generated by some command shell
- !if $(NOCLEAN) != 0
- @echo Created model sentry: $(_SENTRY_), NOT deleting files of other models!
- !else
- @echo Created model sentry: $(_SENTRY_), Deleting files of other models...
- ! if $d(EXEBIN) && "EXEBIN" != "$(EXE).exe"
- @if exist $(EXEBIN) del $(EXEBIN) # in case extension not .exe
- ! endif
- ! ifdef LIBBIN
- @if exist $(LIBBIN) del $(LIBBIN) # only delete the target .lib
- ! endif
- ! ifdef DLLBIN
- @if exist $(DLLBIN) del $(DLLBIN) # only delete the target .dll
- ! endif
- @if exist *.obj del *.obj
- @if exist *.res del *.res
- !endif
-
- #----------------------------------------------------------------------------
- # Delete all generated files, leaving only source files and makefiles
- #----------------------------------------------------------------------------
- clean:
- @if exist *.mod del *.mod
- @if exist *.obj del *.obj
- @if exist *.exe del *.exe
- @if exist *.dll del *.dll
- @if exist *.hlp del *.hlp
- @if exist *.scr del *.scr
- @if exist *.res del *.res
- @if exist *.rws del *.rws
- @if exist *.lib del *.lib
- @if exist *.map del *.map
- @if exist *.csm del *.csm
- @if exist bcwdef.* del bcwdef.*
- @if exist *.dsw del *.dsw
- @if exist *.mbt del *.mbt
- @if exist *.mrt del *.mrt
- @if exist turboc.cfg del turboc.cfg
- @if exist bcc32.cfg del bcc32.cfg
- @if exist tlink.cfg del tlink.cfg
- @if exist tlink32.cfg del tlink32.cfg
- @if exist ilink32.cfg del ilink32.cfg
- @if exist *.td? del *.td? #debugger symbols & configs
- @if exist *.tr? del *.tr? #debugger restart
- @if exist WIN16*.mak del WIN16*.mak
- @if exist WIN32*.mak del WIN32*.mak
- @if exist DOS16*.mak del DOS16*.mak
- @if exist CON32*.mak del CON32*.mak
-