Главная страница | назад





Article #16639: How to rebuild the obsolete classlib libraries

 Question and Answer Database
FAQ1639C.txt How to rebuild the obsolete classlib libraries
Category :Command Line Tools
Platform :All
Product : BC++4.5x BC++5.x
Question:
How to rebuild the obsolete classlib libraries that ship
with BC++4.0x, BC++4.5X, and BC++5.0x.
Answer:
*NOTE: The make file that is found in the source\classlib
directory needs to be edited to allow for the rebuild to
include the obsolete classes.
add:
PFX=.PATH.cpo
to the Building various file lists portion of the make file.
change:
.cpo.obj:
$(BCC) $(WFLAG) -P {$& }
to:
.cpo.obj:
$(BCC) $(WFLAG) -P {$< }
found near the end of the file.
*NOTE This will only be needed in the BC++5,0x versions
The commad line for rebuilding the libraries is:
make -B -r -DDOS -DMODEL=x -DNAME=xxxxxx -DOBJECTS
*NOTE replace 'x' with the memory model, and the file name
for the library you wish to build.
This is a full listing of the makefile
#--------------------------------------------------------------------------#
# #
# MAKEFILE for Class Libraries #
# #
# Copyright (c) Borland International 1991, 1994 #
# All Rights Reserved #
# #
# Usage: #
# #
# maker options #
# #
# Options: #
# #
# -DDOS, -DWIN32, -DOS2 Specifies target system #
# #
# -DMT Build multi-thread version #
# #
# -DMODEL=x Specifies memory model for DOS library. #
# Required when building DOS library. #
# Must be s, c, m, l, or h. #
# #
# -DNAME=xxx Base name of the target library or DLL #
# Always required. #
# #
# -DSUFFIX=xxx Suffix to add to the base name when #
# building a DLL. For example, -DSUFFIX=d is #
# used when building the DBG DLLs. This puts #
# 'd' into the name of the dll and the name #
# of the import library. #
# #
# -DDLL Build a DLL. #
# #
# -DDBG Build the debugging version of the target. #
# #
# -DOBJECTS Also build the object-based containers #
# #
# -DBIDSFARVTABLE moves class vtables out of dgroup #
# #
# 16-bit non-diagnostic static libraries: #
# make -r -DDOS -DMODEL=s -DNAME=bidss #
# make -r -DDOS -DMODEL=c -DNAME=bidsc #
# make -r -DDOS -DMODEL=m -DNAME=bidsm #
# make -r -DDOS -DMODEL=l -DNAME=bidsl #
# make -r -DDOS -DMODEL=h -DNAME=bidsh #
# #
# 16-bit diagnostic static libraries: #
# make -r -DDOS -DMODEL=s -DDBG -DNAME=bidsdbs #
# make -r -DDOS -DMODEL=c -DDBG -DNAME=bidsdbc #
# make -r -DDOS -DMODEL=m -DDBG -DNAME=bidsdbm #
# make -r -DDOS -DMODEL=l -DDBG -DNAME=bidsdbl #
# make -r -DDOS -DMODEL=h -DDBG -DNAME=bidsdbh #
# #
# 16-bit DLLs: #
# make -r -DDOS -DDLL -DNAME=bids #
# make -r -DDOS -DDLL -DDBG -DNAME=bids -DSUFFIX=d #
# #
# WIN32 libraries: #
# make -r -DWIN32 -DNAME=bidsf #
# make -r -DWIN32 -DDBG -DNAME=bidsdf #
# #
# WIN32 DLLs: #
# make -r -DWIN32 -DDLL -DNAME=bids -DSUFFIX=f #
# make -r -DWIN32 -DDLL -DDBG -DNAME=bids -DSUFFIX=df #
# #
# OS/2 libraries: #
# make -r -DOS2 -DNAME=bids2 #
# make -r -DOS2 -DDBG -DNAME=bidsdb2 #
# #
# OS/2 DLLs: #
# make -r -DOS2 -DDLL -DNAME=bids -DSUFFIX=2 #
# make -r -DOS2 -DDLL -DDBG -DNAME=bids -DSUFFIX=d2 #
# #
#--------------------------------------------------------------------------#
.autodepend
.swap
!if !$d(DOS) && !$d(WIN32) && !$d(OS2)
!error Must specify target system DOS, WIN32, or OS2
!endif
!if $d(DOS) && !($d(MODEL) || $d(DLL))
!error When building DOS libraries, must specify MODEL or DLL
!endif
!if $d(MODEL) && ($d(OS2) || $d(WIN32))
!error When building OS2 or WIN32 libraries, cannot specify MODEL
!endif
!if $d(DLL) && !$d(NAME)
!error Must specify a NAME for a DLL.
!endif
!if $d(DOS) && $d(MT)
!error Cannot build multi-thread library for DOS.
!endif
!if $d(MODEL)
!if $(MODEL)!=s && $(MODEL)!=c && $(MODEL)!=m && $(MODEL)!=l && $(MODEL)!=h
!Error MODEL must be s, c, m, l, or h
!endif
!endif
#--------------------------------------------------------------------#
# #
# Set up the names of the tools to be used. If these macros have #
# already been defined in the environment, use those definitions. #
# #
# BCC is the compiler. #
# MAKE is make. #
# TLIB is the librarian. #
# TLINK is the linker. #
# #
#--------------------------------------------------------------------#
!if !$d(BCC)
!if $d(WIN32)
BCC = bcc32 +turboc.cfg -v- -x
!elif $d(OS2)
BCC = bcc
!else
BCC = bcc -2- -x
!endif
!endif
!if !$d(MAKE)
!if $d(WIN32)
MAKE = maker
!else
MAKE = make
!endif
!endif
!if !$d(TLIB)
!if $d(WIN32)
TLIB = tlib /C
!else
TLIB = tlib /C
!endif
!endif
!if !$d(TLINK)
!if $d(WIN32)
TLINK = tlink32
!else
TLINK = tlink
!endif
!endif
!if !$d(BRCC)
!if $d(WIN32)
BRCC = brcc32 -dWIN32
!else
BRCC = brcc
!endif
!endif
#--------------------------------------------------------------------#
# #
# Set up options for the various tools #
# #
# WFLAG does some magic to produce a library that works for both #
# DOS and Windows. #
# #
# WLFLAG is a variation of WFLAG for the implib objs #
# #
# DFLAG contains the debugging switches that will be passed to the #
# compiler through the .CFG file. #
# #
# LFLAG contains the switches that will be passed to TLIB on the #
# command line. #
# #
# XFLAG handles _RTLDLL, which is passed to the compiler in the #
# .CFG file and determines whether classes are to be exported. #
# It also handle far vtable options when they are enabled. #
# #
# LINKOPTS is the list of options for the linker. #
# #
#--------------------------------------------------------------------#
!if $d(DOS) && $d(DLL)
WFLAG = -WDE -xc
WLFLAG = -Y
!elif $d(DOS) && ($(MODEL) == s || $(MODEL) == c )
WFLAG = -WE
!elif $d(DOS) && ($(MODEL) == m || $(MODEL) == l)
WFLAG = -Y
!endif
!if $d(MT)
!if $d(OS2)
MTFLAG = -sm
!else
MTFLAG = -WM
!endif
!endif
!if $d(DBG)
DFLAG = -v- -D__DEBUG=2 -D__WARN -D__TRACE
LFLAG = /0
!else
DFLAG = -v- -D__DEBUG=0
LFLAG = /0
!endif
!if $d(DLL)
XFLAG = -D_RTLDLL -D_BUILDBIDSDLL
!endif
!if $d(BIDSFARVTABLE)
XFLAG = $(XFLAG) -D_BIDSFARVTABLE #;_RTLFARVTABLE if RTL is rebuilt too
!endif
!if $d(DOS)
!if $d(DLL)
MFLAG = -ml
!else
MFLAG = -m$(MODEL)
!endif
!endif
!if $d(DOS)
LINKOPTS = /C/c/s/Twd/Oc/Oi/Oa/Or
!elif $d(OS2)
LINKOPTS = /c/s/Tod
!elif $d(WIN32)
LINKOPTS = /c/s/Tpd
!endif
!if $d(DLL)
DEFFILE=deffile
!endif
#--------------------------------------------------------------------#
# #
# Build the macros to provide the startup code and library names #
# for building DLLs. #
# #
# STARTUP is the startup code. #
# #
# LINKLIBS is the list of libraries. #
# #
#--------------------------------------------------------------------#
!if !$d(DLL)
TARGETLIB = $(NAME)
!else
VER = 45
!if $d(DLL) && $d(WIN32) && $d(DBG)
TARGETFILE = bds$(VER)$(SUFFIX) # name is too long if we use 'bids'
!else
TARGETFILE = $(NAME)$(VER)$(SUFFIX)
!endif
TARGETLIB = $(NAME)$(SUFFIX)i.lib
!if $d(DOS)
STARTUP = $(LIB)\c0dl.obj
LINKLIBS = $(LIB)\import.lib $(LIB)\crtldll.lib
!elif $d(OS2)
STARTUP = $(LIB)\c02d.obj
!if $d(MT)
LINKLIBS = $(LIB)\c2mti.lib $(LIB)\os2.lib
!else
LINKLIBS = $(LIB)\c2i.lib $(LIB)\os2.lib
!endif
!else
STARTUP = $(LIB)\c0d32.obj
!if $d(MT)
LINKLIBS = $(LIB)\cw32mti.lib $(LIB)\import32.lib
!else
LINKLIBS = $(LIB)\cw32i.lib $(LIB)\import32.lib
!endif
!endif
!endif
#--------------------------------------------------------------------#
# #
# OBJDIRLIST is the list of subdirectories under the OBJ directory #
# #
# This is used by dirs to be sure all the subdirectories are #
# present and by clean to remove all OBJ files #
# #
#--------------------------------------------------------------------#
!if $d(DOS)
OBJDIRLIST = s ds c dc m dm l dl h dh i di
!endif
!if $d(WIN32)
OBJDIRLIST = 32 d32 i32 di32
!endif
!if $d(OS2)
OBJDIRLIST = 2 d2 i2 di2
!endif
#--------------------------------------------------------------------#
# #
# Set up the paths that will be needed later. #
# #
# INCLUDE is the full path to the compiler's include files and #
# to the classlib's include files. If it is not defined in the #
# environment, it is assumed to be under the directory where the #
# compiler was installed in the subdirectory INCLUDE. #
# #
# LIB is the full path to the compiler's libraries. If it is not #
# defined in the environment, it is assumed to be under the #
# directory where the compiler was installed in the subdirectory #
# LIB. #
# #
# SOURCEDIR is the full path to the source code. If it is not #
# defined in the environment, it is assumed to be under the #
# directory where the compiler was installed in the subdirectory #
# SOURCE\CLASSLIB. #
# #
# ROOTDIR is the full path to the directory in which the makefile #
# is located. If it is not defined in the environment, it is #
# assumed to be the same as SOURCEDIR. #
# #
# LIBDIR is the full path to the directory in which the libraries #
# should be placed when they are built. If it is not defined in #
# the environment, it is assumed to be the same as the directory #
# specified by LIB. #
# #
#--------------------------------------------------------------------#
!if !$d(BCROOT)
!if $d(OS2)
BCROOT=$(MAKEDIR)\..
!else
!include $(MAKEDIR)\bcroot.inc
!endif
!endif
!if !$d(INCLUDE)
INCLUDE = $(BCROOT)\include
!endif
!if !$d(RCINCLUDE)
RCINCLUDE = $(BCROOT)\include
!endif
!if !$d(LIB)
LIB = $(BCROOT)\lib
!endif
!if !$d(SOURCEDIR)
SOURCEDIR = $(BCROOT)\source\classlib
!endif
!if !$d(LIBDIR)
LIBDIR = $(LIB)
!endif
!if !$d(ROOTDIR)
ROOTDIR = $(SOURCEDIR)
!endif
#--------------------------------------------------------------------#
# #
# Set up the various paths that MAKE will use #
# #
# OBJDIR will only have been defined when we've decide on a target #
# platform and a set of options. Since .PATH.obj isn't used in any #
# context in which DBG and SUFFIX haven't been defined, it's ok #
# to use DBG and SUFFIX to define it. #
# #
#--------------------------------------------------------------------#
.PATH.cpp = $(SOURCEDIR)
.PATH.cpo = $(SOURCEDIR)\obsolete
.PATH.lib = $(LIBDIR)
.PATH.rc = $(SOURCEDIR)
!if $d(DOS)
OBJDIR=$(MODEL)
!elif $d(OS2)
OBJDIR=2
!else
OBJDIR=32
!endif
!if $d(DLL)
OBJDIR=i$(OBJDIR)
!endif
!if $d(DBG)
.PATH.obj = $(SOURCEDIR)\d$(OBJDIR)
!else
.PATH.obj = $(SOURCEDIR)\$(OBJDIR)
!endif
#--------------------------------------------------------------------#
# #
# Build the various file lists needed for dependency checking, #
# and LIBing. #
# #
# OBJS is the main list, conditionalized for the various targets #
# and options. #
# #
# OBJS_LIB are the objs that only go in libs & implib, not the dll #
# #
# OBJS_DLL are the objs that only go in the dll, not the libs #
# #
# DEPOBJS is the list of object files for dependency checking #
# #
# LIBOBJS is the list of object files for building the library #
# #
#--------------------------------------------------------------------#
!if $d(OBJECTS)
PFX=.PATH.cpo
OBJS = \
PFXassoc.obj \
PFXbtree.obj \
PFXbtreeinn.obj \
PFXbtreelfn.obj \
PFXcollect.obj \
PFXcontain.obj \
PFXdbllist.obj \
PFXhashtbl.obj \
PFXldate.obj \
PFXlist.obj \
PFXltime.obj \
PFXobject.obj
!endif
OBJS = $(OBJS) \
PFXbinimp.obj \
PFXcastable.obj \
PFXdate.obj \
PFXdateio.obj \
PFXdatep.obj \
PFXfile.obj \
PFXheapsel.obj \
PFXobjstrm.obj \
PFXtime.obj \
PFXtimep.obj \
PFXtimeio.obj \
PFXversion.obj
!if !$d(OS2)
OBJS = $(OBJS) \
PFXexbase.obj \
PFXgeometry.obj \
PFXgeomstrm.obj \
PFXreglink.obj
!endif
OBJS_LIB = \
PFXlocale.obj \
PFXlocaleco.obj \
PFXlocaleid.obj \
PFXregheap.obj \
PFXustring.obj
OBJS_DLL =
!if $d(DOS) && !$d(DLL)
OBJS = $(OBJS) PFXtimer.obj
!endif
!if $d(WIN32) || $d(OS2)
OBJS = $(OBJS) PFXthread.obj
!endif
!if $d(OBJECTS)
!if $d(TEMPLATES)
OBJS = $(OBJS) \
PFXbabstary.obj \
PFXbdict.obj \
PFXbsortary.obj
!else
OBJS = $(OBJS) \
PFXabstarry.obj \
PFXarray.obj \
PFXdeque.obj \
PFXdict.obj \
PFXsortarry.obj \
PFXstack.obj
!endif
!endif
!if $d(DLL) && $(DOS)
OBJS = $(OBJS) PFXclasmain.obj
!endif
!if $d(DLL) && $d(OBJECTS)
!if $d(TEMPLATES)
OBJS = $(OBJS) PFXtmpl2.obj
!else
OBJS = $(OBJS) PFXtmpl1.obj
!endif
!endif
!if $d(DLL) && !$d(OBJECTS) && !$d(OS2)
RESFILE = version.res
!endif
#PFXOBJS = $(OBJS:SFX=)
#SFXOBJS = $(OBJS:PFX=)
DEPOBJS = $(OBJS:PFX=) $(OBJS_LIB:PFX=) $(OBJS_DLL:PFX=)
!if $d(DLL)
LIBOBJS = $(OBJS_LIB:PFX=+)
LINKOBJS = $(OBJS:PFX=) $(OBJS_DLL:PFX=)
!else
LIBOBJS = $(OBJS:PFX=-+) $(OBJS_LIB:PFX=-+)
!endif
#--------------------------------------------------------------------#
# #
# These are the targets that we can make. #
# #
# target: builds the target file #
# #
# dirs: makes sure all the necessary subdirectories are present #
# #
# clean: deletes the .OBJ files #
# #
# config: builds a .CFG file with the correct flags #
# #
#--------------------------------------------------------------------#
target: config $(DEFFILE) $(DEPOBJS) $(RESFILE)
!if !$d(DLL)
cd $(.PATH.obj)
$(TLIB) $(LFLAG) $(.PATH.lib)\$(TARGETLIB) @&&!
$(LIBOBJS)
!
cd $(ROOTDIR)
!else
cd $(.PATH.obj)
$(TLINK) @&&!
$(STARTUP)+
$(LINKOBJS)
$(TARGETFILE).dll
$(LINKOPTS) $(.PATH.lib)\$(TARGETFILE).map
$(LINKLIBS)
temp.def
$(RESFILE)
!
!if $(TARGET) == DOS
rc -30 $(TARGETFILE)
!endif
implib $(TARGETLIB) $(TARGETFILE).dll
tlib $(LFLAG) $(TARGETLIB) @&&|
$(LIBOBJS)
|
cd $(ROOTDIR)
copy $(.PATH.obj)\$(TARGETFILE).dll $(.PATH.lib)
del $(.PATH.obj)\$(TARGETFILE).dll
copy $(.PATH.obj)\$(TARGETLIB) $(.PATH.lib)
del $(.PATH.obj)\$(TARGETLIB)
!endif
dirs:
-for %d in ($(OBJDIRLIST)) do md $(SOURCEDIR)\%d
clean:
-for %d in ($(OBJDIRLIST)) do del $(SOURCEDIR)\%d\*.obj
config:
@-if not exist $(.PATH.obj)\..\NUL md $(.PATH.obj)\..
@-if not exist $(.PATH.obj)\NUL md $(.PATH.obj)
@type &&!
-c -n$(.PATH.obj) -I$(INCLUDE) $(DFLAG) $(XFLAG) $(MFLAG) $(TFLAG)
!>turboc.cfg
deffile:
!if $d(DOS)
@echo>$(.PATH.obj)\temp.def LIBRARY $(TARGETFILE)
!else
@echo>$(.PATH.obj)\temp.def LIBRARY $(TARGETFILE) INITINSTANCE
!endif
@echo>>$(.PATH.obj)\temp.def DESCRIPTION 'Parametrized Class Library for BC++'
!if $d(DOS)
@echo>>$(.PATH.obj)\temp.def EXETYPE WINDOWS
@echo>>$(.PATH.obj)\temp.def CODE PRELOAD MOVEABLE DISCARDABLE
@echo>>$(.PATH.obj)\temp.def DATA PRELOAD MOVEABLE SINGLE
!else
@echo>>$(.PATH.obj)\temp.def DATA MULTIPLE NONSHARED
!endif
@echo>>$(.PATH.obj)\temp.def HEAPSIZE 4096
#--------------------------------------------------------------------#
# #
# We need an implicit rule for building .OBJ files, and a few #
# explicit rules for special cases. #
# #
# TIMER.OBJ is never built for windows, so doesn't need the #
# windows flags. #
# #
#--------------------------------------------------------------------#
timer.obj: timer.cpp
$(BCC) $(SOURCEDIR)\timer
tmpl1.obj: tmplinst.cpp
$(BCC) -o$(.PATH.obj)\tmpl1.obj $(WFLAG) $(.PATH.cpp)\tmplinst
tmpl2.obj: tmplinst.cpp
$(BCC) -o$(.PATH.obj)\tmpl2.obj -DTEMPLATES $(WFLAG) $(.PATH.cpp)\tmplinst
.cpo.obj:
$(BCC) $(WFLAG) -P {$< }
.cpp.obj:
$(BCC) $(WFLAG) $(MTFLAG) {$* }
.rc.res:
$(BRCC) -i$(RCINCLUDE) $*.rc
copy $*.res $(.PATH.obj)
del $*.res
!if $d(DOS) && $d(DLL)
$(OBJS_LIB:PFX=):
$(BCC) $(WLFLAG) $(MTFLAG) -D_BIDSDLL -U_BUILDBIDSDLL $(.PATH.cpp)\$&.cpp
!endif
7/2/98 10:32:32 AM

Last Modified: 01-SEP-99