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.

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