home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1998 May / Pcwk5b98.iso / Borland / Cplus45 / BC45 / OCFSRC.PAK / MAKEFILE < prev    next >
Text File  |  1995-08-29  |  10KB  |  362 lines

  1. # $Header:   N:\admin\ocf\source\makefile.__v   2.0.1.0   10 Apr 1995 18:05:12   CQUINN  $
  2. #-----------------------------------------------------------------------------
  3. # ObjectComponents - (C) Copyright 1991, 1993 by Borland International
  4. #
  5. # MAKEFILE for ObjectComponents Framework
  6. #
  7. # Defines:
  8. #   MODEL=<d|s|m|l|f>   one of: dll(default), small, medium, large or flat
  9. #   WIN32        enables win32 static (flat) or DLL
  10. #   DIAGS        enables runtime diagnostic lib (adds 'd' to lib name before 'w')
  11. #   DEBUG        enables debug info for TDW & TD32
  12. #   NOPCH        disables precompiled headers for OCF
  13. #   NAME=Xxx     lib & DLL name base, Defaults to 'OCF'. Req. for non-diag DLLs
  14. #   VERSION=nnn  version for OCF DLL. Defaults to 250. Req. for non-diag DLLs
  15. #   USERDLL      builds OCF for use in a user DLL (adds 'u' to lib name after model)
  16. #
  17. # Define these for alternate OCF build directories:
  18. #   OCFSRCDIR    defaults to: $(BCROOT)\source\OCF
  19. #   OCFINCDIR    defaults to: $(BCROOT)\include
  20. #   OCFLIBDIR    defaults to: $(BCROOT)\lib
  21. #   OCFBINDIR    defaults to: $(BCROOT)\bin
  22. #
  23. #-----------------------------------------------------------------------------
  24.  
  25. .autodepend
  26. .cacheautodepend
  27. .swap
  28.  
  29. #--------------------------------------------------------------------
  30. # fill in defaults
  31. #--------------------------------------------------------------------
  32. !if $(MODEL) == d
  33.   DLL = 1
  34. !endif
  35. !if $(MODEL) == f
  36.   WIN32 = 1
  37. !endif
  38. !if $d(WIN32)
  39.   MODEL = f
  40. !elif $d(DLL) || !$d(MODEL)
  41.   MODEL = l
  42. !endif
  43.  
  44. #--------------------------------------------------------------------
  45. # dir & name components
  46. #--------------------------------------------------------------------
  47. !if $d(DLL)
  48.  
  49. ! if $d(WIN32)
  50.     KEY = fi                  # 32bit DLL import library
  51. ! else
  52.     KEY = i                   # 16bit DLL import library
  53. ! endif
  54.   KEY = w$(KEY)
  55.  
  56. !else
  57.  
  58. KEY = w$(MODEL)                 # Static library
  59.  
  60. !endif  # if/else $d(DLL)
  61.  
  62. ! if $d(USERDLL)
  63.   KEY = $(KEY)u                 # Static or import library for use by dlls
  64. ! endif
  65.  
  66. !if !$d(NAME)
  67.   NAME=ocf
  68. ! if !$d(VERSION)
  69.     VERSION=250  #//CQ is this right?  or 1.00?
  70. ! endif
  71. !endif
  72.  
  73. #--------------------------------------------------------------------
  74. # debug & diagnostic flags
  75. #--------------------------------------------------------------------
  76. !if $d(DEBUG)
  77.   CDBG = -v -k -Od    # debug-info on, normal stack, no optimizations
  78. !endif
  79. !if 1 || $d(DEBUG)    # Leave public debug info in dll & strip to a .tds after
  80. ! if $d(WIN32)
  81.     LDBG = -v
  82. ! else
  83.     LDBG = -v -Vt
  84. ! endif
  85. !endif
  86.  
  87. !if $d(DIAGS)         # default diags use precondition, check, trace & warn
  88.   __DEBUG=2
  89.   __TRACE=1
  90.   __WARN=1
  91.   BD=d                # Use Bids Diag version when OCF lib is diag
  92.   OD=d                # OCF libs & dll get a 'd' for Diag versions
  93. !endif
  94.  
  95. #
  96. # Build up compiler diag switches based on settings
  97. #
  98. !if $d(__DEBUG)
  99.   CDIAG = -D__DEBUG=$(__DEBUG)
  100. !endif
  101. !if $d(__TRACE)
  102.   CDIAG = $(CDIAG) -D__TRACE
  103. !endif
  104. !if $d(__WARN)
  105.   CDIAG = $(CDIAG) -D__WARN
  106. !endif
  107.  
  108. #--------------------------------------------------------------------
  109. # dir & search paths, & precompiled headers
  110. #--------------------------------------------------------------------
  111.  
  112. #
  113. # BC tools BCBINDIR can be based on MAKEDIR if no BCROOT is defined
  114. #
  115. !if $d(BCROOT)
  116.   BCBINDIR = $(BCROOT)\bin
  117. !else
  118.   BCBINDIR = $(MAKEDIR)
  119. !endif
  120.  
  121. #
  122. # default bcroot to whatever is in bcroot.inc
  123. #
  124. !if !$d(BCROOT)
  125.   #BCROOT = $(MAKEDIR)\..
  126.   !include $(MAKEDIR)\bcroot.inc
  127. !endif
  128.  
  129. #
  130. # Where to find OCF dirs-- can set these for special layouts
  131. #
  132. !if !$d(OCFSRCDIR)
  133.   OCFSRCDIR = $(BCROOT)\source\ocf
  134. !endif
  135.  
  136. !if !$d(OCFINCDIR)
  137.   OCFINCDIR = $(BCROOT)\include
  138. !endif
  139.  
  140. !if !$d(OCFLIBDIR)
  141.   OCFLIBDIR = $(BCROOT)\lib
  142. !endif
  143.  
  144. !if !$d(OCFBINDIR)
  145.   OCFBINDIR = $(BCROOT)\bin
  146. !endif
  147.  
  148. #
  149. # Where to find BC tools, libraries and include files
  150. #
  151. BCINCDIR = $(BCROOT)\include
  152. BCLIBDIR = $(BCROOT)\lib
  153.  
  154. #
  155. # Build search paths differently if OCF include dir is not below BC's
  156. #
  157. !if "$(OCFINCDIR)" == "$(BCINCDIR)"
  158.   INCLUDE       = .;$(BCINCDIR);$(BCINCDIR)\ocf
  159.   RCINCLUDEPATH = -i$(BCINCDIR)
  160. !else
  161.   INCLUDE       = .;$(OCFINCDIR);$(OCFINCDIR)\ocf;$(BCINCDIR)
  162.   RCINCLUDEPATH = -i$(OCFINCDIR) -i$(BCINCDIR)
  163. !endif
  164.  
  165. OCFOBJDIR = $(OCFSRCDIR)\object\$(OD)$(KEY)    # Keep seperate diag/nondiag dirs
  166.  
  167. .PATH.obj = $(OCFOBJDIR)
  168. .PATH.res = $(OCFOBJDIR)
  169. .PATH.def = $(OCFOBJDIR)
  170. .PATH.lib = $(OCFLIBDIR)
  171. .PATH.cpp = $(OCFSRCDIR)
  172.  
  173. #
  174. # Define this to enable the use of Precompiled headers when building OCF
  175. #
  176. !if !$d(NOPCH)
  177.   CPCH= -H=$(OCFLIBDIR)\$(NAME)$(OD)$(KEY).csm -H"ocf/ocfpch.h" -D_OCFPCH
  178. ! if $d(WIN32)
  179.   CPCH= $(CPCH) -Hc
  180. ! endif
  181. !endif
  182.  
  183. #--------------------------------------------------------------------
  184. # library names
  185. #--------------------------------------------------------------------
  186. OCFLIB = $(OCFLIBDIR)\$(NAME)$(OD)$(KEY).lib
  187.  
  188. #--------------------------------------------------------------------
  189. # tools and options for 32bit
  190. #--------------------------------------------------------------------
  191. !if $d(WIN32)
  192.   BCC      = $(BCBINDIR)\bcc32       # Compiler
  193.   BRCC     = brcc32                  # Resource compiler
  194.   BCCASM   = $(BCBINDIR)\tasm32      # Assembler
  195.   TLINK    = $(BCBINDIR)\tlink32     # Linker
  196.   TLIB     = $(BCBINDIR)\tlib        # Librarian
  197.   IMPLIB   = $(BCBINDIR)\implib      # Import library generator
  198.   TDSTRIP  = $(BCBINDIR)\tdstrp32    # Debug info extractor
  199.  
  200.   COPTS    = -d -k- -O1gmpv        # Optimizations
  201.   CFGFILE  = bcc32.cfg               # Name of compiler's config file
  202. ! if $d(DEBUG)
  203.     TLIBOPTS = /P512
  204. ! else
  205.     TLIBOPTS = /P32 /0
  206. ! endif
  207.  
  208. ! if $d(DLL)
  209.     CWIN = -WDE -D_BUILDOCFDLL
  210.     LFLAGS   = $(LDBG) -Tpd -aa -s -c
  211. !   if !$d(BIDSILIB)
  212.       BIDSILIB = bids$(BD)fi
  213. !   endif
  214.     STDLIBS  = import32 cw32i    # Libs for linking the OCF DLL
  215.  
  216. ! else
  217.     CWIN = -W
  218. ! endif
  219.  
  220. #--------------------------------------------------------------------
  221. # tools and options for 16bit
  222. #--------------------------------------------------------------------
  223. !else
  224.   BCC      = $(BCBINDIR)\bcc         # Compiler
  225.   BRCC     = brcc                    # Resource compiler
  226.   BCCASM   = $(BCBINDIR)\tasm        # Assembler
  227.   TLINK    = $(BCBINDIR)\tlink       # Linker
  228.   TLIB     = $(BCBINDIR)\tlib        # Librarian
  229.  
  230.   # implib needs -o switch in 16 bit for compatibility
  231.   IMPLIB   = $(BCBINDIR)\implib -o   # Import library generator
  232.   TDSTRIP  = $(BCBINDIR)\tdstrip     # Debug info extractor
  233.  
  234.   CMDL     = -m$(MODEL)
  235.   COPTS    = -3 -d -k- -O1gmpv     # Optimizations
  236.  
  237. ! if $(MODEL) != s && $(MODEL) != m  # Large models can put strs in code seg
  238.     COPTS = $(COPTS) -dc
  239. ! endif
  240. ! if $d(NO_CPP_EXCEPTIONS)
  241.     COPTS = $(COPTS) -DNO_CPP_EXCEPTIONS -x-
  242. ! endif
  243.   CFGFILE = turboc.cfg
  244.  
  245. ! if $d(DEBUG)
  246.     TLIBOPTS = /P512
  247. ! else
  248.     TLIBOPTS = /P32 /0
  249. ! endif
  250.  
  251. ! if $d(DLL)                       # Build the 16bit OCF for use with RTL/BIDS DLL
  252. !   if $d(USERDLL)
  253.       CWIN = -WDE -D_OCFDLL -xc      # _BUILDOCFDLL in EXE (not actually a dll)
  254. !   else
  255.       CWIN = -WSE -D_OCFDLL          # _BUILDOCFDLL in DLL (not actually a dll)
  256. !   endif
  257.     LFLAGS = $(LDBG) -Twd -n -s -c -C
  258. !   if !$d(BIDSILIB)
  259.       BIDSILIB = bids$(BD)i
  260. !   endif
  261.     STDLIBS  = import crtldll        # Libs for linking the OC DLL
  262.  
  263. ! else
  264. !   if $d(USERDLL)
  265.       CWIN = -WDE -xc                # Build static OCF lib for use in DLLs
  266. !   else
  267.       CWIN = -WSE                    # Build regular static OCF lib
  268. !   endif
  269. ! endif
  270.  
  271. !endif
  272.  
  273. #--------------------------------------------------------------------
  274. # rules
  275. #--------------------------------------------------------------------
  276. .rc.res:
  277.   $(BRCC) $(RCINCLUDEPATH) -fo$@ $.
  278.  
  279. .cpp.obj:
  280.   $(BCC) {$. }
  281.  
  282. #--------------------------------------------------------------------
  283. # Various file lists needed for dependency checking and LIBing.
  284. #
  285. #   OBJS_CMN are the objs common to static libs and the dll
  286. #   OBJS_LIB are the objs that go into libs and implibs only, not the dlls
  287. #   OBJS_DLL are the objs that go into the dll only
  288. #   LIBDEPOBJS is the list of object files for lib/implib dependency checking
  289. #   LIBOBJS is the list of object files for building/addingto the libraries
  290. #   LINKOBJS is the list of object files for building the DLL
  291. #--------------------------------------------------------------------
  292.  
  293. # General Objs
  294. #
  295. OBJS_CMN = \
  296.  PFXautocli.obj\
  297.  PFXappdesc.obj\
  298.  PFXautosrv.obj\
  299.  PFXautoval.obj\
  300.  PFXocreg.obj\
  301.  PFXocguid.obj\
  302.  PFXocstorag.obj\
  303.  PFXoleutil.obj\
  304.  PFXtypelib.obj
  305.  
  306. OBJS_CMN = $(OBJS_CMN)\
  307.  PFXocapp.obj\
  308.  PFXocdoc.obj\
  309.  PFXocpart.obj\
  310.  PFXocremvie.obj\
  311.  PFXocdata.obj\
  312.  PFXoclink.obj\
  313.  PFXocview.obj
  314.  
  315. # Put together obj groups into lists for different targets
  316. #
  317. !if $d(DLL)
  318.  LIBDEPOBJS= $(OBJS_CMN:PFX=) $(OBJS_LIB:PFX=) $(OBJS_DLL:PFX=)
  319.  LIBOBJS   = $(OBJS_LIB:PFX=+) $(OBJS_CMN:PFX=+) $(OBJS_DLL:PFX=+)
  320.  LINKOBJS  = $(OBJS_CMN:PFX=) $(OBJS_DLL:PFX=)
  321. !else
  322.  LIBDEPOBJS= $(OBJS_CMN:PFX=) $(OBJS_LIB:PFX=)
  323.  LIBOBJS   = $(OBJS_CMN:PFX=+) $(OBJS_LIB:PFX=+)
  324. !endif
  325.  
  326. #--------------------------------------------------------------------
  327. # targets
  328. #--------------------------------------------------------------------
  329. all: cfgfile $(OCFLIB)
  330.  
  331. cfgfile:
  332.   @-if not exist $(.PATH.obj)\..\NUL md $(.PATH.obj)\..
  333.   @-if not exist $(.PATH.obj)\NUL md $(.PATH.obj)
  334.   @copy &&|
  335. -I$(INCLUDE)
  336. -c -w $(CMDL) $(CWIN) $(COPTS)
  337. $(CDBG) $(CDIAG)
  338. $(CPCH) -n$(.PATH.obj) $(CCFOCF)
  339. | $(CFGFILE) > NUL
  340.  
  341. $(OCFLIB): $(LIBDEPOBJS)
  342.   @del $(OCFLIB)
  343.   @cd $(.PATH.obj)
  344.   $(TLIB) $(TLIBOPTS) $(OCFLIB) @&&|
  345. $(LIBOBJS)
  346. |
  347.   @cd $(.PATH.cpp)
  348.  
  349. clean:
  350.   @echo Removing .OBJs from $(.PATH.obj)
  351.   @if exist $(.PATH.obj)\*.obj del $(.PATH.obj)\*.obj
  352.   @if exist $(.PATH.obj)\*.csm del $(.PATH.obj)\*.csm
  353.  
  354. !if $d(WIN32)
  355. ocguid.obj: ocguid.cpp
  356.   $(BCC) -H- ocguid.cpp
  357. !else
  358. ocguid.obj: ocguid.cpp
  359.   $(BCC) -H- -zE_TEXT -zFCODE ocguid.cpp
  360. !endif
  361.  
  362.