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.

319 lines
9.0 KiB

  1. #=------------------------------------------------------------------------=
  2. # MakeCtl.Inc
  3. #=------------------------------------------------------------------------=
  4. # Copyright 1995 Microsoft Corporation. All Rights Reserved.
  5. #
  6. # THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
  7. # ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
  8. # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
  9. # PARTICULAR PURPOSE.
  10. #=--------------------------------------------------------------------------=
  11. #
  12. # builds a control. Assumes existence of $(CONTROLNAME), and $(OBJS)
  13. #
  14. .SUFFIXES: .s
  15. #
  16. # Determine the build type.
  17. # You can use this constant to make relative path references to
  18. # other binaries that you need to link to. For example,
  19. # ..\..\MyLib\$(BUILDTYPE)\MyLib.Lib
  20. #
  21. !if "$(ASDEBUG)" != ""
  22. BUILDTYPE=DEBUG
  23. BUILDLIB=LIBDBG
  24. !elseif "$(ASICECAP)" != ""
  25. BUILDTYPE=ICECAP
  26. BUILDLIB=LIBICE
  27. !else
  28. BUILDTYPE=RELEASE
  29. BUILDLIB=LIBREL
  30. !endif
  31. #
  32. # targets
  33. #
  34. VERSIONHDR=dwinvers.h
  35. #
  36. # support for naming your OCX something other than CONTROLNAME
  37. #
  38. !if "$(_SERVERFILENAME)"==""
  39. _SERVERFILENAME=$(CONTROLNAME).Ocx
  40. !endif
  41. !if "$(_DEFBASENAME)"==""
  42. _DEFBASENAME=$(CONTROLNAME)
  43. !endif
  44. # Tools
  45. #
  46. !include "Tools.Inc"
  47. SRCDIR=..
  48. FXDIR=..\..\FrameWrk
  49. !if "$(VC4_BUILD)" != ""
  50. _CFLAGS=$(_CFLAGS) -DVC4_BUILD=1
  51. !endif
  52. # build specific flags
  53. #
  54. !if "$(ASDEBUG)"!=""
  55. #
  56. # debug
  57. #
  58. LIBS=$(FXDIR)\Debug\CtlFwD32.Lib
  59. !if "$(VC4_BUILD)" == ""
  60. LIBS=$(LIBS) $(DEVBIN)\htmlhelp\v6\debug\lib\htmlhelp.lib
  61. !endif
  62. CFLAGS=-Zil -DDEBUG -Od -FI..\..\include\vc41warn.h
  63. ! if "$(PROCESSOR_ARCHITECTURE)"=="ALPHA"
  64. CFLAGS=$(CFLAGS) -QAieee
  65. ! endif
  66. !if "$(PDBYES)"==""
  67. LFLAGS=-debugtype:cv -debug:notmapped,full -pdb:none
  68. !else
  69. LFLAGS=-debugtype:cv -debug:notmapped,full
  70. !endif
  71. RCFLAGS=-dDEBUG
  72. MLFLAGS=-Zi
  73. !if "$(PROCESSOR_ARCHITECTURE)"=="ALPHA"
  74. MLFLAGS=$(MLFLAGS) -Gy
  75. !endif
  76. !else if "$(ASICECAP)"!=""
  77. #
  78. # ICECap
  79. #
  80. LIBS=$(FXDIR)\IceCap\CtlFwI32.Lib ICap.Lib msvcrt.lib
  81. !if "$(VC4_BUILD)" == ""
  82. LIBS=$(LIBS) $(DEVBIN)\htmlhelp\v6\retail\lib\htmlhelp.lib
  83. !endif
  84. #
  85. CFLAGS=-Gh -Zil -Oxsb1 -DICECAP -FI..\..\include\vc41warn.h
  86. LFLAGS=-debug:mapped
  87. MLFLAGS=-Zi
  88. _SERVERDEP=$(_SERVERDEP) ..\..\framewrk\icecap\CtlFwI32.Lib ..\..\vblic\icecap\vblic.lib
  89. !if "$(PROCESSOR_ARCHITECTURE)"=="ALPHA"
  90. MLFLAGS=$(MLFLAGS) -Gy
  91. !endif
  92. !else
  93. #
  94. # Release
  95. #
  96. LIBS=$(FXDIR)\Release\CtlFwR32.Lib
  97. !if "$(VC4_BUILD)" == ""
  98. LIBS=$(LIBS) $(DEVBIN)\htmlhelp\v6\retail\lib\htmlhelp.lib
  99. !endif
  100. !if "$(SPENABLED)"==""
  101. #
  102. CFLAGS=-Zil -Oxsb1 -GF -FI..\..\include\vc41warn.h
  103. ! if "$(PROCESSOR_ARCHITECTURE)"=="ALPHA"
  104. CFLAGS=$(CFLAGS) -QAl -QAieee
  105. ! endif
  106. !else
  107. #
  108. CFLAGS=-Zil -Oxsb1 -FI..\..\include\vc41warn.h
  109. ! if "$(PROCESSOR_ARCHITECTURE)"=="ALPHA"
  110. CFLAGS=$(CFLAGS) -QAl -QAieee
  111. ! endif
  112. !endif
  113. #LNK4078: multiple ".text" sections found with different attributes (40000040)
  114. LFLAGS=/optidata /merge:.rdata=.text /ignore:4078 -OPT:REF -OPT:ICF,4
  115. MLFLAGS=-Zi
  116. !if "$(PROCESSOR_ARCHITECTURE)"=="ALPHA"
  117. MLFLAGS=$(MLFLAGS) -Gy
  118. !endif
  119. _SERVERDEP=$(_SERVERDEP) ..\..\framewrk\release\CtlFwR32.Lib ..\..\vblic\release\vblic.lib
  120. !if "$(PROCESSOR_ARCHITECTURE)"=="ALPHA"
  121. CFLAGS=$(CFLAGS) -QAl -QAieee
  122. MLFLAGS=$(MLFLAGS) -Gy
  123. !endif
  124. LFLAGS=$(LFLAGS) -debugtype:fixup,cv -debug:notmapped,full
  125. !endif
  126. #
  127. # This is to turn on or off the browse info file
  128. # If CTLS_BROWSE environment variable is set then turn on the
  129. # browse file stuff.
  130. !if "$(CTLS_BROWSE)"!=""
  131. CFLAGS=$(CFLAGS) /FR
  132. BSCMAKE=bscmake.exe
  133. !endif
  134. #
  135. # default flags
  136. #
  137. INCPATH=-I. -I$(SRCDIR) -I..\..\include $(_INCPATH) -I$(DEVBINC)\htmlhelp\v6\idl\include
  138. !if "$(PROCESSOR_ARCHITECTURE)"=="ALPHA"
  139. MLFLAGS=$(INCPATH) -nologo $(MLFLAGS)
  140. !elseif "$(PROCESSOR_ARCHITECTURE)"=="MIPS"
  141. MLFLAGS=-c $(INCPATH) -nologo $(MLFLAGS)
  142. !elseif "$(PROCESSOR_ARCHITECTURE)"=="PPC"
  143. MLFLAGS=$(INCPATH) -nologo $(MLFLAGS)
  144. !else
  145. MLFLAGS=-c -coff $(INCPATH) -nologo $(MLFLAGS)
  146. !endif
  147. RCFLAGS=-r -dRC_INVOKED $(RCFLAGS) $(_RCFLAGS) $(INCPATH)
  148. !if "$(ASDEBUG)" != ""
  149. MKTYPLIBFLAGS=$(MKTYPLIBFLAGS) -DDEBUG
  150. MTLPREPROCFLAGS=$(MTLPREPROCFLAGS) -DDEBUG
  151. !elseif "$(ASICECAP)" != ""
  152. MKTYPLIBFLAGS=$(MKTYPLIBFLAGS) -DICECAP
  153. MTLPREPROCFLAGS=$(MTLPREPROCFLAGS) -DICECAP
  154. !endif
  155. !ifdef RISC_BLD
  156. LIBS=$(LIBS) $(_LIBS) kernel32.lib user32.lib ole32.lib advapi32.lib oldnames.lib oleaut32.nt4 comdlg32.lib gdi32.lib
  157. LFLAGS=$(LFLAGS) $(_LFLAGS) -nologo -out:$(_SERVERFILENAME) -DLL -subsystem:windows,4.00 -nodefaultlib -machine:$(PROCESSOR_ARCHITECTURE) -def:$(SRCDIR)\$(_DEFBASENAME).def
  158. CFLAGS=-nologo -c $(INCPATH) -Gd -Gy -W3 -WX -Oi -DRISC_BLD $(CFLAGS) $(_CFLAGS) -Tp
  159. MKTYPLIBFLAGS=$(_MKTYPLIBFLAGS) $(MKTYPLIBFLAGS) /DRISC_BLD
  160. MTLPREPROCFLAGS=$(_MTLPREPROCFLAGS) $(MTLPREPROCFLAGS) /DRISC_BLD
  161. !else
  162. LIBS= $(LIBS) $(_LIBS) kernel32.lib user32.lib ole32.lib advapi32.lib oldnames.lib oleaut32.nt4 comdlg32.lib gdi32.lib
  163. LFLAGS=$(LFLAGS) $(_LFLAGS) -nologo -out:$(_SERVERFILENAME) -DLL -subsystem:windows,4.00 -nodefaultlib -machine:i386 -def:$(SRCDIR)\$(_DEFBASENAME).def
  164. CFLAGS=-nologo -c $(INCPATH) -QIfdiv- -Gd -Gs -Gy -W3 -WX -Oi $(CFLAGS) $(_CFLAGS) -Tp
  165. MKTYPLIBFLAGS=$(_MKTYPLIBFLAGS) $(MKTYPLIBFLAGS)
  166. MTLPREPROCFLAGS=$(_MTLPREPROCFLAGS) $(MTLPREPROCFLAGS)
  167. !endif
  168. # Clients can choose to link with their own versions of UUID.LIB
  169. #
  170. !if "$(_NOUUID)" == ""
  171. LIBS=$(LIBS) uuid.lib uuid2.lib
  172. !endif
  173. !if "$(PCHFILE)"!=""
  174. !if "$(PCHBASEFILE)" != ""
  175. OBJS=$(OBJS) $(PCHBASEFILE).obj
  176. PCHFLAGS=-Yu$(PCHFILE)
  177. !else
  178. OBJS=$(OBJS) pch.obj
  179. PCHFLAGS=-Yu$(PCHFILE)
  180. !endif
  181. !endif
  182. # set up our default targets
  183. #
  184. !if "$(ALLTARGETS)"==""
  185. ALLTARGETS=$(_SERVERFILENAME)
  186. !endif
  187. !if "$(TLBTARGETS)"==""
  188. TLBTARGETS=$(SRCDIR)\$(CONTROLNAME).ODL
  189. !endif
  190. #=------------------------------------------------------------------------=
  191. # the good stuff -- the real targets
  192. #
  193. all: $(MORETARGETS) $(ALLTARGETS)
  194. $(_SERVERFILENAME): $(VERSIONHDR) $(CONTROLNAME).TLB $(OBJS) \
  195. $(_SERVERDEP) $(SRCDIR)\Makefile
  196. $(LINK) $(OBJS) $(LIBS) $(LFLAGS)
  197. !if "$(CTLS_BROWSE)"!=""
  198. $(BSCMAKE) /o $(CONTROLNAME).bsc /S (windows.h eb.h vb.h ole2.h) *.sbr
  199. !endif
  200. # Precompiled header build rules
  201. #
  202. !if "$(PCHFILE)"!=""
  203. !if "$(PCHBASEFILE)" != ""
  204. # pre-compiled header targets.
  205. $(PCHBASEFILE).cpp:
  206. echo #include "$(PCHFILE)" > $(PCHBASEFILE).cpp
  207. $(PCHBASEFILE).pch $(PCHBASEFILE).obj: $(SRCDIR)\$(PCHFILE) $(PCHBASEFILE).cpp
  208. $(CC) -Yc$(PCHFILE) $(CFLAGS) $(PCHBASEFILE).cpp
  209. !else
  210. # pre-compiled header targets.
  211. pch.cpp:
  212. echo #include "$(PCHFILE)" > pch.cpp
  213. pch.pch pch.obj: $(SRCDIR)\$(PCHFILE) pch.cpp
  214. $(CC) -Yc$(PCHFILE) $(CFLAGS) pch.cpp
  215. !endif
  216. !endif
  217. # Standard build rules.
  218. # If a .CPP, .C or .ODL file can't
  219. # be found in the other dependencies then it defaults to one of the following build rules
  220. #
  221. {$(SRCDIR)}.cpp.obj:
  222. $(CC) $(PCHFLAGS) $(CFLAGS) $<
  223. {$(SRCDIR)}.c.obj:
  224. $(CC) $(PCHFLAGS) $(CFLAGS) $<
  225. {$(SRCDIR)}.s.Obj:
  226. !ifdef RISC_BLD
  227. ! if "$(PROCESSOR_ARCHITECTURE)"=="PPC"
  228. $(CC) /P /Tc $<
  229. $(ML) $*.i
  230. del $*.i
  231. ! else
  232. $(ML) $(MLFLAGS) $< /Fo$@
  233. ! endif
  234. !else
  235. {$(SRCDIR)}.asm.Obj:
  236. $(ML) $(MLFLAGS) $<
  237. !endif
  238. # TODO: you should come up with some mechanism to generate this file
  239. # on your own.
  240. #
  241. $(VERSIONHDR) : ..\..\FrameWrk\dwinvers.h
  242. echo Generating Version Information Header File (dwinvers.h)
  243. copy ..\..\FrameWrk\dwinvers.h >nul
  244. $(CONTROLNAME).TLB : $(TLBTARGETS)
  245. echo Generating $(CONTROLNAME).TLB and $(CONTROLNAME)Interfaces.H
  246. $(CC) /E /D__MKTYPLIB__ -nologo $(MTLPREPROCFLAGS) $(INCPATH) /Tc $(SRCDIR)\$(CONTROLNAME).ODL > preproc.odl
  247. $(MKTYPLIB) $(MKTYPLIBFLAGS) -nocpp -nologo -h $(CONTROLNAME)Interfaces.H -o Errors.LOG -tlb $(CONTROLNAME).TLB preproc.odl
  248. $(CONTROLNAME).Rbj : $(CONTROLNAME).TLB $(SRCDIR)\$(CONTROLNAME).RC
  249. echo Compiling $(CONTROLNAME).RC
  250. $(RC) $(RCFLAGS) -fo $(CONTROLNAME).Res $(SRCDIR)\$(CONTROLNAME).Rc
  251. !ifdef RISC_BLD
  252. cvtres -machine:$(PROCESSOR_ARCHITECTURE) -nologo -out:$(CONTROLNAME).Rbj $(CONTROLNAME).Res
  253. !else
  254. cvtres -machine:ix86 -nologo -out:$(CONTROLNAME).Rbj $(CONTROLNAME).Res
  255. !endif
  256. Clean:
  257. del *.obj
  258. del *.dll
  259. del *.pdb
  260. del *.vcp
  261. !if "$(PCHFILE)"==""
  262. Dep: $(MORETARGETS) $(CONTROLNAME).TLB
  263. echo Generating Dependencies for $(CONTROLNAME)
  264. $(INCLUDES) $(INCPATH) -d $(SRCDIR)\*.c* $(SRCDIR)\*.rc $(SRCDIR)\*.odl > dep.mak
  265. !else
  266. !if "$(PCHBASEFILE)" != ""
  267. Dep: $(MORETARGETS) $(CONTROLNAME).TLB $(PCHBASEFILE).pch
  268. echo Generating Dependencies for $(CONTROLNAME)
  269. $(INCLUDES) $(INCPATH) -d -r$(PCHFILE)=$(PCHBASEFILE).pch $(SRCDIR)\*.c* $(SRCDIR)\*.rc $(SRCDIR)\*.odl > dep.mak
  270. !else
  271. Dep: $(MORETARGETS) $(CONTROLNAME).TLB pch.pch
  272. echo Generating Dependencies for $(CONTROLNAME)
  273. $(INCLUDES) $(INCPATH) -d -r$(PCHFILE)=pch.pch $(SRCDIR)\*.c* $(SRCDIR)\*.rc $(SRCDIR)\*.odl > dep.mak
  274. !endif
  275. !endif
  276. #=----------------------------=
  277. # Include Dependency Makefile
  278. #
  279. !IF EXIST(dep.mak)
  280. !include dep.mak
  281. !ENDIF