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.

473 lines
11 KiB

  1. # RATINGS common make file
  2. ##########################################################################
  3. #
  4. # Microsoft Confidential
  5. # Copyright (C) Microsoft Corporation 1991
  6. # All Rights Reserved.
  7. #
  8. ##########################################################################
  9. #
  10. # debug builds a debug version
  11. # retail builds the shipping version
  12. #
  13. # Here's how to use this:
  14. # Define NAME and ROOT
  15. # All OBJ's that should be built assuming a PCH file should be listed in
  16. # a PCHOBJx define (x=0-9). All C files that should be built "normally"
  17. # and all other OBJs (from ASM or for which there are special build rules)
  18. # should be in an MISCOBJx define. Be sure to start filling OBJx defines
  19. # from x=0.
  20. # Libraries should be listed in LIBx defines (default is libw and lnocrtw).
  21. # Define BUILDDLL if this is DLL code.
  22. # Define BUILDLIB if the target is a static link library.
  23. # Define APPEXT if the extension is other than EXE or DLL.
  24. # Define BINARYNAME if the EXE/DLL/etc. name is different from NAME.
  25. # Add extra dependencies where appropriate.
  26. # Include this file.
  27. #
  28. !CMDSWITCHES -s
  29. !ifndef NAME
  30. !ERROR NAME environment variable not defined.
  31. !endif
  32. !ifndef ROOT
  33. !ERROR ROOT environment variable not defined.
  34. !endif
  35. !ifndef BINARYNAME
  36. BINARYNAME=$(NAME)
  37. !endif
  38. !ifndef PRIVINC
  39. PRIVINC=$(NAME)
  40. !endif
  41. !ifndef APPEXT
  42. !ifdef BUILDDLL
  43. APPEXT=dll
  44. !else
  45. APPEXT=exe
  46. !endif
  47. !endif
  48. IS_32=TRUE
  49. ###IS_PRIVATE=TRUE
  50. ###IS_SDK=TRUE
  51. WANT_C932=TRUE
  52. MASM6 = TRUE
  53. !ifndef RETAILVERDIR
  54. RETAILVERDIR=retail32
  55. !endif
  56. !ifndef DEBUGVERDIR
  57. DEBUGVERDIR=debug32
  58. !endif
  59. RATINGSROOT=$(ROOT)\inet\ohare\ratings
  60. # The following helps us LEGOIZE components that link to MSRATING.DLL.
  61. CVWRETAIL=1
  62. !ifdef PROPAGATE_BINARIES
  63. !ifndef BINARIES_DIR
  64. BINARIES_DIR=$(RATINGSROOT)\bin
  65. !endif
  66. !endif
  67. MISCOBJS=$(MISCOBJ0) $(MISCOBJ1) $(MISCOBJ2) $(MISCOBJ3) $(MISCOBJ4) \
  68. $(MISCOBJ5) $(MISCOBJ6) $(MISCOBJ7) $(MISCOBJ8) $(MISCOBJ9)
  69. PCHOBJS=$(PCHOBJ0) $(PCHOBJ1) $(PCHOBJ2) $(PCHOBJ3) $(PCHOBJ4) \
  70. $(PCHOBJ5) $(PCHOBJ6) $(PCHOBJ7) $(PCHOBJ8) $(PCHOBJ9)
  71. !ifdef PCHOBJ0
  72. !if "$(MISCOBJS:pch.obj=)" == "$(MISCOBJS)"
  73. INFERPCH=TRUE
  74. MISCOBJ9=$(MISCOBJ9) pch.obj
  75. MISCOBJS=$(MISCOBJS) pch.obj
  76. !endif
  77. !endif
  78. WIN32LIBS=kernel32.lib user32.lib gdi32.lib comdlg32.lib advapi32.lib winspool.lib $(ROOT)\dev\lib\mpr.lib
  79. OBJS=$(MISCOBJS) $(PCHOBJS)
  80. LIBS=$(LIB0) $(LIB1) $(LIB2) $(LIB3) $(LIB4) $(LIB5) \
  81. $(LIB6) $(LIB7) $(LIB8) $(LIB9)
  82. !ifdef BUILDLIB
  83. LIBOBJS=$(OBJS)
  84. L32NAME=$(BINARYNAME).lib
  85. !endif
  86. !IFNDEF VERDIR
  87. # repcmd doesn't seem to like leading or trailing spaces
  88. !ifdef VERSIONLIST
  89. VERSIONLIST=$(DEBUGVERDIR) $(RETAILVERDIR) $(VERSIONLIST)
  90. !else
  91. VERSIONLIST=$(DEBUGVERDIR) $(RETAILVERDIR)
  92. !endif
  93. COMMONMKFILE=makefile
  94. !if "$(BUILD)" == "$(DEBUGVERDIR)"
  95. DEFAULTVERDIR=$(DEBUGVERDIR)
  96. !else
  97. DEFAULTVERDIR=$(RETAILVERDIR)
  98. !endif
  99. !if "$(DEBUGVERDIR)" != "debug"
  100. debug: $(DEBUGVERDIR)
  101. !endif
  102. !if "$(RETAILVERDIR)" != "retail"
  103. retail: $(RETAILVERDIR)
  104. !endif
  105. DEPENDTARGETS=$(VERSIONLIST)
  106. !include $(RATINGSROOT)\ratings.mk
  107. !CMDSWITCHES -s
  108. .SUFFIXES: .thk .sbr
  109. $(NAME).res:
  110. cd $(BUILD)
  111. nmake BUILD=$(BUILD) VERDIR=$(BUILD) $(MISC) -f ..\makefile $(NAME).res
  112. cd ..
  113. !ELSE ## VERDIR
  114. SRCDIR=..
  115. CLEANLIST=$(CLEANLIST) $(BINARYNAME).$(APPEXT) $(PRIVINC).pch $(NAME).res *.cod
  116. !ifdef INFERPCH
  117. CLEANLIST=$(CLEANLIST) pch.c
  118. !endif
  119. !ifdef BUILDDLL
  120. CLEANLIST=$(CLEANLIST) stripped.def $(BINARYNAME).lib
  121. !endif
  122. !include $(RATINGSROOT)\ratings.mk
  123. .SUFFIXES: .thk
  124. !CMDSWITCHES -s
  125. AFLAGS = $(AFLAGS) -Gc -DBUILDDLL
  126. RCFLAGS = $(RCFLAGS) -DIS_32
  127. !ifdef WANT_C932
  128. RC=$(DEVROOT)\tools\$(CC32DIR)\bin\rc
  129. !else
  130. RC=$(DEVROOT)\tools\c832\bin\rc
  131. !endif
  132. !IF "$(VERDIR)" == "$(DEBUGVERDIR)"
  133. CFLAGS = -Zip -c /Od -DDEBUG
  134. #AFLAGS = $(AFLAGS) /Zm
  135. RCFLAGS = $(RCFLAGS) -DDEBUG
  136. !ifdef MAXDEBUG
  137. CUSTOMFLAGS=-DMAXDEBUG
  138. XTRACFLAGS=-DMAXDEBUG
  139. !endif
  140. !ELSE
  141. CFLAGS = /Oxs /Zp
  142. !IFDEF CVWRETAIL
  143. CFLAGS = $(CFLAGS) /Zip
  144. AFLAGS = $(AFLAGS) /Zi
  145. !ENDIF
  146. !ENDIF
  147. # Create .SBR files for browser database
  148. !ifdef BROWSE
  149. CFLAGS = $(CFLAGS) -Fr
  150. !endif
  151. # I want to make sure CL and ML are set in the environment
  152. !IF [set CL=;]
  153. !ENDIF
  154. !IF [set ML=;]
  155. !ENDIF
  156. #international mods
  157. #note INTL_SRC, and LANG are external macros set by international
  158. !IFDEF LANG
  159. TARGETS=$(TARGETS) $(BINARYNAME).$(LANG)
  160. !ELSE
  161. TARGETS=$(TARGETS) $(BINARYNAME).$(APPEXT)
  162. !ifdef MKPUBLIC
  163. TARGETS=$(TARGETS) $(BINARYNAME).lib
  164. !endif
  165. !ENDIF
  166. !ifndef COMPILE_C_SOURCE
  167. FORCE_CPP=/Tp
  168. !endif
  169. CFLAGS=$(CFLAGS) -c -J -W3 -Gs -GBz -D_X86_ -DIS_32 -DWIN32=1 -DNOBASICTYPES $(XTRACFLAGS) $(CUSTOMCFLAGS)
  170. !ifndef NOCODFILES
  171. CFLAGS=$(CFLAGS) -Fc
  172. !endif
  173. !ifdef PC_98
  174. CFLAGS=$(CFLAGS) -DPC_98
  175. !endif
  176. !ifdef DBCS
  177. CFLAGS=$(CFLAGS) -DDBCS
  178. !endif
  179. !ifdef BUILDDLL
  180. CL = $(CFLAGS) -DBUILDDLL
  181. !else
  182. CL = $(CFLAGS)
  183. !endif
  184. ML = $(AFLAGS)
  185. CCH=$(CC) -Yc$(PRIVINC).h
  186. CCU=$(CC) -Yu$(PRIVINC).h
  187. #BUGBUG - if slow link problems come back, add -opt:noref to LINK32FLAGS.
  188. # -- gregj, 09/21/93
  189. LINK32FLAGS= -align:4096 -nologo -nodefaultlib $(XTRALFLAGS) $(CUSTOMLFLAGS)
  190. ###LFLAGS = /ALIGN:16 /MAP /NOE /NOD /ONERROR:NOEXE $(XTRALFLAGS) $(CUSTOMLFLAGS)
  191. ###!IF "$(VERDIR)" == "$(DEBUGVERDIR)" || DEFINED(CVWRETAIL)
  192. ###LFLAGS = /CO $(LFLAGS) # debug linker flags
  193. ###!ENDIF
  194. ###
  195. ### Thunk compiler definitions and flags
  196. ###
  197. TNT = $(ROOT)\dev\tools\c\bin\tnt.exe
  198. THUNKCOM = $(ROOT)\dev\tools\binr\thunk.exe
  199. THUNK = $(THUNKCOM) $(THUNKOPT)
  200. !IF "$(VERDIR)" == "maxdebug" || "$(VERDIR)" == "$(DEBUGVERDIR)"
  201. ##THUNKOPT = -ynT
  202. !ELSE
  203. ##THUNKOPT = -ynTb
  204. !ENDIF
  205. THUNKDIR=$(ROOT)\win\core\thunk
  206. # Include files inserted by the thunk compiler for the 16-bit half.
  207. THUNKINCS16=$(THUNKDIR)\thk.inc \
  208. $(ROOT)\win\core\inc\winerror.inc \
  209. $(ROOT)\win\core\inc\win31err.inc
  210. default: $(BINARYNAME).$(APPEXT)
  211. !ifndef RES_DIR
  212. RES_DIR=$(SRCDIR)
  213. !endif
  214. # Individual makefiles should have more dependencies if needed
  215. # Note that the RES file doesn't really depend on the PCH file, but
  216. # it does depend on everthing the PCH file depends on.
  217. $(NAME).res: $(RES_DIR)\$(NAME).rc \
  218. $(RES_DIR)\$(NAME).rcv \
  219. $(PRIVINC).pch
  220. $(RC) -r $(RCFLAGS) -I$(SRCDIR) -DWIN32 -I$(RES_DIR) -Fo$(NAME).res $(RES_DIR)\$(NAME).rc
  221. # inference rules for build
  222. {$(SRCDIR)}.thk.obj:
  223. set INCLUDE=$(INCLUDE);$(THUNKDIR);$(ROOT)\win\core\inc
  224. $(THUNK) $(THUNKTYPE) -t $(@B) $(SRCDIR)\$*.thk
  225. $(ASM) -DSTD_CALL -DIS_32 -DMASM6 -DDEBLEVEL=1 -Gc -Cx -Fo$@ $(SRCDIR)\$*.asm
  226. del $(SRCDIR)\$*.asm
  227. {$(SRCDIR)}.c.obj:
  228. set CL=$(CL)
  229. $(CC) $(FORCE_CPP) $(SRCDIR)\$*.c
  230. {$(SRCDIR)}.c.cod:
  231. set CL=$(CL)
  232. $(CC) /Fc $(FORCE_CPP) $(SRCDIR)\$*.c
  233. {$(SRCDIR)}.cpp.obj:
  234. set CL=$(CL)
  235. $(CC) $(SRCDIR)\$*.cpp
  236. {$(SRCDIR)}.cpp.cod:
  237. set CL=$(CL)
  238. $(CC) /Fc $(SRCDIR)\$*.cpp
  239. {$(SRCDIR)}.asm.obj:
  240. $(ASM) $(AFLAGS) $(SRCDIR)\$*.asm
  241. !ifdef INFERPCH
  242. PCHSRC=pch.cpp
  243. $(PCHSRC):
  244. echo #include "$(PRIVINC).h" > $(PCHSRC)
  245. !else
  246. PCHSRC=$(SRCDIR)\pch.cpp
  247. !endif
  248. # Individual makefiles should have more dependencies if needed
  249. $(PRIVINC).pch pch.obj: $(PCHSRC) $(SRCDIR)\$(PRIVINC).h
  250. set CL=$(CL)
  251. $(CCH) -I$(SRCDIR) $(FORCE_CPP) $(PCHSRC)
  252. !ifdef PCHOBJ0
  253. $(PCHOBJ0): $(PRIVINC).pch
  254. set CL=$(CL)
  255. $(CCU) $(FORCE_CPP) $(SRCDIR)\$*.cpp
  256. !endif
  257. !ifdef PCHOBJ1
  258. $(PCHOBJ1): $(PRIVINC).pch
  259. set CL=$(CL)
  260. $(CCU) $(FORCE_CPP) $(SRCDIR)\$*.cpp
  261. !endif
  262. !ifdef PCHOBJ2
  263. $(PCHOBJ2): $(PRIVINC).pch
  264. set CL=$(CL)
  265. $(CCU) $(FORCE_CPP) $(SRCDIR)\$*.cpp
  266. !endif
  267. !ifdef PCHOBJ3
  268. $(PCHOBJ3): $(PRIVINC).pch
  269. set CL=$(CL)
  270. $(CCU) $(FORCE_CPP) $(SRCDIR)\$*.cpp
  271. !endif
  272. !ifdef PCHOBJ4
  273. $(PCHOBJ4): $(PRIVINC).pch
  274. set CL=$(CL)
  275. $(CCU) $(FORCE_CPP) $(SRCDIR)\$*.cpp
  276. !endif
  277. !ifdef PCHOBJ5
  278. $(PCHOBJ5): $(PRIVINC).pch
  279. set CL=$(CL)
  280. $(CCU) $(FORCE_CPP) $(SRCDIR)\$*.cpp
  281. !endif
  282. !ifdef PCHOBJ6
  283. $(PCHOBJ6): $(PRIVINC).pch
  284. set CL=$(CL)
  285. $(CCU) $(FORCE_CPP) $(SRCDIR)\$*.cpp
  286. !endif
  287. !ifdef PCHOBJ7
  288. $(PCHOBJ7): $(PRIVINC).pch
  289. set CL=$(CL)
  290. $(CCU) $(FORCE_CPP) $(SRCDIR)\$*.cpp
  291. !endif
  292. !ifdef PCHOBJ8
  293. $(PCHOBJ8): $(PRIVINC).pch
  294. set CL=$(CL)
  295. $(CCU) $(FORCE_CPP) $(SRCDIR)\$*.cpp
  296. !endif
  297. !ifdef PCHOBJ9
  298. $(PCHOBJ9): $(PRIVINC).pch
  299. set CL=$(CL)
  300. $(CCU) $(FORCE_CPP) $(SRCDIR)\$*.cpp
  301. !endif
  302. #############################################################
  303. # The main target: a static link library or a linked module.
  304. #############################################################
  305. !ifndef BUILDLIB
  306. !ifndef L32BASE
  307. L32BASE=@$(ROOT)\dev\inc\coffbase.txt,$(BINARYNAME)
  308. !endif
  309. !ifndef DEFNAME
  310. DEFNAME=$(SRCDIR)\$(NAME).def
  311. !endif
  312. DEPENDS=$(DEPENDS) $(OBJS) $(DEPENDLIBS) $(DEFNAME)
  313. $(BINARYNAME).lib $(BINARYNAME).exp: $(DEPENDS)
  314. !ifdef LIBDIR
  315. mkdir $(LIBDIR)
  316. !endif # LIBDIR
  317. copy $(DEFNAME) $(NAME).def
  318. $(LINKW32) -lib -nologo @<<
  319. -out:$(BINARYNAME).lib
  320. -machine:i386
  321. -def:$(NAME).def
  322. -debugtype:cv,fixup
  323. $(OBJS)
  324. <<
  325. !ifdef PROPAGATE_BINARIES
  326. -copy $(BINARYNAME).lib $(BINARIES_DIR)\$(VERDIR)
  327. !endif
  328. $(BINARYNAME).$(APPEXT): $(BINARYNAME).exp $(DEPENDS) $(NAME).res
  329. $(LINKW32) -link @<<
  330. $(LINK32FLAGS)
  331. -out:$(BINARYNAME).$(APPEXT)
  332. !ifdef BUILDDLL
  333. -dll
  334. !endif
  335. -subsystem:windows,4.0
  336. !IF "$(VERDIR)" == "$(RETAILVERDIR)"
  337. -debug:none
  338. !ifndef IGNORE_L32BASE
  339. -debugtype:coff
  340. !endif
  341. !ELSE
  342. !ifdef CODEVIEW
  343. -debug:full
  344. -pdb:none
  345. !else
  346. -debug:none
  347. !endif
  348. -debugtype:cv
  349. !ENDIF
  350. -machine:i386
  351. !ifndef IGNORE_L32BASE
  352. -base:$(L32BASE)
  353. !endif
  354. !IF "$(L32ENTRY)"!=""
  355. -entry:$(L32ENTRY)
  356. !ENDIF
  357. -map:$(BINARYNAME).map
  358. -align:0x1000
  359. !ifdef WANT_C932
  360. -merge:.rdata=.text
  361. -merge:.bss=.data
  362. !endif
  363. $(LIBS)
  364. $(BINARYNAME).exp
  365. $(OBJS)
  366. $(NAME).res
  367. <<
  368. $(MAPSYM) $(MFLAGS) $(BINARYNAME).map
  369. !ifdef PROPAGATE_BINARIES
  370. if not exist $(BINARIES_DIR)\$(VERDIR)\nul mkdir $(BINARIES_DIR)\$(VERDIR)
  371. -copy $(BINARYNAME).$(APPEXT) $(BINARIES_DIR)\$(VERDIR)
  372. -copy $(BINARYNAME).sym $(BINARIES_DIR)\$(VERDIR)
  373. !endif
  374. !else # BUILDLIB
  375. $(L32NAME): $(LIBOBJS)
  376. $(LINKW32) -lib @<<
  377. $(LIBOBJS)
  378. -out:$(L32NAME)
  379. -machine:i386
  380. -subsystem:windows
  381. <<
  382. !ifdef PROPAGATE_BINARIES
  383. -copy $(BINARYNAME).lib $(BINARIES_DIR)\$(VERDIR)
  384. !endif
  385. !endif # BUILDLIB
  386. !ENDIF ## VERDIR