home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World Komputer 1998 May
/
Pcwk5b98.iso
/
Borland
/
Cplus45
/
BC45
/
BCEXAMS.PAK
/
MAKEFILE.GEN
< prev
next >
Wrap
Text File
|
1995-08-29
|
26KB
|
921 lines
#-----------------------------------------------------------------------------
# (C) Copyright 1993 by Borland International
# $(BCEXAMPLEDIR)\makefile.gen
# 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=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
#
# 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)
#
# Define RTLFIRST to force the RTL library before all other libraries
#
#-----------------------------------------------------------------------------
#-----------------------------------------------------------------------------
# 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_:|=)
#-----------------------------------------------------------------------------
# directory & search paths
#-----------------------------------------------------------------------------
!ifndef BCBINDIR
! ifdef BCROOT
BCBINDIR = $(BCROOT)\bin
! else
BCBINDIR = $(MAKEDIR)
! endif
!endif
!ifndef BCROOT
BCROOT = $(MAKEDIR)\..
!endif
!ifndef BCINCDIR
BCINCDIR = $(BCROOT)\include
!endif
!ifndef BCLIBDIR
BCLIBDIR = $(BCROOT)\lib
!endif
!ifdef USERLIBPATH
LIBRARYPATH = -L$(USERLIBPATH)$(sp)
!endif
!ifdef SYSINCPATH
_SYSINCPATH_ = $(SYSINCPATH);
!endif
!ifdef USERINCPATH
INCLUDEPATH = $(USERINCPATH);$(_SYSINCPATH_)$(BCINCDIR)
!else
INCLUDEPATH = $(_SYSINCPATH_)$(BCINCDIR)
!endif
#----------------------------------------------------------------------------
# validate or select target operating system
#----------------------------------------------------------------------------
!ifndef SYSTEMS
SYSTEMS = WIN16 DOS16 WIN32 CON32
!endif
!ifndef SYSTEM
! if $d(WIN32) || "$(MODEL)"=="f"
SYSTEM = WIN32
! elif $d(CON32)
SYSTEM = CON32
! elif $d(WIN16)
SYSTEM = WIN16
! elif $d(DOS16)
SYSTEM = DOS16
! else #default
SYSTEM = WIN16
! endif
!endif
_SYSTEMS_ = " $(SYSTEMS) "
_SYSTEMX_ = |$(SYSTEM)|
_SYSTEM_ = $(_SYSTEMX_:|= )
!if $(_SYSTEMS_:$(_SYSTEM_)=)==$(_SYSTEMS_)
! error $(SYSTEM) system not supported
!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
#----------------------------------------------------------------------------
# validate or select compiler/library model
#----------------------------------------------------------------------------
# set allowable models for each platform
#
!if $(_32BIT_)
_MODELS_ = dfx
!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 $(_GUI_)
MODEL = f #WIN32
! else
MODEL = f #CON32
! endif
! elif $(_GUI_)
MODEL = d #WIN16
! else
MODEL = s #DOS16
! endif
!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
! elif $(MODEL)==m
ERRSTR=Medium
! elif $(MODEL)==c
ERRSTR=Compact
! elif $(MODEL)==l
ERRSTR=Large
! elif $(MODEL)==h
ERRSTR=Huge
! elif $(MODEL)==d
ERRSTR=DLL
! elif $(MODEL)==f
ERRSTR=Static
! elif $(MODEL)==x
ERRSTR=ExternalDLL
!endif
# Use message to get everything on one line without path interfering
! message !! $(ERRSTR) model, $(SYSTEM) is not supported for this program
! message !! 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 = 8192
!endif
!ifndef HEAPSIZE #used for 16-bit only
! ifdef USEDLL
HEAPSIZE = 1024
! 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
#----------------------------------------------------------------------------
!if $(_32BIT_)
STDDLIBS = $(BCLIBDIR)\import32 $(BCLIBDIR)\cw32i
C0D = $(BCLIBDIR)\c0d32
! if $(_GUI_)
_SYSCODE_ = n
C0 = $(BCLIBDIR)\c0w32
! else #CON32
C0 = $(BCLIBDIR)\c0x32
_SYSCODE_ = c
! endif
! ifdef USEDLL
STDLIBS = $(STDDLIBS)
! else
STDLIBS = $(BCLIBDIR)\import32 $(BCLIBDIR)\cw32
! endif
!elif $(_GUI_) #WIN16
C0 = $(BCLIBDIR)\c0w$(_MODEL_)
C0D = $(BCLIBDIR)\c0d$(DMODEL)
STDDLIBS=$(BCLIBDIR)\import $(BCLIBDIR)\crtldll
! ifdef USEDLL
STDLIBS = $(STDDLIBS)
! else
! ifdef RTLFIRST
_RTLFIRST_ = $(BCLIBDIR)\cw$(_MODEL_)$(sp)
STDLIBS =$(BCLIBDIR)\import $(BCLIBDIR)\mathw$(_MODEL_)
! else
STDLIBS =$(BCLIBDIR)\import $(BCLIBDIR)\mathw$(_MODEL_) $(BCLIBDIR)\cw$(_MODEL_)
! endif #RTLFIRST
! endif
! if $d(FASTTHIS)
SYSTEM = WIN16F
_SYSCODE_ = f
! elif $d(PASCAL)
SYSTEM = WIN16P
_SYSCODE_ = p
!else
SYSTEM = WIN16
_SYSCODE_ = w
! 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
#
_MODELNAME_ = $(SYSTEM)$(MODEL)$(DIAGS)$(DEBUG)
#----------------------------------------------------------------------------
# tools and options for 32bit Windows and console apps
#----------------------------------------------------------------------------
!if $(_32BIT_)
BCC = $(BCBINDIR)\bcc32.exe
BRCC = $(BCBINDIR)\brcc32.exe
TLINK = $(BCBINDIR)\tlink32.exe
!if $(DEBUG)
COPTS = -$(CPUOPT) -d -k -Od -v
!else
COPTS = -$(CPUOPT) -d -k-
!endif
CFGFILE = bcc32.cfg
!ifdef USEDLL
CFLAGS = -W -D_RTLDLL $(COPTS)
CFLAGSD = -WDE -D_RTLDLL $(COPTS) # building DLL's
!else # using DLL libraries
CFLAGS = -W $(COPTS)
CFLAGSD = -WDE $(COPTS) # building DLL's
!endif # using static libraries
!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
#----------------------------------------------------------------------------
# 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 = -WS -D_RTLDLL $(COPTS) -m$(_MODEL_) $(_CENTRY_)
CFLAGSD = -WD -xc -D_RTLDLL $(COPTS) -m$(DMODEL) $(_CENTRY_) # building DLLs
LFLAGS = -Tw -c -C -A=16 -Oc -Oi -Oa -Or $(LDBG)
!elif $(_GUI_) # using static libraries
CFLAGS = -WSE $(COPTS) -m$(_MODEL_) $(_CENTRY_)
CFLAGSD = -WDE -xc $(COPTS) -m$(DMODEL) $(_CENTRY_) # building DLLs
LFLAGS = -Tw -c -C -A=16 -Oc -Oi -Oa -Or $(LDBG)
!else # using 16-bit DOS
CFLAGS = $(COPTS) -m$(_MODEL_) $(_CENTRY_)
LFLAGS = -c -C -A=16 $(LDBG)
!endif
LFLAGSD = -Twd -c -C -A=16 -Oc -Oi -Oa -Or $(LDBG)
!endif #if/else $(_32BIT_)
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) $(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) $(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
#----------------------------------------------------------------------------
$(MAKEFILE) :: makefile
@echo Generating $(MAKEFILE), SYSTEM=$(SYSTEM) MODEL=$(MODEL) DIAGS=$(DIAGS) DEBUG=$(DEBUG)
@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 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 *.tds del *.tds #debugger symbols
@if exist *.td2 del *.td2 #debugger config
@if exist *.tdw del *.tdw #debugger config
@if exist *.td del *.td #debugger config
@if exist *.tr? del *.tr? #debugger config
@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