Make.Inc 10 KB

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