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.

330 lines
6.4 KiB

  1. # 16-bit makefile
  2. #
  3. # Copyright (c) 1991, Microsoft Corporation
  4. #
  5. # History:
  6. #
  7. # 18-Feb-1994 KevinRo
  8. # 24-Feb-1994 DrewB, added OBJDIR and some other niceties from win40.mk
  9. #
  10. .SUFFIXES:
  11. .SUFFIXES: .c .cxx .cpp .asm .h .inc .obj .lst
  12. .SUFFIXES: .sys .exe .com .map .sym .def .lib .rc .res
  13. !if "$(TARGET)" == ""
  14. !error TARGET must be defined
  15. !endif
  16. OUTNUL= 1>nul 2>nul
  17. !if "$(NTDEBUG)" != "" && "$(NTDEBUG)" != "retail"
  18. OBJDIR = objd
  19. !else
  20. OBJDIR = objr
  21. !endif
  22. # Build up lists of files to produce from sources
  23. !if "$(CFILES)" != ""
  24. OBJFILES = $(OBJFILES) $(CFILES:.c=.obj)
  25. !endif
  26. !if "$(CXXFILES)" != ""
  27. OBJFILES = $(OBJFILES) $(CXXFILES:.cxx=.obj)
  28. !endif
  29. !if "$(CPPFILES)" != ""
  30. OBJFILES = $(OBJFILES) $(CPPFILES:.cpp=.obj)
  31. !endif
  32. !if "$(ASMFILES)" != ""
  33. OBJFILES = $(OBJFILES) $(ASMFILES:.asm=.obj)
  34. !endif
  35. !if "$(RCFILES)" != ""
  36. RESFILES = $(RCFILES:.rc=.res)
  37. !endif
  38. # Replace .\ with $(OBJDIR)
  39. # Unfortunately we can't do this directly so we have to explicitly check
  40. # the value of OBJDIR
  41. !if "$(OBJDIR)" == "objd"
  42. OBJFILES = $(OBJFILES:.\=objd\)
  43. RESFILES = $(RESFILES:.\=objd\)
  44. !elseif "$(OBJDIR)" == "objr"
  45. OBJFILES = $(OBJFILES:.\=objr\)
  46. RESFILES = $(RESFILES:.\=objr\)
  47. !else
  48. !error Unknown OBJDIR: $(OBJDIR)
  49. !endif
  50. # Default target
  51. all: $(OBJDIR)\$(TARGET)
  52. # Determine target type and base name
  53. # Is it a DLL?
  54. TARGETBASE=$(TARGET:.dll=)
  55. !if "$(TARGETBASE)" != "$(TARGET)"
  56. TARGETTYPE=dll
  57. !else
  58. # Is it an EXE?
  59. TARGETBASE=$(TARGET:.exe=)
  60. ! if "$(TARGETBASE)" != "$(TARGET)"
  61. TARGETTYPE=exe
  62. ! else
  63. # Is it a LIB?
  64. TARGETBASE=$(TARGET:.lib=)
  65. ! if "$(TARGETBASE)" != "$(TARGET)"
  66. TARGETTYPE=lib
  67. ! endif
  68. ! endif
  69. !endif
  70. !if "$(TARGETTYPE)" == ""
  71. !error Unknown target type for "$(TARGET)"
  72. !endif
  73. !if "$(BUILDDETAILS)" != ""
  74. BLDKEEP= KEEP
  75. !endif
  76. OLETHUNK= $(_NTDRIVE)$(_NTROOT)\private\ole32\olethunk
  77. OLE16= $(OLETHUNK)\ole16
  78. RCINC = $(RCINC) -i$(OLE16)\inc
  79. INCS = -I$(OLE16)\inc -I$(OLETHUNK)\h -I$(_NTDRIVE)$(_NTROOT)\private\cinc
  80. PATH = $(OLE16)\tools;$(PATH)
  81. LINK = link16
  82. RC = rc16
  83. CL = cl16
  84. IMPLIB = implib
  85. LIBUTIL = lib16
  86. MAPSYM = mapsym
  87. MASM = masm
  88. DEFINES = -DWOW
  89. AOBJ = -Mx -t $(DEFINES) $(INCS)
  90. !if "$(TARGETTYPE)" == "exe"
  91. CW16 = -GA
  92. !else
  93. CW16 = -GD
  94. DEFINES = $(DEFINES) -D_WINDLL
  95. !endif
  96. CW16 = $(CW16) -G2 -AL $(DEFINES) $(INCS) /NMSEG_CODE
  97. LFLAGS = $(LFLAGS) /nod /noe /map:0 /align:16
  98. !if "$(NTDEBUG)" != "" && "$(NTDEBUG)" != "retail"
  99. DEFINES = $(DEFINES) -DDBG=1 -DDEVL=1
  100. !if "$(NTDEBUGTYPE)" == "windbg"
  101. AOBJ = $(AOBJ) -Zi
  102. CW16 = $(CW16) /Odi /Zip /FA
  103. LFLAGS = $(LFLAGS) /CO
  104. !else
  105. AOBJ = $(AOBJ) -Zd
  106. CW16 = $(CW16) /Odi /Zd
  107. LFLAGS = $(LFLAGS) /LI
  108. !endif
  109. !else
  110. CW16 = $(CW16) /Os /Zp /Gs
  111. DEFINES = $(DEFINES) -DDBG=0 -DDEVL=1
  112. !endif
  113. !if "$(TARGETTYPE)" == "dll"
  114. W16LIBS = $(OLE16)\lib\ldllcew.lib
  115. !else
  116. !if "$(QUICKWINDOWS)" != ""
  117. W16LIBS = $(OLE16)\lib\llibcewq.lib
  118. !else
  119. W16LIBS = $(OLE16)\lib\llibcew.lib
  120. !endif
  121. !endif
  122. W16LIBS = $(W16LIBS) $(OLE16)\lib\libw.lib
  123. !if "$(TARGETTYPE)" == "dll" || "$(TARGETTYPE)" == "exe"
  124. LIBS = $(LIBS) $(W16LIBS)
  125. !endif
  126. .asm{$(OBJDIR)}.obj:
  127. @-md $(OBJDIR) $(OUTNUL)
  128. $(MASM) $(AOBJ) $*,$*;
  129. .asm.lst:
  130. @-md $(OBJDIR) $(OUTNUL)
  131. $(MASM) $(AOBJ) -l $*,nul,$*.lst;
  132. .c{$(OBJDIR)}.obj:
  133. @-md $(OBJDIR) $(OUTNUL)
  134. $(CL) -c -nologo @<<$*.rsp
  135. $(CW16: =
  136. )
  137. -Fo$*.obj
  138. $<
  139. <<$(BLDKEEP)
  140. .c.lst:
  141. @-md $(OBJDIR) $(OUTNUL)
  142. $(CL) -c -nologo @<<$(OBJDIR)\$*.rsp
  143. $(CW16: =
  144. )
  145. -Fonul
  146. -Fc$*.lst
  147. $<
  148. <<$(BLDKEEP)
  149. .cxx{$(OBJDIR)}.obj:
  150. @-md $(OBJDIR) $(OUTNUL)
  151. $(CL) -c -nologo @<<$*.rsp
  152. $(CW16: =
  153. )
  154. -Fo$*.obj
  155. -Tp$<
  156. <<$(BLDKEEP)
  157. .cxx.lst:
  158. @-md $(OBJDIR) $(OUTNUL)
  159. $(CL) -c -nologo @<<$(OBJDIR)\$*.rsp
  160. $(CW16: =
  161. )
  162. -Fc$*.lst
  163. -Fonul
  164. -Tp$<
  165. <<$(BLDKEEP)
  166. .cxx.pp:
  167. @-md $(OBJDIR) $(OUTNUL)
  168. $(CL) -c -nologo @<<$(OBJDIR)\$*.rsp > $*.pp
  169. $(CW16: =
  170. )
  171. -E
  172. -Fonul
  173. -Tp$<
  174. <<$(BLDKEEP)
  175. .cpp{$(OBJDIR)}.obj:
  176. @-md $(OBJDIR) $(OUTNUL)
  177. $(CL) -c -nologo @<<$*.rsp
  178. $(CW16: =
  179. )
  180. -Fo$*.obj
  181. -Tp$<
  182. <<$(BLDKEEP)
  183. .cpp.lst:
  184. @-md $(OBJDIR) $(OUTNUL)
  185. $(CL) -c -nologo @<<$(OBJDIR)\$*.rsp
  186. $(CW16: =
  187. )
  188. -Fc$*.lst
  189. -Fonul
  190. -Tp$<
  191. <<$(BLDKEEP)
  192. .cpp.pp:
  193. @-md $(OBJDIR) $(OUTNUL)
  194. $(CL) -c -nologo @<<$(OBJDIR)\$*.rsp > $*.pp
  195. $(CW16: =
  196. )
  197. -E
  198. -Fonul
  199. -Tp$<
  200. <<$(BLDKEEP)
  201. .def{$(OBJDIR)}.lib:
  202. @-md $(OBJDIR) $(OUTNUL)
  203. $(IMPLIB) $*.lib $<
  204. {$(OBJDIR)}.map{$(OBJDIR)}.sym:
  205. @-md $(OBJDIR) $(OUTNUL)
  206. $(MAPSYM) $<
  207. .rc{$(OBJDIR)}.res:
  208. @-md $(OBJDIR) $(OUTNUL)
  209. $(RC) -r $(RCINC) -fo $*.res $<
  210. cleanup:
  211. if exist $(OBJDIR)\*.lrf del $(OBJDIR)\*.lrf
  212. if exist $(OBJDIR)\*.obj del $(OBJDIR)\*.obj
  213. if exist $(OBJDIR)\*.exe del $(OBJDIR)\*.exe
  214. if exist $(OBJDIR)\*.map del $(OBJDIR)\*.map
  215. if exist $(OBJDIR)\*.sym del $(OBJDIR)\*.sym
  216. if exist $(OBJDIR)\*.res del $(OBJDIR)\*.res
  217. clean: cleanup
  218. !if "$(TARGETTYPE)" == "dll"
  219. $(OBJDIR)\$(TARGETBASE).lib: $(TARGETBASE).def
  220. $(OBJDIR)\$(TARGET) $(OBJDIR)\$(TARGETBASE).map: $(OBJFILES) $(RESFILES) \
  221. $(TARGETBASE).def $(OBJDIR)\$(TARGETBASE).lib $(LIBS)
  222. @-md $(OBJDIR) $(OUTNUL)
  223. $(LINK) $(LFLAGS) @<<$(OBJDIR)\$(TARGETBASE).rsp
  224. $(OBJFILES: =+^
  225. )
  226. $(OBJDIR)\$(TARGET)
  227. $(OBJDIR)\$(TARGETBASE).map
  228. $(LIBS: =+^
  229. )
  230. $(TARGETBASE).def
  231. <<$(BLDKEEP)
  232. $(MAPSYM) -o $(OBJDIR)\$(TARGETBASE).sym $(OBJDIR)\$(TARGETBASE).map
  233. !if "$(RCFILES)" != ""
  234. $(RC) -t $(OBJDIR)\$(TARGETBASE).res $(OBJDIR)\$(TARGET)
  235. !endif
  236. !elseif "$(TARGETTYPE)" == "lib"
  237. $(OBJDIR)\$(TARGET): $(OBJFILES) $(LIBS)
  238. @-md $(OBJDIR) $(OUTNUL)
  239. -del $@ $(OUTNUL)
  240. $(LIBUTIL) @<<$*.lnb
  241. $(OBJDIR)\$(TARGET)
  242. y
  243. $(OBJFILES: = &^
  244. )&
  245. $(LIBS: = &^
  246. )&
  247. $*.lls
  248. <<$(BLDKEEP)
  249. !elseif "$(TARGETTYPE)" == "exe"
  250. $(OBJDIR)\$(TARGET) $(OBJDIR)\$(TARGETBASE).map: $(OBJFILES) $(RESFILES) \
  251. $(TARGETBASE).def $(LIBS)
  252. @-md $(OBJDIR) $(OUTNUL)
  253. $(LINK) $(LFLAGS) @<<$(OBJDIR)\$(TARGETBASE).rsp
  254. $(OBJFILES: =+^
  255. )
  256. $(OBJDIR)\$(TARGET)
  257. $(OBJDIR)\$(TARGETBASE).map
  258. $(LIBS: =+^
  259. )
  260. $(TARGETBASE).def
  261. <<$(BLDKEEP)
  262. !if "$(RCFILES)" != ""
  263. $(RC) -t $(OBJDIR)\$(TARGETBASE).res $(OBJDIR)\$(TARGET)
  264. !endif
  265. $(MAPSYM) -o $(OBJDIR)\$(TARGETBASE).sym $(OBJDIR)\$(TARGETBASE).map
  266. !endif