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.

205 lines
5.8 KiB

  1. #
  2. # Example of user compile flags:
  3. # nmake UserCompileFlags="/D AUTOMATED" /f makefile.nmk
  4. #
  5. ##########################################################################
  6. # #
  7. # Check for proper defines prior to execution #
  8. # #
  9. ##########################################################################
  10. !IFNDEF Project
  11. !ERROR Must specify Project name
  12. !ENDIF
  13. !IFNDEF ProjectType
  14. !ERROR Must specify ProjectType name
  15. !ENDIF
  16. !IFNDEF Libraries
  17. !ERROR Must specify Libraries to link with.
  18. !endif
  19. !IFNDEF Objects
  20. !ERROR Object list must be defined
  21. !ENDIF
  22. !IFNDEF BinDirectory
  23. BinDirectory = ..\bin
  24. !ENDIF
  25. !IFNDEF LibDirectory
  26. LibDirectory = ..\lib
  27. !ENDIF
  28. !IFNDEF IncDirectory
  29. IncDirectory = ..\inc
  30. !ENDIF
  31. !IF "$(DESTDIR)" == ""
  32. DESTDIR = .
  33. !ENDIF
  34. ##########################################################################
  35. # #
  36. # Setup machine type #
  37. # #
  38. ##########################################################################
  39. !IF "$(CPU)" == "i386"
  40. Machine = ix86
  41. !ENDIF
  42. !IF "$(CPU)" == "MIPS"
  43. Machine = MIPS
  44. !ENDIF
  45. !IF "$(CPU)" == "ALPHA"
  46. Machine = ALPHA
  47. !ENDIF
  48. !IF "$(CPU)" == "PPC"
  49. Machine = PPC
  50. !ENDIF
  51. ##########################################################################
  52. # #
  53. # Setup compile/link flags #
  54. # #
  55. ##########################################################################
  56. INCLUDE=$(MANROOT)\debug\$(Build)\inc;$(MANROOT)\test\$(Build)\inc;$(INCLUDE);$(MSDEVDIR)\include;$(MSDEVDIR)\mfc\include
  57. PATH=$(MANROOT)\debug\$(Build)\bin;$(MANROOT)\test\$(Build)\bin;$(PATH)
  58. LIB=$(MANROOT)\debug\$(Build)\lib;$(MANROOT)\test\$(Build)\lib;$(LIB)
  59. ############## LOR Stuff ###################
  60. !IFDEF LOR
  61. LORCompile = /D LOR /D AUTOMATED /FAsc /Fa"$(DESTDIR)/"
  62. LORLink = /map:"$(DESTDIR)/$(Project).map"
  63. LORCopy = copy $(DESTDIR)\*.map $(BinDirectory)
  64. !ELSE
  65. LORCompile = /FR"$(DESTDIR)/"
  66. LORLink =
  67. LORCopy =
  68. !ENDIF
  69. ############## COD and Map files ###################
  70. !IFDEF SYMBOLS
  71. LORCompile = /FAsc /Fa"$(DESTDIR)/"
  72. LORLink = /map:"$(DESTDIR)/$(Project).map"
  73. LORCopy = copy $(DESTDIR)\*.map $(BinDirectory)
  74. !ENDIF
  75. !IF "$(ProjectType)" == "DLL"
  76. LinkType = /DLL
  77. !ELSE
  78. LinkType =
  79. !ENDIF
  80. !IF "$(Build)" == "DEBUG"
  81. OptimizeFlag = /D"_DEBUG" /Od /Zi /Zp8 /MLd
  82. DebugLinkFlag = /DEBUG /DEBUGTYPE:BOTH
  83. !ELSE
  84. OptimizeFlag = /Ox /Zp8
  85. !ENDIF
  86. CompilerDest = /Fo"$(DESTDIR)/" /Fd"$(DESTDIR)/$(Project).pdb"
  87. ############## DEF file ###################
  88. !IFDEF DEFFILE
  89. DEF_OPTIONS = /DEF:$(DEFFILE)
  90. !ENDIF
  91. ##########################################################################
  92. # #
  93. # Build the file. #
  94. # #
  95. ##########################################################################
  96. all: "$(DESTDIR)" $(DESTDIR)\$(Project).$(ProjectType)
  97. "$(DESTDIR)" :
  98. if not exist "$(DESTDIR)/$(NULL)" mkdir "$(DESTDIR)"
  99. !include <win32.mak>
  100. .rc{$(DESTDIR)}.res:
  101. $(rc) $(rcflags) $(rcvars) /fo $*.res $<
  102. .cpp{$(DESTDIR)}.obj:
  103. $(cc) $(cflags) $(OptimizeFlag) $(UserCompileFlags) $(LORCompile) $(ExeFlag) $(cvars) $(CompilerDest) /GX $<
  104. .cxx{$(DESTDIR)}.obj:
  105. $(cc) $(cflags) $(OptimizeFlag) $(UserCompileFlags) $(LORCompile) $(ExeFlag) $(cvars) $(CompilerDest) $<
  106. .c{$(DESTDIR)}.obj:
  107. $(cc) $(cflags) $(OptimizeFlag) $(UserCompileFlags) $(LORCompile) $(ExeFlag) $(cvars) $(CompilerDest) $<
  108. !if "$(ProjectType)"=="LIB"
  109. $(DESTDIR)\$(Project).$(ProjectType): $(Objects)
  110. lib $(linkflags) $(Objects) $(Libraries) $(UserLibFlags) /out:$(DESTDIR)\$(Project).$(ProjectType) $(MapSettings)
  111. !else
  112. $(DESTDIR)\$(Project).$(ProjectType): $(Objects)
  113. $(link) $(LORLink) $(LinkType) $(DebugLinkFlag) $(linkflags) $(UserLinkFlags) $(Objects) $(Libraries) $(DEF_OPTIONS) -out:$(DESTDIR)\$(Project).$(ProjectType) $(MapSettings)
  114. !endif
  115. !IF "$(ProjectType)" == "DLL"
  116. copy $(DESTDIR)\*.lib $(LibDirectory)
  117. copy $(DESTDIR)\*.dll $(BinDirectory)
  118. !ELSEIF "$(ProjectType)" == "LIB"
  119. copy $(DESTDIR)\*.lib $(LibDirectory)
  120. !ELSEIF "$(ProjectType)" == "EXE"
  121. copy $(DESTDIR)\*.exe $(BinDirectory)
  122. !ENDIF
  123. !IF "$(Build)" == "DEBUG"
  124. copy $(DESTDIR)\*.pdb $(BinDirectory)
  125. copy $(DESTDIR)\*.pdb $(LibDirectory)
  126. !ENDIF
  127. !IFDEF SYMBOLS
  128. copy $(DESTDIR)\*.map $(BinDirectory)
  129. copy $(DESTDIR)\*.cod $(BinDirectory)
  130. copy $(DESTDIR)\*.sym $(BinDirectory)
  131. copy $(DESTDIR)\*.pdb $(BinDirectory)
  132. !ENDIF
  133. copy *.h $(IncDirectory)
  134. $(LORCopy)
  135. clean:
  136. erase $(DESTDIR)\*.obj >nul
  137. erase $(DESTDIR)\*.cod >nul
  138. erase $(DESTDIR)\*.map >nul
  139. erase $(DESTDIR)\*.sym >nul
  140. erase $(DESTDIR)\*.pdb >nul
  141. erase $(DESTDIR)\*.exe >nul
  142. erase $(DESTDIR)\*.lib >nul
  143. erase $(DESTDIR)\*.dll >nul
  144. erase $(DESTDIR)\*.exp >nul
  145. erase $(DESTDIR)\*.res >nul
  146. erase $(DESTDIR)\*.aps >nul
  147. promoteh:
  148. copy *.h $(IncDirectory) >nul
  149. promotebin:
  150. copy $(DESTDIR)\*.dll $(BinDirectory) >nul
  151. copy $(DESTDIR)\*.exe $(BinDirectory) >nul
  152. copy $(DESTDIR)\*.lib $(LibDirectory) >nul
  153. promoteall:
  154. copy $(DESTDIR)\*.dll $(BinDirectory) >nul
  155. copy $(DESTDIR)\*.exe $(BinDirectory) >nul
  156. copy $(DESTDIR)\*.lib $(LibDirectory) >nul
  157. copy *.h $(IncDirectory) >nul