home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / vc98 / include / make.inc < prev    next >
Text File  |  1998-04-25  |  11KB  |  407 lines

  1. #----------------------------------------------------------------------------
  2. #
  3. # Descriptions:
  4. #   Generic Make File Header for EDK
  5. #
  6. # Copyright:
  7. #   Copyright (C) Microsoft Corp. 1993-1995.  All Rights Reserved.
  8. #
  9. #----------------------------------------------------------------------------
  10.  
  11.  
  12. #*********************************************
  13. # Check Component Name
  14. #*********************************************
  15.  
  16. !ifndef COMP
  17. !     ERROR Component name (COMP) has not been defined.
  18. !endif
  19.  
  20.  
  21. #*********************************************
  22. # Parameter Defaults
  23. #*********************************************
  24.  
  25. !ifndef BKOFFICE
  26. BKOFFICE=c:\BkOffice
  27. !endif
  28.  
  29. !if [DIR $(BKOFFICE) >NUL] != 0
  30. !   ERROR Cannot find project root at $(BKOFFICE), set BKOFFICE variable
  31. !endif
  32.  
  33. !ifndef INCLUDE
  34. !   ERROR INCLUDE variable is empty; must include at least system include directory
  35. !endif
  36.  
  37. !ifndef LIB
  38. !   ERROR LIB variable is empty; must include at least system lib directory
  39. !endif
  40.  
  41. !ifndef BLDTYPE
  42. BLDTYPE=DBG
  43. !endif
  44.  
  45. !ifndef CALL
  46. CALL=C
  47. !endif
  48.  
  49. !ifndef PACK
  50. PACK=YES
  51. !endif
  52.  
  53. !ifndef OUTERR
  54. OUTERR=NO
  55. !endif
  56.  
  57. !ifndef WARNING_LEVEL
  58. WARNING_LEVEL=3
  59. !endif
  60.  
  61. OSTARG=NTx86
  62. OSTAG=WIN32
  63. WINTAG=32
  64. CPUTARG=IX86
  65.  
  66.  
  67. #*********************************************
  68. # Tools
  69. #*********************************************
  70.  
  71. MAKEEXE = nmake
  72. IMPLIB  = implib
  73. CC      = cl
  74. LIBU    = lib
  75. LINK    = link
  76. RC      = rc
  77. MC      = mc
  78. HC      = hc
  79.  
  80.  
  81. #*********************************************
  82. #
  83. # Directories
  84. #
  85. # DIRINC   - project level include
  86. # DIRBIN   - project level executables
  87. # DIRLIB   - project level libraries
  88. # DIRMAKE  - project makefiles
  89. #
  90. # DIRSRC   - component source directory
  91. # DIRH     - component headers
  92. # DIRRES   - component resources
  93. # DIRBLD   - component build directory
  94. # DIRPCHSRC- Pre-compiled header source directory
  95. # DIRPCH   - Pre-compiled header output directory
  96. #
  97. #*********************************************
  98.  
  99. # Project directories
  100. DIRINC=$(BKOFFICE)\include
  101. DIRLIB=$(BKOFFICE)\lib
  102. DIRBIN=$(BKOFFICE)\bin
  103. DIRMAKE=$(BKOFFICE)\include
  104.  
  105. # Component directories
  106. DIRBLD=.
  107. DIRSRC=.
  108. DIRH=.;$(DIRBLD)
  109. DIRRES=.
  110.  
  111. # Pre-compiled header directories
  112. DIRPCHSRC=$(BKOFFICE)\Samples\Exchange\Tools\PreCompH
  113. DIRPCH=$(BKOFFICE)\Samples\Exchange\Tools\PreCompH
  114.  
  115. #*********************************************
  116. # Paths
  117. #*********************************************
  118.  
  119. PATH    = $(DIRBIN);$(PATH)
  120. LIB     = $(DIRLIB);$(LIB)
  121. INCLUDE = $(DIRH);$(DIRINC);$(INCLUDE)
  122.  
  123.  
  124. #*********************************************
  125. # Output Redirection
  126. #*********************************************
  127.  
  128. !if "$(OUTERR)" == "NO"
  129. ERRFILE=
  130. OSYM=
  131. !else
  132. ERRFILE=$(DIRBLD)\$(COMP).err
  133. OSYM= >>
  134. !endif
  135.  
  136.  
  137. #*********************************************
  138. # Basic Compile Flags
  139. #*********************************************
  140.  
  141. # CL is for all C and C++ files
  142. CL= -I. -c -G3s -MT -W$(WARNING_LEVEL) -WX -J -Zp -Fo$(DIRBLD)^\ -nologo $(CL)
  143.  
  144. # NT/CPU specific flags
  145. CL= -DWIN32 -D_X86_ $(CL)
  146.  
  147. # CFLAGS is for C files
  148. #CFLAGS=$(CFLAGS)
  149.  
  150. # CPPFLAGS is for C++ files
  151. #CPPFLAGS=$(CPPFLAGS)
  152.  
  153. # LFLAGS is for linking
  154. LFLAGS=/NOD /NOLOGO -machine:$(CPUTARG) -out:$@ $(LFLAGS)
  155.  
  156. # DLLFLAGS is for linking DLLs
  157. DLLFLAGS=$(LFLAGS) -dll -def:$(@B).def -map:$(DIRBLD)\$(COMP).map $(DLLFLAGS)
  158.  
  159. # LIBFLAGS is for building libraries
  160. LIBFLAGS=-nologo -machine:$(CPUTARG) -out:$@ $(LIBFLAGS)
  161.  
  162. # RFLAGS is for Windows resources
  163. RFLAGS=/r -I$(DIRRES) -fo$@ $(RFLAGS)
  164.  
  165. # MFLAGS is for the message compiler
  166. MFLAGS=-v -s -h $(DIRBLD) -r $(DIRBLD) -x $(DIRBLD) $(MFLAGS)
  167.  
  168. # MRFLAGS is for the resource compiler when used after the message compiler
  169. MRFLAGS=-l 409 -r -x -i$(DIRBLD) $(MRFLAGS)
  170.  
  171. #*********************************************
  172. # Pre-compiled header macros
  173. # NOPCH     - Define this to disable use and creation of precompiled headers.
  174. # PCHUSE    - The default pre-compiled header for .C source files.
  175. # PCUSECPP  - The default pre-compiled header for .CPP source files.
  176. #
  177. # PCHCR1    - To create the PCH file most .C sources depend upon.   (edk.h)
  178. # PCHUSE1   - To use the PCH file most .C sources depend upon.      (edk.h)
  179. # PCHCR2    - To create the PCH file most .CPP sources depend upon. (edk.h)
  180. # PCHUSE2   - To use the PCH file most .CPP sources depend upon.    (edk.h)
  181. # PCHCR3    - To create MFC PCH.                                 (edkafx.h)
  182. # PCHUSE3   - To use MFC PCH.                                    (edkafx.h)
  183. # PCHCR4    - To create the UNICODE PCH file for .C sources.        (edk.h)
  184. # PCHUSE4   - To use the UNICODE PCH file for .C sources.           (edk.h)
  185. #*********************************************
  186.  
  187. !ifndef NOPCH
  188. # We are using precompiled headers.
  189.  
  190. PCHCR1  =  /Fp$(DIRPCH)\edk.pch    /Yc"edk.h"    -Fo$(DIRPCH)\ /Yd
  191. PCHUSE1 =  /Fp$(DIRPCH)\edk.pch    /Yu"edk.h"
  192. PCHCR2  =  /Fp$(DIRPCH)\edkx.pch   /Yc"edk.h"    -Fo$(DIRPCH)\ /Yd
  193. PCHUSE2 =  /Fp$(DIRPCH)\edkx.pch   /Yu"edk.h"
  194. PCHCR3  =  /Fp$(DIRPCH)\edkafx.pch /Yc"edkafx.h" -Fo$(DIRPCH)\ /Yd
  195. PCHUSE3 =  /Fp$(DIRPCH)\edkafx.pch /Yu"edkafx.h"
  196. PCHCR4  =  /Fp$(DIRPCH)\edku.pch   /Yc"edk.h"    -Fo$(DIRPCH)\ /Yd
  197. PCHUSE4 =  /Fp$(DIRPCH)\edku.pch   /Yu"edk.h"
  198.  
  199. # Overide this to change the default pre-compiled header.
  200. # You can also blank this if not using pre-compiled headers.
  201. !ifndef PCHUSE
  202. PCHUSE=$(PCHUSE1)
  203. !endif
  204. !ifndef PCHUSECPP
  205. PCHUSECPP=$(PCHUSE2)
  206. !endif
  207.  
  208. PCHOBJ1 = $(DIRPCH)\edk.obj
  209. PCHOBJ2 = $(DIRPCH)\edkx.obj
  210. PCHOBJ3 = $(DIRPCH)\edkafx.obj
  211. PCHOBJ4 = $(DIRPCH)\edku.obj
  212.  
  213. !else
  214. # NOT using precompiled headers.
  215. !include "nopch.inc"
  216. !endif
  217.  
  218. #*********************************************
  219. # Calling convention Flag
  220. #*********************************************
  221.  
  222. # Pascal Calling convention
  223. !if "$(CALL)"=="PASCAL"
  224. CL=-Gc $(CL)
  225. !endif
  226.  
  227.  
  228. #*********************************************
  229. # Function Packaging Flag
  230. #*********************************************
  231.  
  232. # Function packaging flag
  233. !if "$(PACK)" == "YES"
  234. CL=-Gy $(CL)
  235. !endif
  236.  
  237.  
  238. #*********************************************
  239. # Optimization Flags
  240. #*********************************************
  241.  
  242. !if "$(BLDTYPE)"=="SHP"
  243. CL=-Ob1 -Og -Os $(CL)
  244. !endif
  245.  
  246. !if "$(BLDTYPE)"=="DBG"
  247. CL=-Od -Z7 $(CL)
  248. !endif
  249.  
  250. !if "$(BLDTYPE)"=="TST"
  251. CL=-Ob1 -Og -Os $(CL)
  252. !endif
  253.  
  254.  
  255. #*********************************************
  256. # Build Type Flags
  257. #*********************************************
  258.  
  259. !if "$(BLDTYPE)"=="SHP"
  260. CL=-DSHIP $(CL)
  261. LFLAGS=-debug:none -nodefaultlib:libc $(LFLAGS)
  262. !endif
  263.  
  264. !if "$(BLDTYPE)"=="DBG"
  265. CL=-DDEBUG -DTEST $(CL) 
  266. LFLAGS=-debug:full -debugtype:cv -nodefaultlib:libc -incremental:no -pdb:none $(LFLAGS) 
  267. !endif
  268.  
  269. !if "$(BLDTYPE)"=="TST"
  270. CL=-DTEST $(CL)
  271. LFLAGS=-debug:none  -nodefaultlib:libc $(LFLAGS)
  272. !endif
  273.  
  274.  
  275. #*********************************************
  276. # Default Libraries
  277. #*********************************************
  278.  
  279. # C Libraries 
  280. CLIBS =  libcmt.lib \
  281.          oldnames.lib
  282.  
  283. # NT Libraries
  284. NTLIBS = kernel32.lib \
  285.          user32.lib   \
  286.          shell32.lib  \
  287.          gdi32.lib    \
  288.          ole32.lib    \
  289.          uuid.lib     \
  290.          winspool.lib \
  291.          comdlg32.lib \
  292.          advapi32.lib \
  293.          netapi32.lib \
  294.          imagehlp.lib \
  295.          wsock32.lib  \
  296.          rpcdce4.lib  \
  297.          rpcndr.lib   \
  298.          rpcns4.lib   \
  299.          rpcrt4.lib
  300.         
  301. # MAPI Libraries
  302. MAPILIBS = MAPI32.LIB
  303.  
  304. # Library List
  305. # Components should either add to this list with a line like:
  306. #      LIBLIST = $(LIBLIST) mylibs
  307. # or, if they don't need all the default libs, (e.g. if don't need MAPI):
  308. #      LIBLIST = $(CLIBS) $(NTLIBS) mylibs
  309. LIBLIST = $(LIBLIST) $(CLIBS) $(NTLIBS) $(MAPILIBS)
  310.  
  311. # Objects
  312. # This is just a default setting, expect most make files to 
  313. # overide this (i.e. if they have more than one object or their
  314. # one object is not named $(COMP).obj
  315. !ifndef OBJLIST
  316. OBJLIST=$(DIRBLD)\$(@B).OBJ
  317. !endif
  318.  
  319.  
  320. #*********************************************
  321. # Inference Rules
  322. #*********************************************
  323.  
  324. # C Targets
  325. {$(DIRSRC)\}.c{$(DIRBLD)\}.obj:
  326. !if "$(OUTERR)"=="YES"
  327.     @echo $(CC) $(CL) $(PCHUSE) $(CFLAGS) $< $(OSYM) $(ERRFILE)
  328. !endif
  329.     $(CC) $(CL) $(PCHUSE) $(CFLAGS) $< $(OSYM) $(ERRFILE)
  330.  
  331. # C++ Targets
  332. {$(DIRSRC)\}.cpp{$(DIRBLD)\}.obj:
  333. !if "$(OUTERR)"=="YES"
  334.     @echo $(CC) $(CL) $(PCHUSECPP) $(CPPFLAGS) $< $(OSYM) $(ERRFILE)
  335. !endif
  336.     $(CC) $(CL) $(PCHUSECPP) $(CPPFLAGS) $< $(OSYM) $(ERRFILE)
  337.  
  338. # Resource Targets from .RC files
  339. {$(DIRRES)\}.rc{$(DIRBLD)\}.res:
  340. !if "$(OUTERR)"=="YES"
  341.     @echo $(RC) $(RFLAGS) $(DIRRES)\$(@B).rc $(OSYM) $(ERRFILE)
  342. !endif
  343.     $(RC) $(RFLAGS) $(DIRRES)\$(@B).rc $(OSYM) $(ERRFILE)
  344.  
  345. # Resource Targets from .MC files
  346. .SUFFIXES: .mc
  347. {$(DIRSRC)\}.mc{$(DIRBLD)\}.res:
  348. !if "$(OUTERR)"=="YES"
  349.     @echo $(MC) $(MFLAGS) $< $(OSYM) $(ERRFILE)
  350. !endif
  351.     $(MC) $(MFLAGS) $< $(OSYM) $(ERRFILE)
  352. !if "$(OUTERR)"=="YES"
  353.     @echo $(RC) $(MRFLAGS) -fo$(DIRBLD)\$(@B).res $(DIRBLD)\$(@B).rc $(OSYM) $(ERRFILE)
  354. !endif
  355.     $(RC) $(MRFLAGS) -fo$(DIRBLD)\$(@B).res $(DIRBLD)\$(@B).rc $(OSYM) $(ERRFILE)
  356. !if "$(OUTERR)"=="YES"
  357.     @echo del $(DIRBLD)\$(@B).rc $(OSYM) $(ERRFILE)
  358. !endif
  359.         del $(DIRBLD)\$(@B).rc $(OSYM) $(ERRFILE)
  360.  
  361. # Import Libraries
  362. {$(DIRSRC)\}.def{$(DIRBLD)\}.lib:
  363. !if "$(OUTERR)"=="YES"
  364.     @echo $(IMPLIB) -DEF:$(@B).DEF -OUT:$@ $(OSYM) $(ERRFILE)
  365. !endif
  366.     @echo $(IMPLIB) -DEF:$(@B).DEF -OUT:$@ $(OSYM) $(ERRFILE)
  367.     xcopy $@ $(DIRLIB) $(OSYM) $(ERRFILE)
  368.  
  369. # Static Libraries
  370. {$(DIRBLD)\}.obj{$(DIRBLD)\}.lib:
  371. !if "$(OUTERR)"=="YES"
  372.     @echo $(LIBU) $(LIBFLAGS) $** $(OSYM) $(ERRFILE)
  373. !endif
  374.     $(LIBU) $(LIBFLAGS) $** $(OSYM) $(ERRFILE)
  375.     xcopy $@ $(DIRLIB) $(OSYM) $(ERRFILE)
  376.  
  377. # DLLs
  378. {$(DIRBLD)\}.obj{$(DIRBLD)\}.dll:
  379.     @echo $** > $(DIRBLD)\objfiles.lst
  380.     @echo $(LIBLIST) > $(DIRBLD)\libfiles.lst
  381. !if "$(OUTERR)"=="YES"
  382.     @echo   $(LINK) $(DLLFLAGS) @$(DIRBLD)\objfiles.lst @$(DIRBLD)\libfiles.lst $(OSYM) $(ERRFILE)
  383. !endif
  384.     $(LINK) $(DLLFLAGS) @$(DIRBLD)\objfiles.lst @$(DIRBLD)\libfiles.lst $(OSYM) $(ERRFILE)
  385. !if "$(OUTERR)"=="YES"
  386.     @echo xcopy $(DIRBLD)\$(@B).lib $(DIRLIB) $(OSYM) $(ERRFILE)
  387. !endif
  388.     -xcopy $(DIRBLD)\$(@B).lib $(DIRLIB) $(OSYM) $(ERRFILE)
  389.  
  390. # EXEs
  391. {$(DIRBLD)\}.obj{$(DIRBLD)\}.exe:
  392.     @echo $(OBJLIST) > $(DIRBLD)\objfiles.lst
  393.     @echo $(LIBLIST) > $(DIRBLD)\libfiles.lst
  394. !if "$(OUTERR)"=="YES"
  395.     @echo   $(LINK) $(LFLAGS) @$(DIRBLD)\objfiles.lst @$(DIRBLD)\libfiles.lst $(OSYM) $(ERRFILE)
  396. !endif
  397.     $(LINK) $(LFLAGS) @$(DIRBLD)\objfiles.lst @$(DIRBLD)\libfiles.lst $(OSYM) $(ERRFILE)
  398.  
  399.  
  400. #*********************************************
  401. # Define the post-include file
  402. #*********************************************
  403.  
  404. #ifndef POSTINCL
  405. POSTINCL=$(BKOFFICE)\Include\postmake.inc
  406. #endif
  407.