borland.mak 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510
  1. # BORLAND.MAK: Borland makefile for MFC variants
  2. #
  3. # Usage: MAKE -F BORLAND.MAK CLEAN (removes all intermediary files)
  4. # or: MAKE -F BORLAND.MAK options (builds library variant (see below))
  5. # Note that an MAKE CLEAN should be performed before building a new variant.
  6. #
  7. # 'Options' are one of each of:
  8. # "DLL" (defaults to 0)
  9. # If this item is 0, then a normal library is generated.
  10. # DLL=1 is obsolete and not supported by this release.
  11. # If this item is 2, objects suitable for the shared DLL version
  12. # of MFC are created. Note: DLL=2 is to be used only from
  13. # MFCDLL.MAK, MFCOLE.MAK, or MFCDB.MAK
  14. #
  15. # "DEBUG" (defaults to 1)
  16. # If this item is 1, diagnostic support is compiled into
  17. # the library. If this item is 0, then diagnostic support
  18. # is disabled. Diagnostic support does not include debug info
  19. # information.
  20. #
  21. # "OBJ=.\obj" (defaults to '$$(MODEL)$(BASE)$(DEBUG)')
  22. # This optional specification specifies where temporary OBJ files
  23. # are stored during the build process. The directory is created or
  24. # removed as necessary.
  25. #
  26. # "OPT=" (no default value)
  27. # This allows additional compiler options to be added to the build.
  28. # If more than one switch is desired, put double-quotes around the
  29. # whole OPT= argument, e.g., "OPT=/J /W3".
  30. #
  31. # "NO_PCH=1"
  32. # Set this item to override the default use of precompiled headers.
  33. #
  34. # "BROWSE=1" (defaults to 0)
  35. # Set this option to build browse info
  36. #
  37. # "MT=0" (defaults to 1)
  38. # To build a non-multithreaded library instead of the default
  39. # (which enables multitheading and uses the multithread
  40. # C-runtimes) you can use MT=0.
  41. #
  42. #=============================================================================
  43. # Borland Additional flags
  44. #=============================================================================
  45. #
  46. # "NO_CLEAN_PCH" (defaults to off)
  47. # To prevent deleting an existing PCH (.csm) file
  48. #
  49. # "DBGINFO" (defaults to 0)
  50. # If this item is 1, Turbo Debugger debug info is compiled into
  51. # the library. If it's 0, then no debugger info is added.
  52. #
  53. # "LIBDIR=..\..\lib"
  54. # Directory for libraries that are created
  55. #
  56. # "MFCINCL=..\..\include\mfc"
  57. # MFC Include directory base
  58. #
  59. # "BCINCL=..\..\include"
  60. # BC++ Include directory
  61. #
  62. #############################################################################
  63. # Define defaults if not defined
  64. UNICODE=1
  65. # Default to DEBUG mode
  66. !ifndef DEBUG
  67. DEBUG=0
  68. !endif
  69. # Default to No Debug Info mode
  70. !ifndef DBGINFO
  71. DBGINFO=0
  72. !endif
  73. # Check for MS syntax
  74. !ifdef CODEVIEW
  75. DBGINFO=$(CODEVIEW)
  76. !endif
  77. # Default to NOT DLL
  78. !ifndef DLL
  79. DLL=0
  80. !endif
  81. # Default to no BROWSE info
  82. !ifndef BROWSE
  83. BROWSE=0
  84. !endif
  85. # Default to no precompiled headers
  86. #!ifndef NO_PCH
  87. #NO_PCH=1
  88. #!endif
  89. # Default to _MBCS build
  90. MBCS=1
  91. # Default to multithreading support
  92. !ifndef MT
  93. MT=1
  94. !endif
  95. # Default to not enable Borland CodeGuard
  96. !ifndef CG
  97. CG=0
  98. !endif
  99. # Lib directory
  100. !ifndef LIBDIR
  101. LIBDIR=..\..\LIB
  102. !endif
  103. # Lib Path
  104. !ifndef LPATH
  105. LPATH=..\..\LIB;..\..\LIB\PSDK
  106. !endif
  107. # MFC Include directory base
  108. !ifndef MFCINCL
  109. MFCINCL=..\include
  110. !endif
  111. # BC Include directory
  112. !ifndef BCINCL
  113. BCINCL=..\..\include;..\..\include\atl
  114. !endif
  115. # Disable Warnings
  116. !ifndef NO_WARNINGS
  117. NO_WARNINGS=0
  118. !endif
  119. # Clean up PCH file
  120. !ifndef NO_CLEAN_PCH
  121. NO_CLEAN_PCH=0
  122. !endif
  123. BASE=W
  124. MODEL=U
  125. TARGDEFS=/D_UNICODE /DUNICODE /D_AFX_NO_OLEDB_SUPPORT /D_AFX_NO_OCC_SUPPORT
  126. !if "$(MBCS)" != "0"
  127. TARGDEFS=$(TARGDEFS) /D_MBCS
  128. !endif
  129. PLATFORM=INTEL
  130. LFLAGS=$(LFLAGS) /j$(LPATH) /L$(LPATH)
  131. !if "$(NO_WARNINGS)" == "1"
  132. LFLAGS=$(LFLAGS) /w-
  133. !endif
  134. #
  135. # DEBUG OPTIONS
  136. #
  137. !if "$(DEBUG)" != "0"
  138. DEBUGSUF=D
  139. DEBDEFS=/D_DEBUG
  140. DEBOPTS=
  141. !endif
  142. #
  143. # NON-DEBUG OPTIONS
  144. #
  145. !if "$(DEBUG)" == "0"
  146. DEBUGSUF=
  147. DEBDEFS=
  148. DEBOPTS=/O1
  149. !endif
  150. !if "$(DBGINFO)" == "1"
  151. DEBOPTS=/Od /v /vi
  152. !endif
  153. !if "$(CG)" == "1"
  154. DEBOPTS=$(DEBOPTS) -vG
  155. !endif
  156. #
  157. # PLATFORM options
  158. #
  159. CC=bcc32
  160. LIB32=tlib
  161. !ifndef LINK32
  162. LINK32=ilink32 /Gn
  163. !endif
  164. CL_MODEL=/D_X86_
  165. GENDEFS=perl -w $(MAKEDIR)\gendefs.pl
  166. # TYPE = Library Type Designator
  167. # c = normal C library
  168. # d = DLL library
  169. TYPE=c
  170. !if "$(DEXT)" == ""
  171. DEXT=
  172. !endif
  173. #
  174. # Object File Directory
  175. #
  176. !if "$(OBJ)" == ""
  177. D=$$$(MODEL)$(BASE)$(DEBUGSUF)$(DEXT) # subdirectory specific to variant
  178. !else
  179. D=$(OBJ) # User specified directory
  180. !endif
  181. #
  182. # _AFXDLL DLL Variant
  183. #
  184. !if "$(DLL)" == "2"
  185. !if "$(TARG)" == ""
  186. !error DLL=2 is used only from BFCDLL.MAK, BFCOLE.MAK, or BFCDB.MAK
  187. !endif
  188. GOAL=$(TARG)
  189. TYPE=e
  190. !if "$(OBJ)" == ""
  191. D=DLL$(DEBUGSUF).$(BASE)
  192. !if "$(UNICODE)" == "1"
  193. D=$(MODEL)$(D)
  194. !endif
  195. D=$$$(D)
  196. !endif
  197. TARGDEFS=$(TARGDEFS) /D_WINDLL /D_AFXDLL
  198. !else
  199. GOAL=$(MODEL)afx$(TYPE)$(BASE)$(DEBUGSUF)
  200. !endif
  201. #
  202. # Threaded-ness
  203. #
  204. !if "$(MT)" != "0"
  205. TARGOPTS=$(TARGOPTS) /WM /D_MT=1
  206. !else
  207. !error This makefile only builds multi-threaded libraries, not single threaded.
  208. !endif
  209. #
  210. # Import libraries for the DLL builds
  211. #
  212. IMPORT_LIBS=import32.lib inet.lib odbc32.lib
  213. #
  214. # COMPILER OPTIONS
  215. #
  216. DEFS=$(DEFS) -D_declspec=__declspec /D_WCHAR_T_DEFINED /D__MSC /D_ANONYMOUS_STRUCT -D_MSC_VER=1200 -D_WINDOWS
  217. !if "$(DLL)" == "2"
  218. DEFS=$(DEFS) /D_RTLDLL /D_DLL
  219. !endif
  220. CL_OPT= -a8 -g0 -j2 -jb -VF4 $(INCROPTS) $(DEBOPTS) $(CVOPTS) $(TARGOPTS)
  221. #
  222. # Internal debugging switch for the compiler (-=xx)
  223. #
  224. !ifdef COMPILER_DIAG
  225. CL_OPT= $(CL_OPT) -=o
  226. !endif
  227. !if "$(BROWSE)" != "0"
  228. CL_OPT=-R $(CL_OPT)
  229. !endif
  230. CL_OPT=-n$(D) $(CL_OPT)
  231. !if "$(NO_WARNINGS)" == "1"
  232. CL_OPT=$(CL_OPT) -w-
  233. !endif
  234. !if "$(DEVBUILD)" != "0"
  235. CL_OPT=$(CL_OPT) /D_AFX_DEVBUILD
  236. !endif
  237. DEFS=$(DEFS) $(DEBDEFS) $(TARGDEFS)
  238. #############################################################################
  239. # Library Components
  240. OBJECT=objcore.obj except.obj \
  241. validadd.obj dumpcont.obj dumpflt.obj \
  242. arccore.obj arcobj.obj arcex.obj arcstrm.obj
  243. # non-shared diagnostics
  244. OBJDIAG=dumpinit.obj dumpout.obj \
  245. afxasert.obj afxmem.obj afxabort.obj
  246. FILES=filecore.obj filetxt.obj filemem.obj fileshrd.obj \
  247. filex.obj filest.obj
  248. COLL1=array_b.obj array_d.obj array_p.obj array_o.obj \
  249. array_s.obj array_u.obj array_w.obj \
  250. list_o.obj list_p.obj list_s.obj
  251. COLL2=map_pp.obj map_pw.obj map_so.obj \
  252. map_sp.obj map_ss.obj map_wo.obj map_wp.obj plex.obj
  253. MISC=\
  254. strcore.obj strex.obj timecore.obj \
  255. afxdbcs.obj afxstate.obj afxtls.obj fixalloc.obj \
  256. mtcore.obj mtex.obj
  257. WINDOWS=winhand.obj
  258. DIALOG=
  259. WINMISC=afxcrit.obj winstr.obj winutil.obj auxdata.obj wingdi.obj
  260. DOCVIEW=
  261. INTERNET=inet.obj filefind.obj
  262. !if "$(UNICODE)" == "1"
  263. #INTERNET=$(INTERNET) isapimix.obj
  264. !endif
  265. APPLICATION=appterm.obj appui1.obj appinit.obj apphelp.obj thrdcore.obj
  266. !if "$(DLL)" != "2"
  267. #APPLICATION=$(APPLICATION) app3ds.obj \
  268. # nolib.obj appmodul.obj dllmodul.obj oleexp.obj dumpstak.obj
  269. !endif
  270. # ODBC components:
  271. #DB=\
  272. # dbcore.obj dbrfx.obj dbview.obj dbflt.obj \
  273. # dblong.obj dbvar.obj
  274. #
  275. # DAO is not supported under Borland C++
  276. #
  277. #DB= $(DB) daocore.obj daodfx.obj daoview.obj viewoled.obj
  278. #
  279. SOCKETS=sockcore.obj
  280. OLEREQ=olelock.obj
  281. OLE=olevar.obj oleunk.obj
  282. OLECTL=
  283. !if "$(DEBUG)" == "1"
  284. OLECTL=$(OLECTL) ctlinl.obj
  285. !endif
  286. # Borland enhancement:
  287. !if "$(DEBUG)" == "1" && "$(MONOLITHIC)" == "1"
  288. OLE=$(OLE) dllole.obj
  289. !endif
  290. OLEDLL=$(OLE) $(OLECTL) $(OLEASM)
  291. !if "$(DEBUG)" == "1"
  292. INLINES = afxinl1.obj afxinl2.obj afxinl3.obj
  293. !else
  294. INLINES =
  295. !endif
  296. CPP_OBJS=$(OBJECT) $(OBJDIAG) $(INLINES) $(FILES) $(COLL1) $(COLL2) $(MISC) \
  297. $(WINDOWS) $(DIALOG) $(WINMISC) $(DOCVIEW) $(APPLICATION) \
  298. $(SOCKETS) $(OLEREQ) $(OLE) $(DAO) $(DB) $(INTERNET) $(OLECTL)
  299. OBJS=$(CPP_OBJS) $(OLEASM)
  300. #############################################################################
  301. # Standard tools
  302. #############################################################################
  303. # Set CPPFLAGS for use with .cpp.obj and .c.obj rules
  304. # Define rule for use with OBJ directory
  305. # C++ uses a PCH file
  306. CPPFLAGS=$(CPPFLAGS) $(CL_MODEL) $(CL_OPT) $(PDBOPTS) $(DEFS) $(OPT)
  307. BORRSP=bor.rsp
  308. !ifndef NO_PCH
  309. !ifndef PCH_FILE
  310. # put the PCH file in the OBJ directory for easy cleanup later
  311. PCH_FILE=$(D)\stdafx
  312. !if "$(BROWSE)" != "0"
  313. PCH_FILE=$(PCH_FILE)b
  314. !endif
  315. PCH_FILE=$(PCH_FILE).csm
  316. !endif
  317. !ifndef PCH_CPP
  318. PCH_CPP=objcore
  319. !endif
  320. PCH_CMD=-Hc -H=$(PCH_FILE)
  321. !else
  322. PCH_CMD=-H-
  323. PCH_FILE=
  324. !endif
  325. CPPFLAGS=$(CPPFLAGS) $(PCH_CMD)
  326. !ifdef JOHNS_CPP32
  327. PREPROCFLAGS=-Sd -Sk -Sr -P-
  328. !else
  329. PREPROCFLAGS=-Sd -Sk -Ss -P
  330. !endif
  331. .SUFFIXES: .cpp
  332. .path.obj = $(D)
  333. .cpp.i:
  334. cpp32 @$(BORRSP) $(PREPROCFLAGS) $<
  335. .cpp.obj:
  336. !if $d(FORCE_CPP32)
  337. cpp32 @$(BORRSP) $(PREPROCFLAGS) $<
  338. !else
  339. $(CC) @$(BORRSP) /c { $< }
  340. !endif
  341. !ifndef NO_PCH
  342. PCH_TARGETS=$(PCH_FILE) $(D)\$(PCH_CPP).obj
  343. !endif
  344. #############################################################################
  345. # Goals to build
  346. GOALS=log.mode create.dir create.rsp
  347. !ifndef NO_PCH
  348. GOALS=$(GOALS) $(PCH_TARGETS)
  349. !endif
  350. GOALS=$(GOALS) $(LIBDIR)\$(GOAL).lib
  351. goal: $(GOALS)
  352. log.mode:
  353. @-echo BORLAND.MAK:
  354. @-echo GOAL=$(GOAL), DLL=$(DLL), DEBUG=$(DEBUG),
  355. @-echo DBGINFO=$(DBGINFO), RCDEFINES=$(RCDEFINES),
  356. @-echo CL_OPT=$(CL_OPT), DEFS=$(DEFS),
  357. @-echo CPPFLAGS=$(CPPFLAGS)
  358. @-echo D=$(D)
  359. @-echo STATICLINK_OBJS=$(STATICLINK_OBJS)
  360. create.rsp:
  361. !ifndef NO_PCH
  362. !if "$(NO_CLEAN_PCH)" == "0"
  363. @-if exist $(PCH_FILE) echo Erasing PCH file: $(PCH_FILE) for a fresh build
  364. @-if exist $(PCH_FILE) erase $(PCH_FILE) > nul
  365. !endif
  366. !endif
  367. @-if exist $(BORRSP) erase $(BORRSP) > nul
  368. copy &&|
  369. $(CPPFLAGS) -I$(BCINCL);$(MFCINCL)
  370. | $(BORRSP)
  371. create.dir:
  372. @-if not exist $(D) mkdir $(D)
  373. @-if not exist $(LIBDIR) mkdir $(LIBDIR)
  374. clean:
  375. @-if exist *.map erase *.map
  376. @-if exist *.dll erase *.dll
  377. @-if exist *.cfg erase *.cfg
  378. @-if exist *.rsp erase *.rsp
  379. @-if exist *.tds erase *.tds
  380. !if $d(INTEGRATION_BUILD)
  381. @-if exist $(PLATFORM)\*.def erase $(PLATFORM)\*.def
  382. !endif
  383. @-if exist $$DLLD.W rmdir $$DLLD.W /s
  384. @-if exist $$DLL.W rmdir $$DLL.W /s
  385. @-if exist $$NW rmdir $$NW /s
  386. @-if exist $$NWD rmdir $$NWD /s
  387. #############################################################################
  388. # Precompiled header file
  389. !ifndef NO_PCH
  390. !if "$(DEBUG)" == "1"
  391. HDRS =$(MFCINCL)\*.h
  392. !else
  393. HDRS =$(MFCINCL)\*.h $(MFCINCL)\*.inl
  394. !endif
  395. !if "$(DLL)" != "2"
  396. $(PCH_TARGETS): $(PCH_CPP).cpp
  397. $(CC) @&&!
  398. $(CPPFLAGS) -I$(BCINCL);$(MFCINCL) /c $(PCH_CPP).cpp
  399. !
  400. !endif # DLL != 2
  401. !endif # NO_PCH
  402. #############################################################################
  403. # Build the library from the up-to-date objs
  404. !if "$(DLL)" != "2"
  405. # Build final library
  406. $(LIBDIR)\$(GOAL).lib: $(D)\$(OBJS)
  407. # @-if exist $@ erase $@
  408. @$(LIB32) $@ /P2048 @&&!
  409. +$(**: = &^
  410. +)
  411. !
  412. !endif #DLL!=2
  413. #############################################################################