mfcsamps.mak 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401
  1. # This is a part of the Microsoft Foundation Classes C++ library.
  2. # Copyright (C) 1992-1995 Microsoft Corporation
  3. # All rights reserved.
  4. #
  5. # This source code is only intended as a supplement to the
  6. # Microsoft Foundation Classes Reference and related
  7. # electronic documentation provided with the library.
  8. # See these sources for detailed information regarding the
  9. # Microsoft Foundation Classes product.
  10. # Common include for building MFC Sample programs
  11. #
  12. # typical usage
  13. # PROJ=foo
  14. # OBJS=foo.obj bar.obj ...
  15. # !INCLUDE ..\..\SAMPLE_.MAK
  16. #
  17. # ROOT specifies the location of the msdev\samples\mfc directory,
  18. # relative to the project directory. Because the MFC tutorial samples
  19. # have an intermediate STEP<n> subdirectory, they use
  20. # ROOT=..\..\..
  21. # instead of the default
  22. # ROOT=..\..
  23. #
  24. # Options to NMAKE:
  25. # "DEBUG=0" use retail (default debug)
  26. # "CODEVIEW=1" include codeview info (even for retail builds)
  27. # "AFXDLL=1" to use shared DLL version of MFC
  28. # "USRDLL=1" to build a DLL that uses static MFC
  29. #############################################################################
  30. # Borland specific options:
  31. #
  32. # "USRSTARTUP=xxx" used to link with a specific startup code .OBJ
  33. # (by default it uses the correct one for the specified
  34. # target).
  35. #
  36. # "DBGINFO=1" is used to include source debugging information.
  37. #
  38. # "NO_RESOURCE=1" is set to not attempt to bind in resources.
  39. #
  40. # "NO_PCH=1" is set to prevent the use of pre-compiled headers
  41. # (default is to use them)
  42. #
  43. # "NO_CLEAN_PCH" To prevent deleting an existing PCH (.csm) file
  44. #
  45. # LINKFLAGS and CFLAGS can be set to contain additional or overriding option
  46. # for the linker or compiler
  47. #
  48. #
  49. !ifndef PROJ
  50. !ERROR You forgot to define 'PROJ' symbol!!
  51. !endif
  52. ROOT=.
  53. !ifndef OBJS
  54. !ERROR You forgot to define 'OBJS' symbol!!
  55. !endif
  56. !ifndef DEBUG
  57. DEBUG=0
  58. !endif
  59. !ifndef DBGINFO
  60. DBGINFO=0
  61. !endif
  62. !ifdef CODEVIEW
  63. DBGINFO=$(CODEVIEW)
  64. !endif
  65. !ifndef AFXDLL
  66. AFXDLL=0
  67. !endif
  68. !ifndef UNICODE
  69. UNICODE=0
  70. !endif
  71. !ifndef USRDLL
  72. USRDLL=0
  73. !endif
  74. !ifdef USRSTARTUP
  75. STARTUP=$(USRSTARTUP)
  76. !endif
  77. !ifndef NO_RESOURCE
  78. NO_RESOURCE=0
  79. !endif
  80. !ifndef NO_PCH
  81. NO_PCH=0
  82. !endif
  83. !ifndef NO_CLEAN_PCH
  84. NO_CLEAN_PCH=0
  85. !endif
  86. !if "$(SIMPLE_APP)" == "1"
  87. NO_RESOURCE=1
  88. !endif
  89. !ifndef USES_OLE
  90. USES_OLE=0
  91. !endif
  92. !ifndef USES_DB
  93. USES_DB=0
  94. !endif
  95. !ifndef CONSOLE
  96. CONSOLE=0
  97. !endif
  98. #
  99. # Set BASE=W, M, or P depending on platform
  100. #
  101. BASE=W
  102. !if "$(UNICODE)" == "0"
  103. !if "$(AFXDLL)" == "0"
  104. !if "$(USRDLL)" != "1"
  105. STDAFX=stdafx
  106. !else
  107. STDAFX=stdusr
  108. !endif
  109. !else
  110. STDAFX=stddll
  111. !endif
  112. !endif
  113. !if "$(UNICODE)" == "1"
  114. !if "$(AFXDLL)" == "0"
  115. !if "$(USRDLL)" != "1"
  116. STDAFX=uniafx
  117. !else
  118. STDAFX=uniusr
  119. !endif
  120. !else
  121. STDAFX=unidll
  122. !endif
  123. !endif
  124. !if "$(DEBUG)" == "1"
  125. STDAFX=$(STDAFX)d
  126. !endif
  127. !if "$(DEBUG)" == "1"
  128. DEBUG_SUFFIX=d
  129. !endif
  130. !if "$(DEBUG)" != "0"
  131. DEBUGFLAGS=/Od
  132. MFCDEFS=$(MFCDEFS) /D_DEBUG
  133. !endif
  134. !if "$(DEBUG)" == "0"
  135. DEBUGFLAGS=/O1
  136. !endif # DEBUG == 0
  137. !if "$(DBGINFO)" == "1"
  138. DEBUGFLAGS=$(DEBUGFLAGS) -v -vi -r-
  139. LINKDEBUG=/v
  140. !endif
  141. !if "$(UNICODE)" == "1"
  142. DLL_SUFFIX=u
  143. !endif
  144. MFCDEFS = $(MFCDEFS) /D_NO_VCL
  145. !if "$(AFXDLL)" == "1"
  146. MFCDEFS=$(MFCDEFS) /D_RTLDLL;_AFXDLL;_X86_;_WINDOWS;_MSC_VER=1200;_AFX_PORTABLE;_AFX_NOFORCE_LIBS;_CRT_PORTABLE;_AFX_NO_DEBUG_CRT;
  147. !else
  148. MFCDEFS=$(MFCDEFS) /D_X86_;_WINDOWS;_MSC_VER=1100;_AFX_PORTABLE;_AFX_NOFORCE_LIBS;_CRT_PORTABLE;_AFX_NO_DEBUG_CRT;
  149. !endif
  150. !if "$(USRDLL)" == "1"
  151. MFCDEFS=$(MFCDEFS) /D_USRDLL /D_WINDLL
  152. !if "$(CONSOLE)" == "1"
  153. MFCFLAGS=$(MFCFLAGS) -WD
  154. !else
  155. MFCFLAGS=$(MFCFLAGS) -WD
  156. !endif
  157. !else
  158. !if "$(CONSOLE)" == "1"
  159. MFCFLAGS=$(MFCFLAGS) -WC
  160. !else
  161. MFCFLAGS=$(MFCFLAGS) -W
  162. !endif
  163. !endif
  164. !if "$(UNICODE)" == "1"
  165. MFCDEFS=$(MFCDEFS) /D_UNICODE
  166. !endif
  167. !if !$d(PREPROCESS_ONLY)
  168. CPP=bcc32
  169. !else
  170. CPP=cpp32 -Sd -Sk
  171. !endif
  172. BORINCL=$(MAKEDIR)\..\include;$(MAKEDIR)\..\include\mfc;$(MAKEDIR)\..\include\atl;$(BORINCL)
  173. CFLAGS=-X -c -g0 -j1 -w-hid -w-par -w-aus -w-inl -VF -Vd -tWM -I$(BORINCL) $(DEBUGFLAGS) $(MFCFLAGS) $(MFCDEFS) $(CFLAGS)
  174. CPPMAIN_FLAGS=$(CFLAGS)
  175. !if "$(NO_PCH)" == "1"
  176. CPPFLAGS=$(CPPMAIN_FLAGS)
  177. !else
  178. PCHDIR=.
  179. PCH_FILE=$(PCHDIR)\$(STDAFX).csm
  180. CPPFLAGS=$(CPPMAIN_FLAGS) -H -Hc -H=$(PCH_FILE)
  181. !endif
  182. BORLIB=$(MAKEDIR)\..\lib;$(BORLIB)
  183. LINKFLAGS= /Gn /n /m /s $(LINKDEBUG) /L$(BORLIB);$(OTHERLIBPATH) $(LINKFLAGS)
  184. LINKCMD=ilink32
  185. !if "$(USES_OLE)" == "1"
  186. OTHERLIBS=ole2w32.lib $(OTHERLIBS)
  187. !endif
  188. !if "$(USES_DB)" == "1"
  189. OTHERLIBS=odbc32.lib $(OTHERLIBS)
  190. !endif
  191. !if "$(AFXDLL)" == "1"
  192. !if "$(DEBUG)" == "1"
  193. #LIBRARIES=BFC42D.lib BFCS42D.lib bfcd42d.lib bfco42d.lib bfcn42d.lib $(OTHERLIBS) cw32mti.lib import32.lib
  194. LIBRARIES=BFC42D.lib BFCS42D.lib $(OTHERLIBS) cw32mti.lib import32.lib
  195. !else
  196. LIBRARIES=BFC42.lib BFCS42.lib $(OTHERLIBS) cw32mti.lib import32.lib stlpmti.lib
  197. !endif
  198. !else
  199. LIBRARIES=nafxcw$(DEBUG_SUFFIX).lib $(OTHERLIBS) cw32mt.lib import32.lib stlpmt.lib
  200. !endif
  201. RC=brc32
  202. # link flags - must be specified after $(LINKCMD)
  203. #
  204. # conflags : creating a character based console application
  205. # guiflags : creating a GUI based "Windows" application
  206. #CONFLAGS=/subsystem:console
  207. #GUIFLAGS=/subsystem:windows
  208. CONFLAGS=/ap
  209. GUIFLAGS=/aa
  210. BORRSP=bor.rsp
  211. #.SUFFIXES:
  212. .SUFFIXES: .c .cpp .rc
  213. .cpp.obj:
  214. $(CPP) @$(BORRSP) { $< }
  215. .c.obj:
  216. $(CPP) @$(BORRSP) { $< }
  217. .rc.res:
  218. $(RC) -I$(BORINCL) -r @&&~
  219. $(MFCDEFS) /fo $@ $<
  220. ~
  221. #############################################################################
  222. LINK_OBJS=$(OBJS)
  223. !if "$(CONSOLE)" == "1"
  224. LINKFLAGS=$(LINKFLAGS) $(CONFLAGS)
  225. !ifndef USRSTARTUP
  226. STARTUP=$(BORLIB)\c0x32.obj
  227. !endif
  228. !else
  229. LINKFLAGS=$(LINKFLAGS) $(GUIFLAGS)
  230. !ifndef USRSTARTUP
  231. STARTUP=$(BORLIB)\c0w32.obj
  232. !endif
  233. !endif
  234. !if "$(USRDLL)" == "1"
  235. !ifndef USRSTARTUP
  236. STARTUP=$(BORLIB)\c0d32.obj
  237. !endif
  238. TARGET=$(PROJ).DLL
  239. !else
  240. TARGET=$(PROJ).EXE
  241. !endif
  242. MainRule: create.rsp build.pch $(TARGET)
  243. create.rsp:
  244. !if "$(NO_PCH)" != "1"
  245. !if "$(NO_CLEAN_PCH)" == "0"
  246. !ifdef PCH_FILE
  247. @-if exist $(PCH_FILE) echo Erasing PCH file: $(PCH_FILE) for a fresh build
  248. @-if exist $(PCH_FILE) erase $(PCH_FILE) > nul
  249. !endif
  250. !endif
  251. !endif
  252. @-if exist $(BORRSP) erase $(BORRSP) > nul
  253. copy &&|
  254. $(CPPFLAGS)
  255. | $(BORRSP)
  256. build.pch:
  257. !if "$(NO_PCH)" != "1"
  258. @-echo Checking / building precompiled headers:
  259. @-if exist stdafx.cpp if not exist $(PCH_FILE) $(CPP) @$(BORRSP) stdafx.cpp
  260. !else
  261. @-echo NOT using Precompiled Headers.
  262. !endif
  263. !if "$(SIMPLE_APP)" == "1"
  264. $(TARGET): $(LINK_OBJS)
  265. $(LINKCMD) /Tpe @&&~
  266. $(LINKFLAGS) +
  267. $(STARTUP) $(LINK_OBJS)
  268. $(TARGET)
  269. $(PROJ).map
  270. $(EXTRA_LIBS) $(LIBRARIES)
  271. ~
  272. !else
  273. !if "$(USRDLL)" == "0"
  274. !if "$(NO_RESOURCE)" == "1"
  275. $(TARGET): $(LINK_OBJS)
  276. !else
  277. $(TARGET): $(LINK_OBJS) $(PROJ).res
  278. !endif
  279. $(LINKCMD) /Tpe @&&~
  280. $(LINKFLAGS) +
  281. $(STARTUP) $(LINK_OBJS)
  282. $(TARGET)
  283. $(PROJ).map
  284. $(EXTRA_LIBS) $(LIBRARIES)
  285. !if "$(NO_RESOURCE)" != "1"
  286. $(PROJ).res
  287. !endif
  288. ~
  289. !else
  290. !if "$(NO_RESOURCE)" == "1"
  291. $(TARGET): $(LINK_OBJS)
  292. !else
  293. $(TARGET): $(LINK_OBJS) $(PROJ).res
  294. !endif
  295. $(LINKCMD) /Tpd @&&~
  296. $(LINKFLAGS) +
  297. $(STARTUP) $(LINK_OBJS)
  298. $(TARGET)
  299. $(PROJ).map
  300. $(EXTRA_LIBS) $(LIBRARIES)
  301. $(PROJ).def
  302. !if "$(NO_RESOURCE)" != "1"
  303. $(PROJ).res
  304. !endif
  305. ~
  306. !endif # userdll
  307. !endif # simple_app
  308. # This rule is for testing.
  309. # Useage:
  310. # MAKE {put any make options here} printdebuginfo
  311. #
  312. printdebuginfo:
  313. @-echo List of macros:
  314. @-type &&~
  315. USRDLL = $(USRDLL)
  316. AFXDLL = $(AFXDLL)
  317. CONSOLE = $(CONSOLE)
  318. PROJ = $(PROJ)
  319. STARTUP = $(STARTUP)
  320. LIBRARIES = $(LIBRARIES)
  321. LIBDIR = $(BORLIB)
  322. INCLDIR = $(BORINCL)
  323. LINKFLAGS = $(LINKFLAGS)
  324. CFLAGS = $(CFLAGS)
  325. ~
  326. clean::
  327. @if exist $(PROJ).exe erase $(PROJ).exe
  328. @if exist $(PROJ).dll erase $(PROJ).dll
  329. @if exist *.?0? erase *.?0?
  330. @if exist *.csm erase *.csm
  331. @if exist *.map erase *.map
  332. @if exist *.obj erase *.obj
  333. @if exist *.exp erase *.exp
  334. @if exist *.map erase *.map
  335. @if exist *.lib erase *.lib
  336. @if exist *.res erase *.res
  337. @if exist *.tds erase *.tds
  338. @if exist *.il? erase *.il?
  339. @if exist $(BORRSP) erase $(BORRSP)
  340. #############################################################################