borland.mak 10.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449
  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_PATH)
  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 /DWINSCP \
  126. /D_AFX_NO_OLEDB_SUPPORT /D_AFX_NO_OCC_SUPPORT /D_AFX_NO_OCX_SUPPORT /D_AFX_NO_DB_SUPPORT \
  127. /D_AFX_NO_AFXCMN_SUPPORT /D_AFX_NO_RICHEDIT_SUPPORT /D_AFX_NO_INET_SUPPORT /D_AFX_NO_DHTML_SUPPORT \
  128. /D_AFX_NO_OLE_SUPPORT /D_AFX_NO_SOCKET_SUPPORT /D_AFX_NO_SYNC_SUPPORT
  129. !if "$(MBCS)" != "0"
  130. TARGDEFS=$(TARGDEFS) /D_MBCS
  131. !endif
  132. PLATFORM=INTEL
  133. LFLAGS=$(LFLAGS) /j$(LPATH) /L$(LPATH)
  134. !if "$(NO_WARNINGS)" == "1"
  135. LFLAGS=$(LFLAGS) /w-
  136. !endif
  137. #
  138. # DEBUG OPTIONS
  139. #
  140. !if "$(DEBUG)" != "0"
  141. DEBUGSUF=D
  142. DEBDEFS=/D_DEBUG
  143. DEBOPTS=
  144. !endif
  145. #
  146. # NON-DEBUG OPTIONS
  147. #
  148. !if "$(DEBUG)" == "0"
  149. DEBUGSUF=
  150. DEBDEFS=
  151. DEBOPTS=/O1
  152. !endif
  153. !if "$(DBGINFO)" == "1"
  154. DEBOPTS=/Od /v /vi
  155. !endif
  156. !if "$(CG)" == "1"
  157. DEBOPTS=$(DEBOPTS) -vG
  158. !endif
  159. #
  160. # PLATFORM options
  161. #
  162. CC=bcc32
  163. LIB32=tlib
  164. !ifndef LINK32
  165. LINK32=ilink32 /Gn
  166. !endif
  167. CL_MODEL=/D_X86_
  168. GENDEFS=perl -w $(MAKEDIR)\gendefs.pl
  169. # TYPE = Library Type Designator
  170. # c = normal C library
  171. # d = DLL library
  172. TYPE=c
  173. !if "$(DEXT)" == ""
  174. DEXT=
  175. !endif
  176. #
  177. # Object File Directory
  178. #
  179. !if "$(OBJ)" == ""
  180. D=$$$(MODEL)$(BASE)$(DEBUGSUF)$(DEXT) # subdirectory specific to variant
  181. !else
  182. D=$(OBJ) # User specified directory
  183. !endif
  184. #
  185. # _AFXDLL DLL Variant
  186. #
  187. !if "$(DLL)" == "2"
  188. !if "$(TARG)" == ""
  189. !error DLL=2 is used only from BFCDLL.MAK, BFCOLE.MAK, or BFCDB.MAK
  190. !endif
  191. GOAL=$(TARG)
  192. TYPE=e
  193. !if "$(OBJ)" == ""
  194. D=DLL$(DEBUGSUF).$(BASE)
  195. !if "$(UNICODE)" == "1"
  196. D=$(MODEL)$(D)
  197. !endif
  198. D=$$$(D)
  199. !endif
  200. TARGDEFS=$(TARGDEFS) /D_WINDLL /D_AFXDLL
  201. !else
  202. GOAL=$(MODEL)afx$(TYPE)$(BASE)$(DEBUGSUF)
  203. !endif
  204. #
  205. # Threaded-ness
  206. #
  207. !if "$(MT)" != "0"
  208. TARGOPTS=$(TARGOPTS) /WM /D_MT=1
  209. !else
  210. !error This makefile only builds multi-threaded libraries, not single threaded.
  211. !endif
  212. #
  213. # Import libraries for the DLL builds
  214. #
  215. IMPORT_LIBS=import32.lib inet.lib odbc32.lib
  216. #
  217. # COMPILER OPTIONS
  218. #
  219. DEFS=$(DEFS) -D_declspec=__declspec /D_WCHAR_T_DEFINED /D__MSC /D_ANONYMOUS_STRUCT -D_MSC_VER=1200 -D_WINDOWS
  220. !if "$(DLL)" == "2"
  221. DEFS=$(DEFS) /D_RTLDLL /D_DLL
  222. !endif
  223. CL_OPT= -a8 -g0 -j2 -jb -VF4 $(INCROPTS) $(DEBOPTS) $(CVOPTS) $(TARGOPTS)
  224. #
  225. # Internal debugging switch for the compiler (-=xx)
  226. #
  227. !ifdef COMPILER_DIAG
  228. CL_OPT= $(CL_OPT) -=o
  229. !endif
  230. !if "$(BROWSE)" != "0"
  231. CL_OPT=-R $(CL_OPT)
  232. !endif
  233. CL_OPT=-n$(D) $(CL_OPT)
  234. !if "$(NO_WARNINGS)" == "1"
  235. CL_OPT=$(CL_OPT) -w-
  236. !endif
  237. !if "$(DEVBUILD)" != "0"
  238. CL_OPT=$(CL_OPT) /D_AFX_DEVBUILD
  239. !endif
  240. DEFS=$(DEFS) $(DEBDEFS) $(TARGDEFS)
  241. #############################################################################
  242. # Library Components
  243. OBJECT=objcore.obj except.obj validadd.obj \
  244. FILES=filecore.obj filex.obj filest.obj
  245. MISC= strcore.obj strex.obj timecore.obj \
  246. fixalloc.obj \
  247. plex.obj
  248. WINMISC= winstr.obj apphelp.obj
  249. !if "$(DEBUG)" == "1"
  250. INLINES = afxinl1.obj afxinl2.obj afxinl3.obj
  251. !else
  252. INLINES =
  253. !endif
  254. CPP_OBJS=$(OBJECT) $(INLINES) $(FILES) $(MISC) \
  255. $(WINMISC)
  256. OBJS=$(CPP_OBJS) $(OLEASM)
  257. #############################################################################
  258. # Standard tools
  259. #############################################################################
  260. # Set CPPFLAGS for use with .cpp.obj and .c.obj rules
  261. # Define rule for use with OBJ directory
  262. # C++ uses a PCH file
  263. CPPFLAGS=$(CPPFLAGS) $(CL_MODEL) $(CL_OPT) $(PDBOPTS) $(DEFS) $(OPT)
  264. BORRSP=bor.rsp
  265. !ifndef NO_PCH
  266. !ifndef PCH_FILE
  267. # put the PCH file in the OBJ directory for easy cleanup later
  268. PCH_FILE=$(D)\stdafx
  269. !if "$(BROWSE)" != "0"
  270. PCH_FILE=$(PCH_FILE)b
  271. !endif
  272. PCH_FILE=$(PCH_FILE).csm
  273. !endif
  274. !ifndef PCH_CPP
  275. PCH_CPP=objcore
  276. !endif
  277. PCH_CMD=-Hc -H=$(PCH_FILE)
  278. !else
  279. PCH_CMD=-H-
  280. PCH_FILE=
  281. !endif
  282. CPPFLAGS=$(CPPFLAGS) $(PCH_CMD)
  283. !ifdef JOHNS_CPP32
  284. PREPROCFLAGS=-Sd -Sk -Sr -P-
  285. !else
  286. PREPROCFLAGS=-Sd -Sk -Ss -P
  287. !endif
  288. .SUFFIXES: .cpp
  289. .path.obj = $(D)
  290. .cpp.i:
  291. cpp32 @$(BORRSP) $(PREPROCFLAGS) $<
  292. .cpp.obj:
  293. !if $d(FORCE_CPP32)
  294. cpp32 @$(BORRSP) $(PREPROCFLAGS) $<
  295. !else
  296. $(CC) @$(BORRSP) /c { $< }
  297. !endif
  298. !ifndef NO_PCH
  299. PCH_TARGETS=$(PCH_FILE) $(D)\$(PCH_CPP).obj
  300. !endif
  301. #############################################################################
  302. # Goals to build
  303. GOALS=log.mode create.dir create.rsp
  304. !ifndef NO_PCH
  305. GOALS=$(GOALS) $(PCH_TARGETS)
  306. !endif
  307. GOALS=$(GOALS) $(LIBDIR)\$(GOAL).lib
  308. goal: $(GOALS)
  309. log.mode:
  310. @-echo BORLAND.MAK:
  311. @-echo GOAL=$(GOAL), DLL=$(DLL), DEBUG=$(DEBUG),
  312. @-echo DBGINFO=$(DBGINFO), RCDEFINES=$(RCDEFINES),
  313. @-echo CL_OPT=$(CL_OPT), DEFS=$(DEFS),
  314. @-echo CPPFLAGS=$(CPPFLAGS)
  315. @-echo D=$(D)
  316. @-echo STATICLINK_OBJS=$(STATICLINK_OBJS)
  317. create.rsp:
  318. !ifndef NO_PCH
  319. !if "$(NO_CLEAN_PCH)" == "0"
  320. @-if exist $(PCH_FILE) echo Erasing PCH file: $(PCH_FILE) for a fresh build
  321. @-if exist $(PCH_FILE) erase $(PCH_FILE) > nul
  322. !endif
  323. !endif
  324. @-if exist $(BORRSP) erase $(BORRSP) > nul
  325. copy &&|
  326. $(CPPFLAGS) -I$(BCINCL);$(MFCINCL)
  327. | $(BORRSP)
  328. create.dir:
  329. @-if not exist $(D) mkdir $(D)
  330. @-if not exist $(LIBDIR) mkdir $(LIBDIR)
  331. clean:
  332. @-if exist *.map erase *.map
  333. @-if exist *.dll erase *.dll
  334. @-if exist *.cfg erase *.cfg
  335. @-if exist *.rsp erase *.rsp
  336. @-if exist *.tds erase *.tds
  337. !if $d(INTEGRATION_BUILD)
  338. @-if exist $(PLATFORM)\*.def erase $(PLATFORM)\*.def
  339. !endif
  340. @-if exist $$DLLD.W rmdir $$DLLD.W /s
  341. @-if exist $$DLL.W rmdir $$DLL.W /s
  342. @-if exist $$NW rmdir $$NW /s
  343. @-if exist $$NWD rmdir $$NWD /s
  344. #############################################################################
  345. # Precompiled header file
  346. !ifndef NO_PCH
  347. !if "$(DEBUG)" == "1"
  348. HDRS =$(MFCINCL)\*.h
  349. !else
  350. HDRS =$(MFCINCL)\*.h $(MFCINCL)\*.inl
  351. !endif
  352. !if "$(DLL)" != "2"
  353. $(PCH_TARGETS): $(PCH_CPP).cpp
  354. $(CC) @&&!
  355. $(CPPFLAGS) -I$(BCINCL);$(MFCINCL) /c $(PCH_CPP).cpp
  356. !
  357. !endif # DLL != 2
  358. !endif # NO_PCH
  359. #############################################################################
  360. # Build the library from the up-to-date objs
  361. !if "$(DLL)" != "2"
  362. # Build final library
  363. $(LIBDIR)\$(GOAL).lib: $(D)\$(OBJS)
  364. # @-if exist $@ erase $@
  365. @$(LIB32) $@ /P2048 @&&!
  366. +$(**: = &^
  367. +)
  368. !
  369. !endif #DLL!=2
  370. #############################################################################