Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

490 lines
9.8 KiB

  1. # This is a part of the Microsoft Foundation Classes C++ library.
  2. # Copyright (C) 1992-1997 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. # NOTE: do not include 'stdafx.obj' in the OBJS list - the correctly
  25. # built version will be included for you
  26. #
  27. # Options to NMAKE:
  28. # "PLATFORM=?"
  29. # This option chooses the appropriate tools and sources for the
  30. # different platforms support by Windows/NT. Currently INTEL,
  31. # MIPS, ALPHA, PPC, M68K, and MPPC are supported; more will be
  32. # added as they become available. The default is chosen based on
  33. # the host environment. This option must be set for MAC_ builds.
  34. # "DEBUG=0" use release (default debug)
  35. # "CODEVIEW=1" include codeview info (even for release builds)
  36. # "AFXDLL=1" to use shared DLL version of MFC
  37. # "USRDLL=1" to build a DLL that uses static MFC
  38. # "UNICODE=1" to build UNICODE enabled applications
  39. # (not all samples support UNICODE)
  40. # "NO_PCH=1" do not use precompiled headers (defaults to use pch)
  41. # "COFF=1" include COFF symbols
  42. !ifndef PROJ
  43. !ERROR You forgot to define 'PROJ' symbol!!
  44. !endif
  45. ROOT=.
  46. !ifndef ROOT
  47. !endif
  48. !ifndef OBJS
  49. !ERROR You forgot to define 'OBJS' symbol!!
  50. !endif
  51. !ifndef DEBUG
  52. DEBUG=1
  53. !endif
  54. !ifndef AFXDLL
  55. AFXDLL=0
  56. !endif
  57. !ifndef UNICODE
  58. UNICODE=0
  59. !endif
  60. !ifndef USRDLL
  61. USRDLL=0
  62. !endif
  63. !if "$(USRDLL)" != "0"
  64. AFXDLL=0
  65. !endif
  66. !ifndef PLATFORM
  67. !ifndef PROCESSOR_ARCHITECTURE
  68. PROCESSOR_ARCHITECTURE=x86
  69. !endif
  70. !if "$(PROCESSOR_ARCHITECTURE)" == "x86"
  71. PLATFORM=INTEL
  72. !endif
  73. !if "$(PROCESSOR_ARCHITECTURE)" == "ALPHA"
  74. PLATFORM=ALPHA
  75. !endif
  76. !if "$(PROCESSOR_ARCHITECTURE)" == "MIPS"
  77. PLATFORM=MIPS
  78. !endif
  79. !if "$(PROCESSOR_ARCHITECTURE)" == "PPC"
  80. PLATFORM=PPC
  81. !endif
  82. !endif
  83. !ifndef USES_OLE
  84. USES_OLE=0
  85. !endif
  86. !ifndef USES_DB
  87. USES_DB=0
  88. !endif
  89. !ifndef CONSOLE
  90. CONSOLE=0
  91. !endif
  92. !ifndef NO_PCH
  93. NO_PCH=0
  94. !endif
  95. #
  96. # Set BASE=W, M, or P depending on platform
  97. #
  98. BASE=W
  99. !if "$(PLATFORM)" == "M68K" || "$(PLATFORM)" == "MPPC"
  100. MACOS=1
  101. !undef BASE
  102. !if "$(PLATFORM)" == "M68K"
  103. BASE=M
  104. !else
  105. BASE=P
  106. !endif
  107. !endif
  108. !if "$(UNICODE)" == "0"
  109. !if "$(AFXDLL)" == "0"
  110. !if "$(USRDLL)" != "1"
  111. STDAFX=stdafx
  112. !else
  113. STDAFX=stdusr
  114. !endif
  115. !else
  116. STDAFX=stddll
  117. !endif
  118. !endif
  119. !if "$(UNICODE)" == "1"
  120. !if "$(AFXDLL)" == "0"
  121. !if "$(USRDLL)" != "1"
  122. STDAFX=uniafx
  123. !else
  124. STDAFX=uniusr
  125. !endif
  126. !else
  127. STDAFX=unidll
  128. !endif
  129. !endif
  130. !if "$(DEBUG)" == "1"
  131. STDAFX=$(STDAFX)d
  132. !if "$(COFF)" != "1"
  133. !ifndef CODEVIEW
  134. CODEVIEW=1
  135. !endif
  136. !endif
  137. !endif
  138. !if "$(CODEVIEW)" == "1"
  139. STDAFX=$(STDAFX)v
  140. !endif
  141. !if "$(DEBUG)" == "1"
  142. DEBUG_SUFFIX=d
  143. !endif
  144. !if "$(DEBUG)" != "0"
  145. DEBUGFLAGS=/Od
  146. MFCDEFS=$(MFCDEFS) /D_DEBUG
  147. !if "$(PLATFORM)" == "M68K"
  148. DEBUGFLAGS=/Q68m
  149. !endif
  150. !endif
  151. !if "$(DEBUG)" == "0"
  152. !if "$(PLATFORM)" == "INTEL"
  153. DEBUGFLAGS=/O1 /Gy
  154. !endif
  155. !if "$(PLATFORM)" == "MIPS"
  156. DEBUGFLAGS=/O1 /Gy
  157. !endif
  158. !if "$(PLATFORM)" == "ALPHA"
  159. DEBUGFLAGS=/O1 /Gy
  160. !endif
  161. !if "$(PLATFORM)" == "PPC"
  162. DEBUGFLAGS=/O1 /Gy
  163. !endif
  164. !if "$(PLATFORM)" == "M68K"
  165. DEBUGFLAGS=/O1 /Gy
  166. !endif
  167. !if "$(PLATFORM)" == "MPPC"
  168. DEBUGFLAGS=/O1 /Gy
  169. !endif
  170. !endif # DEBUG == 0
  171. !if "$(CODEVIEW)" == "1" || "$(COFF)" == "1"
  172. DEBUGFLAGS=$(DEBUGFLAGS) /Z7
  173. !endif
  174. !if "$(UNICODE)" == "1"
  175. DLL_SUFFIX=u
  176. !endif
  177. !if "$(AFXDLL)" == "1"
  178. MFCFLAGS=$(MFCFLAGS) /MD$(DEBUG_SUFFIX)
  179. MFCDEFS=$(MFCDEFS) /D_AFXDLL
  180. !endif # AFXDLL == 1
  181. !if "$(USRDLL)" == "1"
  182. MFCDEFS=$(MFCDEFS) /D_USRDLL /D_WINDLL
  183. !endif
  184. !if "$(AFXDLL)" == "0"
  185. !if "$(MACOS)" != "1"
  186. MFCFLAGS=$(MFCFLAGS) /MT$(DEBUG_SUFFIX)
  187. !elseif "$(PLATFORM)" != "M68K"
  188. MFCFLAGS=$(MFCFLAGS) /ML$(DEBUG_SUFFIX)
  189. !endif
  190. !endif
  191. !if "$(UNICODE)" == "1"
  192. MFCDEFS=$(MFCDEFS) /D_UNICODE
  193. !else
  194. MFCDEFS=$(MFCDEFS) /D_MBCS
  195. !endif
  196. !if "$(MACOS)" == "1"
  197. MFCDEFS=$(MFCDEFS) /D_MAC
  198. !if "$(PLATFORM)" == "M68K"
  199. ARCHITECTURE='m68k'
  200. !else
  201. ARCHITECTURE='pwpc'
  202. !endif
  203. !endif
  204. !if "$(PLATFORM)" == "INTEL"
  205. MFCDEFS=$(MFCDEFS) /D_X86_
  206. CPP=cl
  207. CFLAGS=/GX /c /W3 $(DEBUGFLAGS) $(MFCFLAGS) $(MFCDEFS)
  208. !endif
  209. !if "$(PLATFORM)" == "MIPS"
  210. MFCDEFS=$(MFCDEFS) /D_MIPS_
  211. CPP=cl
  212. CFLAGS=/GX /c /W3 $(DEBUGFLAGS) $(MFCFLAGS) $(MFCDEFS)
  213. !endif
  214. !if "$(PLATFORM)" == "ALPHA"
  215. MFCDEFS=$(MFCDEFS) /D_ALPHA_
  216. CPP=cl
  217. CFLAGS=/GX /c /W3 $(DEBUGFLAGS) $(MFCFLAGS) $(MFCDEFS)
  218. !endif
  219. !if "$(PLATFORM)" == "PPC"
  220. MFCDEFS=$(MFCDEFS) /D_PPC_
  221. !if "$(PROCESSOR_ARCHITECTURE)" == "x86"
  222. CPP=mcl
  223. !else
  224. CPP=cl
  225. !endif
  226. CFLAGS=/GX /c /W3 $(DEBUGFLAGS) $(MFCFLAGS) $(MFCDEFS)
  227. !endif
  228. !if "$(PLATFORM)" == "M68K"
  229. MFCDEFS=$(MFCDEFS) /D_WINDOWS /DWIN32 /D_68K_
  230. CPP=cl
  231. CFLAGS=/GX /c /W3 /AL /Gt1 /Q68s $(DEBUGFLAGS) $(MFCFLAGS) $(MFCDEFS)
  232. !endif
  233. !if "$(PLATFORM)" == "MPPC"
  234. MFCDEFS=$(MFCDEFS) /D_WINDOWS /DWIN32 /D_MPPC_
  235. CPP=cl
  236. CFLAGS=/GX /c /W3 $(DEBUGFLAGS) $(MFCFLAGS) $(MFCDEFS)
  237. !endif
  238. CPPMAIN_FLAGS=$(CFLAGS)
  239. !if "$(NO_PCH)" == "1"
  240. CPPFLAGS=$(CPPMAIN_FLAGS)
  241. !else
  242. PCHDIR=.
  243. CPPFLAGS=$(CPPMAIN_FLAGS) /Yustdafx.h /Fp$(PCHDIR)\$(STDAFX).pch
  244. !endif
  245. !if "$(COFF)" == "1"
  246. NO_PDB=1
  247. !if "$(CODEVIEW)" != "1"
  248. LINKDEBUG=/incremental:no /debug:full /debugtype:coff
  249. !else
  250. LINKDEBUG=/incremental:no /debug:full /debugtype:both
  251. !endif
  252. !endif
  253. !if "$(COFF)" != "1"
  254. !if "$(CODEVIEW)" == "1"
  255. LINKDEBUG=/incremental:no /debug:full /debugtype:cv
  256. !else
  257. LINKDEBUG=/incremental:no /debug:none
  258. !endif
  259. !endif
  260. !if "$(NO_PDB)" == "1"
  261. LINKDEBUG=$(LINKDEBUG) /pdb:none
  262. !endif
  263. !if "$(PLATFORM)" == "INTEL"
  264. LINKCMD=link $(LINKDEBUG)
  265. !endif
  266. !if "$(PLATFORM)" == "MIPS"
  267. LINKCMD=link $(LINKDEBUG)
  268. !endif
  269. !if "$(PLATFORM)" == "ALPHA"
  270. LINKCMD=link $(LINKDEBUG)
  271. !endif
  272. !if "$(PLATFORM)" == "PPC"
  273. LINKCMD=link $(LINKDEBUG)
  274. !endif
  275. !if "$(PLATFORM)" == "M68K"
  276. LINKCMD=link $(LINKDEBUG)
  277. !endif
  278. !if "$(PLATFORM)" == "MPPC"
  279. LINKCMD=link $(LINKDEBUG)
  280. !endif
  281. # link flags - must be specified after $(LINKCMD)
  282. #
  283. # conflags : creating a character based console application
  284. # guiflags : creating a GUI based "Windows" application
  285. !if "$(MACOS)" != "1"
  286. CONFLAGS=/subsystem:console
  287. GUIFLAGS=/subsystem:windows
  288. !else
  289. !if defined(MACSIG)
  290. GUIFLAGS=/mac:type=APPL /mac:creator=$(MACSIG)
  291. !endif
  292. !endif
  293. !if "$(UNICODE)" == "1"
  294. CONFLAGS=$(CONFLAGS) /entry:wmainCRTStartup
  295. GUIFLAGS=$(GUIFLAGS) /entry:wWinMainCRTStartup
  296. !endif
  297. !if "$(MACOS)" != "1"
  298. PROJRESFILE=$(PROJ).res
  299. !else
  300. PROJRESFILE=$(PROJ).rsc $(MACSIG)mac.rsc
  301. !if "$(AFXDLL)" != "1"
  302. BASERESFILE=
  303. !endif
  304. !endif
  305. RESFILE=$(PROJRESFILE)
  306. .SUFFIXES:
  307. .SUFFIXES: .c .cpp .rcm .rc
  308. .cpp.obj:
  309. $(CPP) @<<
  310. $(CPPFLAGS) $*.cpp
  311. <<
  312. .c.obj:
  313. $(CPP) @<<
  314. $(CFLAGS) $(CVARS) $*.c
  315. <<
  316. !if "$(MACOS)" != "1"
  317. .rc.res:
  318. rc /r $(MFCDEFS) $<
  319. !else
  320. .rc.rsc:
  321. rc /r /m $(MFCDEFS) $<
  322. !endif
  323. #############################################################################
  324. !if "$(NO_PCH)" == "0"
  325. LINK_OBJS=$(OBJS) $(PCHDIR)\$(STDAFX).obj
  326. !else
  327. LINK_OBJS=$(OBJS)
  328. !endif
  329. #
  330. # Build CONSOLE Win32 application
  331. #
  332. !if "$(CONSOLE)" == "1"
  333. !if "$(MACOS)" == "1"
  334. !error Macintosh targets do not support console applications
  335. !endif
  336. $(PROJ).exe: $(LINK_OBJS)
  337. $(LINKCMD) @<<
  338. $(CONFLAGS) /out:$(PROJ).exe /map:$(PROJ).map
  339. $(LINK_OBJS) $(EXTRA_LIBS)
  340. <<
  341. !endif # CONSOLE=1
  342. #
  343. # Build Win32 application
  344. #
  345. !if "$(CONSOLE)" == "0"
  346. !if "$(MACOS)" == "1"
  347. copy: $(PROJ).exe
  348. !if defined(MACNAME)
  349. mfile copy $(PROJ).exe ":$(MACNAME):$(PROJ)"
  350. !endif
  351. !endif
  352. !if "$(MACOS)" == "1"
  353. $(MACSIG)mac.rsc: $(MACSIG)mac.r
  354. mrc $(MFCDEFS) /DARCHITECTURE=$(ARCHITECTURE) /o $(MACSIG)mac.rsc $(MACSIG)mac.r
  355. !endif
  356. !if "$(USRDLL)" == "1"
  357. $(PROJ).dll: $(LINK_OBJS) $(PROJRESFILE)
  358. $(LINKCMD) @<<
  359. $(GUIFLAGS) /out:$(PROJ).dll /map:$(PROJ).map
  360. /dll /def:$(PROJ).def
  361. $(LINK_OBJS) $(RESFILE) $(EXTRA_LIBS)
  362. <<
  363. $(PROJ).res: resource.h
  364. $(PROJ).rsc: resource.h
  365. !endif
  366. !if "$(SIMPLE_APP)" != "1"
  367. $(PROJ).exe: $(LINK_OBJS) $(PROJRESFILE)
  368. $(LINKCMD) @<<
  369. $(GUIFLAGS) /out:$(PROJ).exe /map:$(PROJ).map
  370. $(LINK_OBJS) $(RESFILE) $(EXTRA_LIBS)
  371. <<
  372. $(PROJ).res: resource.h
  373. $(PROJ).rsc: resource.h
  374. !endif
  375. !if "$(SIMPLE_APP)" == "1"
  376. !if "$(MACOS)" == "1"
  377. $(PROJ).exe: $(LINK_OBJS) $(MACSIG)mac.rsc
  378. $(LINKCMD) @<<
  379. $(GUIFLAGS) /out:$(PROJ).exe /map:$(PROJ).map
  380. $(LINK_OBJS) $(MACSIG)mac.rsc $(EXTRA_LIBS)
  381. <<
  382. !else
  383. $(PROJ).exe: $(LINK_OBJS)
  384. $(LINKCMD) @<<
  385. $(GUIFLAGS) /out:$(PROJ).exe /map:$(PROJ).map
  386. $(LINK_OBJS) $(EXTRA_LIBS)
  387. <<
  388. !endif
  389. !endif
  390. !if "$(NO_PCH)" == "0"
  391. $(PCHDIR)\$(STDAFX).obj $(PCHDIR)\$(STDAFX).pch: stdafx.h stdafx.cpp
  392. echo "BUILDING SHARED PCH and PCT files"
  393. $(CPP) @<<
  394. $(CPPMAIN_FLAGS) /Ycstdafx.h /Fp$(PCHDIR)\$(STDAFX).pch /Fo$(PCHDIR)\$(STDAFX).obj /c $(ROOT)\stdafx.cpp
  395. <<
  396. $(OBJS): $(PCHDIR)\$(STDAFX).pch
  397. !endif
  398. !endif # CONSOLE=0
  399. clean::
  400. if exist $(PROJ).exe erase $(PROJ).exe
  401. if exist *.aps erase *.aps
  402. if exist *.pch erase *.pch
  403. if exist *.map erase *.map
  404. if exist *.obj erase *.obj
  405. if exist *.exp erase *.exp
  406. if exist *.pdb erase *.pdb
  407. if exist *.map erase *.map
  408. if exist *.lib erase *.lib
  409. if exist *.res erase *.res
  410. if exist *.rsc erase *.rsc
  411. if exist *.pef erase *.pef
  412. #############################################################################