home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c480 / 18.ddi / MFC / SRC / MAKEFILE._ / MAKEFILE.
Encoding:
Text File  |  1993-02-08  |  10.3 KB  |  410 lines

  1. # Makefile : Builds a Foundation class library variant.
  2. #
  3. # This is a part of the Microsoft Foundation Classes C++ library.
  4. # Copyright (C) 1992 Microsoft Corporation
  5. # All rights reserved.
  6. #
  7. # This source code is only intended as a supplement to the
  8. # Microsoft Foundation Classes Reference and Microsoft
  9. # QuickHelp and/or WinHelp documentation provided with the library.
  10. # See these sources for detailed information regarding the
  11. # Microsoft Foundation Classes product.
  12. #
  13. # Usage: NMAKE CLEAN        (removes all intermediary files)
  14. #    or: NMAKE options      (builds one library variant (see below))
  15. # Note that an NMAKE CLEAN should be performed before building a new variant.
  16. #
  17. # 'Options' are one of each of:
  18. #   "MODEL=M"            (defaults to M)
  19. #           Any of the following models are accepted: S (small), M (medium),
  20. #           C (compact), or L (large).
  21. #   "TARGET=W"           (defaults to W)
  22. #           Any of the following platforms are accepted: R (real-mode DOS),
  23. #           W (windows).
  24. #   "DLL"              (defaults to 0)
  25. #           If this item is 0, then a normal library is generated.
  26. #           If this item is 1, a DLL version of the library is generated.
  27. #           If this item is 2, a stand alone DLL is generated.
  28. #           Only Large model versions of DLLs are supported.
  29. #   "DEBUG"             (defaults to 1)
  30. #           If this item is 1, debugging support is compiled into
  31. #           the library.  If this item is 0, then debugging support
  32. #           is disabled.  Debug support does not include CodeView information.
  33. #   "CODEVIEW=0"           (defaults to 1, always)
  34. #           If this item is 1 CodeView information is compiled into
  35. #           the library.  You must use the /CODEVIEW link option
  36. #           in addition, when linking your executable.  If this item
  37. #           is 2, then only selected modules will be compiled with
  38. #           CodeView information.  You must use the link option /CODEVIEW.
  39. #           A value of 0 indicates that no CodeView information is to be
  40. #           generated.
  41. #   "OBJ=.\obj"          (defaults to '$$(MODEL)$(TARGET)$(DEBUG)'
  42. #           This optional specification specifies where temporary OBJ files
  43. #           are stored during the build process.  The directory is created or
  44. #           removed as necessary.
  45. #   "OPT="               (no default value)
  46. #           This allows additional compiler options to be added to the build.
  47. #           If more than one switch is desired, put double-quotes around the
  48. #           whole OPT= argument, e.g., "OPT=/J /W3".
  49. #   "NO_PCH=1" 
  50. #           Set this item to override the default use of precompiled headers
  51. #
  52. #   The default is to build MODEL=M TARGET=W DEBUG=1
  53. #
  54. #
  55. #############################################################################
  56. # Define Default values if not defined
  57.  
  58. # Default to Medium Model
  59. !ifndef MODEL
  60. MODEL=m
  61. !endif
  62.  
  63. # Default to DEBUG mode
  64. !ifndef DEBUG
  65. DEBUG=1
  66. !endif
  67.  
  68. # Default to NOT DLL
  69. !ifndef DLL
  70. DLL=0
  71. !else
  72. # DLL must be large model
  73. !undef MODEL
  74. MODEL=l
  75. !endif
  76.  
  77. # Default Target to Windows
  78. !ifndef TARGET
  79. TARGET=w
  80. !endif
  81.  
  82. # Default to minimal Codeview Info
  83. !ifndef CODEVIEW
  84. CODEVIEW=1
  85. !endif
  86.  
  87.  
  88. #############################################################################
  89. # normalize cases of parameters
  90.  
  91. !if "$(MODEL)"=="S"
  92. !undef MODEL
  93. MODEL=s
  94. !else if "$(MODEL)"=="M"
  95. !undef MODEL
  96. MODEL=m
  97. !else if "$(MODEL)"=="C"
  98. !undef MODEL
  99. MODEL=c
  100. !else if "$(MODEL)"=="L"
  101. !undef MODEL
  102. MODEL=l
  103. !else if "$(MODEL)"=="N"
  104. !undef MODEL
  105. MODEL=n
  106. !endif
  107.  
  108. !if "$(TARGET)"=="W"
  109. !undef TARGET
  110. TARGET=w
  111. !else if "$(TARGET)"=="R"
  112. !undef TARGET
  113. TARGET=r
  114. !endif
  115.  
  116. #############################################################################
  117. # Parse these options:
  118.  
  119. #
  120. # DEBUG OPTIONS
  121. #
  122. !if "$(DEBUG)" != "0"
  123. DEBUGSUF=D
  124. DEBDEFS=/D_DEBUG
  125. DEBOPTS=/Odr
  126. !else
  127.  
  128. #
  129. # NON-DEBUG OPTIONS
  130. #
  131. DEBUGSUF=
  132. DEBDEFS=
  133. DEBOPTS=/O1
  134. !endif
  135.  
  136. #
  137. # CODEVIEW options
  138. #
  139.  
  140. !if "$(CODEVIEW)" == "1"
  141. DEBOPTS=$(DEBOPTS) /Z7
  142. !endif
  143.  
  144. # CVEXTRA used for select CodeView information (main files only)
  145. !if "$(CODEVIEW)" == "2"
  146. CVEXTRA=/Z7
  147. !endif
  148.  
  149. #
  150. # MODEL options
  151. #
  152. !if "$(MODEL)"=="s"
  153. CL_MODEL=/AS
  154. !else if "$(MODEL)"=="m"
  155. CL_MODEL=/NT AFX_MSVC_TEXT /AM
  156. !else if "$(MODEL)"=="c"
  157. CL_MODEL=/AC
  158. !else if "$(MODEL)"=="l"
  159. CL_MODEL=/NT AFX_MSVC_TEXT /AL
  160. !else
  161. !error MODEL must be one of S, M, C, L or N.
  162. !endif
  163.  
  164. #
  165. # TARGET options
  166. #
  167. !if "$(TARGET)"=="r"
  168. TARGDEFS=/D_DOS
  169. TARGOPTS=/Gy
  170. !else if "$(TARGET)"=="w"
  171. TARGDEFS=/D_WINDOWS
  172. TARGOPTS=/GA /G2 /Gy
  173. MKWIN=1
  174. EXPEXTRA=/GEe
  175. !else
  176. !error TARGET must be one of W, R.
  177. !endif
  178.  
  179. # TYPE = Library Type Designator
  180. #       c = normal C library
  181. #       d = DLL library
  182. #       e = Standalone DLL (MFC200.DLL)
  183. TYPE=c
  184.  
  185. #
  186. # Object File Directory
  187. #
  188. !if "$(OBJ)" == ""
  189. D=$$$(MODEL)$(TARGET)$(DEBUGSUF)    # subdirectory specific to variant
  190. !else
  191. D=$(OBJ)                            # User specified directory
  192. !endif
  193.  
  194. #
  195. # COMPILER OPTIONS
  196. #
  197. CL_OPT=/W3 /WX /Zp $(DEBOPTS) $(TARGOPTS)
  198.  
  199. #
  200. # DLL Variants
  201. #
  202. !if "$(DLL)" == "1"
  203. # _USRDLL library (SS!=DS)
  204. #   only Large model supported (compact model is possible)
  205. TYPE=d
  206. D=$D.dll
  207. CL_MODEL=$(CL_MODEL)w
  208. TARGOPTS=/GD /G2 /Gy /D_USRDLL
  209. # /GD will define _WINDLL
  210. !endif
  211.  
  212. !if "$(DLL)" == "2"
  213. # stand alone DLL (SS!=DS, large model, everything linked, everything exported)
  214. TYPE=e
  215. EXPEXTRA=
  216. TARGOPTS=/GD /GEf /G2 /D_WINDLL
  217. TARGDEFS=/D_WINDOWS /D_AFXDLL
  218. # Compile with optimizations ON !
  219. DEBOPTS=/O1 /Gs
  220. !if "$(CODEVIEW)" == "1"
  221. DEBOPTS=$(DEBOPTS) /Z7
  222. !endif
  223. !endif
  224.  
  225. #
  226. # VBX Runtime Library Support
  227. #
  228. !if ("$(MODEL)" == "m" || "$(MODEL)" == "l") && "$(DLL)" != "1"
  229. # only medium and large model can have VBX support (not _USRDLL)
  230.  
  231. VBX_LIB=$(MODEL)vbx$(TYPE)w.lib
  232. VBX_OBJ=$D\vbctrl.obj $D\vbddx.obj $D\vbddxf.obj $D\vbfloat.obj $(VBX_LIB)
  233. !else
  234. VBX_LIB=
  235. VBX_OBJ=
  236. !endif
  237.  
  238. #############################################################################
  239. # Options always built from above conditionals
  240.  
  241. DEFS=$(DEBDEFS) $(TARGDEFS)
  242. GOAL=$(MODEL)afx$(TYPE)$(TARGET)$(DEBUGSUF)
  243.  
  244. #############################################################################
  245. # Library Components
  246.  
  247. OBJECT=$D\objcore.obj $D\except.obj $D\afxver.obj \
  248.     $D\validadd.obj $D\dumpcont.obj $D\dumpflt.obj \
  249.     $D\arccore.obj $D\arcobj.obj $D\arcex.obj
  250.  
  251. # non-shared diagnostics
  252. OBJDIAG=$D\dumpinit.obj $D\dumpout.obj \
  253.     $D\afxasert.obj $D\afxmem.obj $D\afxabort.obj
  254.  
  255. FILES=$D\filecore.obj $D\filetxt.obj $D\filemem.obj $D\filex.obj $D\filest.obj
  256.  
  257. COLLECTIONS1=$D\array_b.obj $D\array_d.obj $D\array_p.obj $D\array_o.obj \
  258.     $D\array_s.obj $D\array_u.obj $D\array_w.obj \
  259.     $D\list_o.obj $D\list_p.obj $D\list_s.obj
  260.  
  261. COLLECTIONS2=$D\map_pp.obj $D\map_pw.obj $D\map_so.obj \
  262.     $D\map_sp.obj $D\map_ss.obj $D\map_wo.obj $D\map_wp.obj $D\plex.obj
  263.  
  264. MISC=$D\strcore.obj $D\strex.obj $D\timecore.obj
  265.  
  266. WINDOWS=\
  267.     $D\wincore.obj $D\winfrm.obj $D\winmdi.obj $D\winhand.obj $D\winmain.obj \
  268.     $D\barcore.obj $D\bartool.obj $D\bardlg.obj \
  269.     $D\dcprev.obj $D\dcmeta.obj
  270.  
  271. DIALOG=\
  272.     $D\dlgcore.obj $D\dlgdata.obj $D\dlgfloat.obj \
  273.     $D\winctrl.obj $D\winbtn.obj $D\penctrl.obj \
  274.     $D\dlgfile.obj $D\dlgprnt.obj $D\dlgclr.obj $D\dlgfnt.obj $D\dlgfr.obj
  275.  
  276. WINMISC=\
  277.     $D\wingdi.obj $D\winstr.obj $D\winmenu.obj \
  278.     $D\auxdata.obj $D\afxtrace.obj
  279.  
  280. DOCVIEW=\
  281.     $D\cmdtarg.obj $D\doccore.obj $D\doctempl.obj \
  282.     $D\docsingl.obj $D\docmulti.obj \
  283.     $D\viewcore.obj $D\viewprnt.obj $D\winsplit.obj $D\viewscrl.obj \
  284.     $D\viewform.obj $D\viewedit.obj $D\viewprev.obj
  285.  
  286. APPLICATION=\
  287.     $D\appcore.obj $D\appui.obj $D\appgray.obj $D\appdlg.obj $D\appprnt.obj \
  288.     $D\apphelp.obj $D\apphelpx.obj
  289.  
  290. !if "$(DEBUG)" == "1"
  291. INLINES=$D\afxinl1.obj
  292. !ifdef MKWIN
  293. INLINES=$(INLINES) $D\afxinl2.obj
  294. !endif
  295. !else
  296. INLINES=
  297. !endif
  298.  
  299. OLE= $D\olemisc.obj $D\olefile.obj $D\oledoc.obj $D\olecli.obj \
  300.     $D\oleui.obj $D\oleui2.obj $D\olesvr.obj $D\oletsvr.obj
  301.  
  302. OBJS=$(OBJECT) $(OBJDIAG) $(INLINES) $(FILES) $(COLLECTIONS1) $(COLLECTIONS2) $(MISC)
  303.  
  304. !ifdef MKWIN
  305. OBJS=$(OBJS) $(WINDOWS) $(DIALOG) $(WINMISC) $(DOCVIEW) $(APPLICATION) $(VBX_OBJ) $(OLE)
  306. !endif
  307.  
  308. #############################################################################
  309. # Standard tools
  310.  
  311. #############################################################################
  312. # Set CPPFLAGS for use with .cpp.obj and .c.obj rules
  313. # Define rule for use with OBJ directory
  314. # C++ uses a PCH file
  315.  
  316. CPPFLAGS=$(CPPFLAGS) $(CL_MODEL) $(CL_OPT) $(DEFS) $(OPT)
  317.  
  318. !ifndef NO_PCH
  319. !ifndef PCH_FILE
  320. PCH_FILE=$D\stdafx.pch
  321. !endif
  322.  
  323. CPPFLAGS=$(CPPFLAGS) /Yustdafx.h /Fp$(PCH_FILE)
  324. !else
  325. PCH_FILE=
  326. !endif
  327.  
  328. .SUFFIXES: .cpp
  329.  
  330. .cpp{$D}.obj:
  331.     $(CPP) @<<
  332. $(CPPFLAGS) /c /Fo$D\ $<
  333. <<
  334.  
  335. #############################################################################
  336. # Goals to build
  337.  
  338. goal: create.dir ..\lib\$(GOAL).lib
  339.  
  340. create.dir:
  341.     @-if not exist $D\*.* mkdir $D
  342.  
  343. clean:
  344.     -if exist $D\*.obj erase $D\*.obj
  345.     -if exist $D\*.pch erase $D\*.pch
  346.     -rmdir $D
  347.  
  348. #############################################################################
  349. # Precompiled header file
  350.  
  351. !ifndef NO_PCH
  352. HDRS =..\include\*.h ..\include\*.inl
  353.  
  354. $D\objcore.obj $(PCH_FILE): objcore.cpp $(HDRS)
  355.     @$(CPP) @<<
  356. /c /Ycstdafx.h /Fp$(PCH_FILE) $(CL_MODEL) $(CL_OPT) $(DEFS) $(CVEXTRA) $(OPT) /c /Fo$D\objcore.obj objcore.cpp
  357. <<
  358. !endif
  359.  
  360. ############################################################################
  361. # CodeView for select files
  362.  
  363. !if "$(CODEVIEW)"=="2"
  364.  
  365. $D\afxmem.obj : afxmem.cpp
  366.     @$(CPP) @<<
  367. $(CPPFLAGS) $(CVEXTRA) /c /Fo$D\afxmem.obj afxmem.cpp
  368. <<
  369.  
  370. !ifdef MKWIN
  371. $D\winmain.obj : winmain.cpp
  372.     @$(CPP) @<<
  373. $(CPPFLAGS) $(CVEXTRA) /c /Fo$D\winmain.obj winmain.cpp
  374. <<
  375.  
  376. $D\wincore.obj : wincore.cpp
  377.     @$(CPP) @<<
  378. $(CPPFLAGS) $(CVEXTRA) /c /Fo$D\wincore.obj wincore.cpp
  379. <<
  380.  
  381. $D\appcore.obj : appcore.cpp
  382.     @$(CPP) @<<
  383. $(CPPFLAGS) $(CVEXTRA) /c /Fo$D\appcore.obj appcore.cpp
  384. <<
  385. !endif
  386. !endif
  387.  
  388. #############################################################################
  389. # Windows 3.0 loader export/version number
  390.  
  391. $D\afxver.obj : afxver.cpp
  392.     @$(CPP) @<<
  393. $(CPPFLAGS) $(EXPEXTRA) /c /Fo$D\ afxver.cpp
  394. <<
  395.  
  396. #############################################################################
  397. # Build the library from the up-to-date objs
  398.  
  399. ..\lib\$(GOAL).lib: $(OBJS)
  400.     @-if exist $@ erase $@
  401.     @lib /PAGESIZE:64 @<<
  402. $@
  403. y
  404. $(OBJS)
  405. nul
  406. ;
  407. <<
  408.  
  409. #############################################################################
  410.