MAKEFILE 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310
  1. #
  2. # Homeworld Windows interface layer makefile
  3. #
  4. #
  5. # Targets and directories
  6. #
  7. Name = Homeworld
  8. Target = Homeworld
  9. Link_file = $(Name).lnk
  10. SrcDir = .
  11. SrcDir2 = $(%HW_Root)\src\game
  12. SrcDir3 = $(%HW_Root)\src\Ships
  13. SrcDir4 = $(%HW_Root)\src\Sigs
  14. SrcDir5 = $(%HW_Root)\src\Titan
  15. SrcDir6 = $(%HW_Root)\src\Generated
  16. SrcDir7 = $(%HW_Root)\src\jpg
  17. LibDir = $(%HW_Root)\Lib
  18. TitanLibDir = $(LibDir)\Titan
  19. BinkLibDir = $(LibDir)\Smacker
  20. Data = $(%HW_Root)\Data
  21. KASDirs = $(%HW_Root)\src\SinglePlayer;$(%HW_Root)\src\Tutorials
  22. #KASSPRoot = $(Data)\Missions\SinglePlayer
  23. #KASTRoot = $(Data)\Missions\Tutorials
  24. #KASDirs = $(KASSPRoot)\Mission01;$(KASSPRoot)\Mission02;$(KASSPRoot)\Mission03; &
  25. # $(KASSPRoot)\Mission04;$(KASSPRoot)\Mission05;$(KASSPRoot)\Mission06; &
  26. # $(KASSPRoot)\Mission07;$(KASSPRoot)\Mission08;$(KASSPRoot)\Mission09; &
  27. # $(KASSPRoot)\Mission10;$(KASSPRoot)\Mission11;$(KASSPRoot)\Mission12; &
  28. # $(KASSPRoot)\Mission13;$(KASSPRoot)\Mission14;$(KASSPRoot)\Mission15; &
  29. # $(KASSPRoot)\Mission16;$(KASSPRoot)\Mission17;$(KASSPRoot)\Mission18; &
  30. # $(KASTRoot)\Basic;$(KASTRoot)\Advanced
  31. SWDefine = -D_WINSOCK_VERSION=1
  32. #
  33. # C compiler and Assembler options (Pentium in our case)
  34. #
  35. Processor = -G6
  36. #
  37. # Default compile and link flags
  38. #
  39. Link = link
  40. LinkFlags0 = /MAP /SUBSYSTEM:WINDOWS,4.0 /NOLOGO /DEBUG /DEBUGTYPE:CV /PDB:NONE
  41. LinkFlags1 = /MAP /SUBSYSTEM:WINDOWS,4.0 /NOLOGO /DEBUG:NONE /PDB:NONE
  42. LinkFlags2 = /MAP /SUBSYSTEM:WINDOWS,4.0 /NOLOGO /DEBUG /DEBUGTYPE:CV
  43. LinkFlags3 = /MAP /SUBSYSTEM:WINDOWS,4.0 /NOLOGO /DEBUG:NONE
  44. # Check language
  45. !ifeq %HW_Language HW_French
  46. Language = HW_French
  47. !else
  48. !ifeq %HW_Language HW_German
  49. Language = HW_German
  50. !else
  51. Language = HW_English
  52. !endif
  53. !endif
  54. !ifeq %HW_Demo CGW
  55. _CCMD = @cl -c -MT -Zp4 -nologo -W2 -DWIN32 -Zl -I$(%HW_Root)\src\win32 -I$(%HW_Root)\src\game -I$(%HW_Root)\src\Ships -I$(%HW_Root)\src\Sigs -I$(%HW_Root)\src\rgl -I$(%HW_Root)\src\Titan -I$(%HW_Root)\src\Titan\inc -I$(%HW_Root)\src\jpg -I$(%HW_Root)\src\rgl\D3D -I$(%HW_Root)\src\rgl\3dfx $(SWDefine) $(Processor) -D$(%HW_Level) -D$(Language) -D$(%USERNAME) -D__MSC__=yes -DCGW
  56. _CCMDI = @icl -c -MT -Zp4 -nologo -W2 -DWIN32 -Zl -I$(%HW_Root)\src\win32 -I$(%HW_Root)\src\game -I$(%HW_Root)\src\Ships -I$(%HW_Root)\src\Sigs -I$(%HW_Root)\src\rgl -I$(%HW_Root)\src\Titan -I$(%HW_Root)\src\Titan\inc -I$(%HW_Root)\src\jpg -I$(%HW_Root)\src\rgl\D3D -I$(%HW_Root)\src\rgl\3dfx $(SWDefine) $(Processor) -D$(%HW_Level) -D$(Language) -D$(%USERNAME) -D__MSC__=yes -DCGW -Qwr137
  57. !else
  58. !ifeq %HW_Demo Downloadable
  59. _CCMD = @cl -c -MT -Zp4 -nologo -W2 -DWIN32 -Zl -I$(%HW_Root)\src\win32 -I$(%HW_Root)\src\game -I$(%HW_Root)\src\Ships -I$(%HW_Root)\src\Sigs -I$(%HW_Root)\src\rgl -I$(%HW_Root)\src\Titan -I$(%HW_Root)\src\Titan\inc -I$(%HW_Root)\src\jpg -I$(%HW_Root)\src\rgl\D3D -I$(%HW_Root)\src\rgl\3dfx $(SWDefine) $(Processor) -D$(%HW_Level) -D$(Language) -D$(%USERNAME) -D__MSC__=yes -DDownloadable
  60. _CCMDI = @icl -c -MT -Zp4 -nologo -W2 -DWIN32 -Zl -I$(%HW_Root)\src\win32 -I$(%HW_Root)\src\game -I$(%HW_Root)\src\Ships -I$(%HW_Root)\src\Sigs -I$(%HW_Root)\src\rgl -I$(%HW_Root)\src\Titan -I$(%HW_Root)\src\Titan\inc -I$(%HW_Root)\src\jpg -I$(%HW_Root)\src\rgl\D3D -I$(%HW_Root)\src\rgl\3dfx $(SWDefine) $(Processor) -D$(%HW_Level) -D$(Language) -D$(%USERNAME) -D__MSC__=yes -DDownloadable -Qwr137
  61. !else
  62. !ifeq %HW_Demo DLPublicBeta
  63. _CCMD = @cl -c -MT -Zp4 -nologo -W2 -DWIN32 -Zl -I$(%HW_Root)\src\win32 -I$(%HW_Root)\src\game -I$(%HW_Root)\src\Ships -I$(%HW_Root)\src\Sigs -I$(%HW_Root)\src\rgl -I$(%HW_Root)\src\Titan -I$(%HW_Root)\src\Titan\inc -I$(%HW_Root)\src\jpg -I$(%HW_Root)\src\rgl\D3D -I$(%HW_Root)\src\rgl\3dfx $(SWDefine) $(Processor) -D$(%HW_Level) -D$(Language) -D$(%USERNAME) -D__MSC__=yes -DDLPublicBeta
  64. _CCMDI = @icl -c -MT -Zp4 -nologo -W2 -DWIN32 -Zl -I$(%HW_Root)\src\win32 -I$(%HW_Root)\src\game -I$(%HW_Root)\src\Ships -I$(%HW_Root)\src\Sigs -I$(%HW_Root)\src\rgl -I$(%HW_Root)\src\Titan -I$(%HW_Root)\src\Titan\inc -I$(%HW_Root)\src\jpg -I$(%HW_Root)\src\rgl\D3D -I$(%HW_Root)\src\rgl\3dfx $(SWDefine) $(Processor) -D$(%HW_Level) -D$(Language) -D$(%USERNAME) -D__MSC__=yes -DDLPublicBeta -Qwr137
  65. !else
  66. !ifeq %HW_Demo OEM
  67. _CCMD = @cl -c -MT -Zp4 -nologo -W2 -DWIN32 -Zl -I$(%HW_Root)\src\win32 -I$(%HW_Root)\src\game -I$(%HW_Root)\src\Ships -I$(%HW_Root)\src\Sigs -I$(%HW_Root)\src\rgl -I$(%HW_Root)\src\Titan -I$(%HW_Root)\src\Titan\inc -I$(%HW_Root)\src\jpg -I$(%HW_Root)\src\rgl\D3D -I$(%HW_Root)\src\rgl\3dfx $(SWDefine) $(Processor) -D$(%HW_Level) -D$(Language) -D$(%USERNAME) -D__MSC__=yes -DOEM
  68. _CCMDI = @icl -c -MT -Zp4 -nologo -W2 -DWIN32 -Zl -I$(%HW_Root)\src\win32 -I$(%HW_Root)\src\game -I$(%HW_Root)\src\Ships -I$(%HW_Root)\src\Sigs -I$(%HW_Root)\src\rgl -I$(%HW_Root)\src\Titan -I$(%HW_Root)\src\Titan\inc -I$(%HW_Root)\src\jpg -I$(%HW_Root)\src\rgl\D3D -I$(%HW_Root)\src\rgl\3dfx $(SWDefine) $(Processor) -D$(%HW_Level) -D$(Language) -D$(%USERNAME) -D__MSC__=yes -DOEM -Qwr137
  69. !else
  70. _CCMD = @cl -c -MT -Zp4 -nologo -W2 -DWIN32 -Zl -I$(%HW_Root)\src\win32 -I$(%HW_Root)\src\game -I$(%HW_Root)\src\Ships -I$(%HW_Root)\src\Sigs -I$(%HW_Root)\src\rgl -I$(%HW_Root)\src\Titan -I$(%HW_Root)\src\Titan\inc -I$(%HW_Root)\src\jpg -I$(%HW_Root)\src\rgl\D3D -I$(%HW_Root)\src\rgl\3dfx $(SWDefine) $(Processor) -D$(%HW_Level) -D$(Language) -D$(%USERNAME) -D__MSC__=yes
  71. _CCMDI = @icl -c -MT -Zp4 -nologo -W2 -DWIN32 -Zl -I$(%HW_Root)\src\win32 -I$(%HW_Root)\src\game -I$(%HW_Root)\src\Ships -I$(%HW_Root)\src\Sigs -I$(%HW_Root)\src\rgl -I$(%HW_Root)\src\Titan -I$(%HW_Root)\src\Titan\inc -I$(%HW_Root)\src\jpg -I$(%HW_Root)\src\rgl\D3D -I$(%HW_Root)\src\rgl\3dfx $(SWDefine) $(Processor) -D$(%HW_Level) -D$(Language) -D$(%USERNAME) -D__MSC__=yes -Qwr137
  72. !endif
  73. !endif
  74. !endif
  75. !endif
  76. #
  77. # No debug info in externally released .obj files
  78. #
  79. !ifeq %HW_External HW_Internal
  80. CCMD = $(_CCMD)
  81. CCMDI = $(_CCMDI)
  82. !else
  83. CCMD = $(_CCMD) -Zi
  84. CCMDI = $(_CCMDI) -Zi
  85. !endif
  86. # preprocessor used for KAS files
  87. !ifeq %HW_Demo CGW
  88. CCPRE = @cl /E -nologo -DCGW
  89. !else
  90. !ifeq %HW_Demo Downloadable
  91. CCPRE = @cl /E -nologo -DDownloadable
  92. !else
  93. !ifeq %HW_Demo OEM
  94. CCPRE = @cl /E -nologo -DOEM
  95. !else
  96. CCPRE = @cl /E -nologo
  97. !endif
  98. !endif
  99. !endif
  100. #
  101. GLibs = &
  102. comdlg32.lib user32.lib gdi32.lib advapi32.lib winmm.lib &
  103. kernel32.lib ole32.lib libcp.lib vfw32.lib dsound.lib libcmt.lib &
  104. winmm.lib msacm32.lib shell32.lib &
  105. $(TitanLibDir)\common_w95.lib $(TitanLibDir)\msg_w95.lib &
  106. $(TitanLibDir)\EasySocket_w95.lib $(TitanLibDir)\crypt_w95.lib $(TitanLibDir)\auth_w95.lib &
  107. $(BinkLibDir)\binkw32.lib &
  108. wsock32.lib ddraw.lib $(LibDir)\d3d\dxguid.lib
  109. Libs = $(GLibs)
  110. RC = rc /i$(%HW_Root)\src\Game -r
  111. RES = $(Name).res
  112. KAS2C = KAS2C
  113. #
  114. # Set suffix order
  115. #
  116. .EXTENSIONS:
  117. .EXTENSIONS: . .exe .lib .obj .pch .c .kas .res .rc .sym .map .lnk .cpp
  118. #
  119. # C compiler and Assembler options (Pentium in our case)
  120. #
  121. Processor = -G6
  122. #
  123. # Set debugging/optimization options
  124. # There are now 3 different build:
  125. # HW_Debug - uses VC compiler, full debug, no optimizations
  126. # HW_Interim - uses Intel compiler, full debug, no optimizations
  127. # HW_anythingelse - uses Intel Compiler, no debug info, optimizations
  128. # which CCMD<n> to use is determined in the dependency creation script
  129. #
  130. CCMD0 = $(CCMD) -Od
  131. CCMD1 = $(CCMDI) /Ogitb1 /GsF
  132. CCMD2 = $(CCMDI) /Ogitb1 /GsF
  133. CCMD0CPP = $(CCMD) -Od /GX /GR
  134. CCMD1CPP = $(CCMD) -Od /GX /GR
  135. CCMD2CPP = $(CCMD) -Ot /GX /GR
  136. !ifeq %HW_Level HW_Debug
  137. #debug build - VC compiler, debug info
  138. DependName = Debug.depend
  139. !ifeq %HW_PDB HW_YESPDB
  140. LinkFlags = $(LinkFlags2)
  141. !else
  142. LinkFlags = $(LinkFlags0)
  143. !endif
  144. DestDir = $(%HW_Root)\obj\Debug
  145. !else # %HW_Level != HW_Debug
  146. !ifeq %HW_Level HW_Interim
  147. #interim build - Intel compiler, debug info
  148. DependName = Interim.depend
  149. !ifeq %HW_PDB HW_YESPDB
  150. LinkFlags = $(LinkFlags2)
  151. !else
  152. LinkFlags = $(LinkFlags0)
  153. !endif
  154. DestDir = $(%HW_Root)\obj\Interim
  155. !else # %HW_Level != HW_Interim
  156. #Release build - Intel compiler, no debug info, optimizations for most files.
  157. DependName = Release.depend
  158. !ifeq %HW_PDB HW_YESPDB
  159. LinkFlags = $(LinkFlags2) #$(LinkFlags3)
  160. !else
  161. LinkFlags = $(LinkFlags0) #$(LinkFlags1)
  162. !endif
  163. DestDir = $(%HW_Root)\obj\Release
  164. !endif
  165. !endif
  166. #
  167. # List of object files
  168. #
  169. Objs =
  170. !include $(Name).mif
  171. StatLibs =
  172. #
  173. # Implicit make rules
  174. #
  175. #.kas: $(KASDirs)
  176. #.kas: $(Data)\Missions\SinglePlayer\Mission01
  177. #.kas.c:
  178. # @$(KAS2C) $? $(SrcDir6)\$^&.c $(SrcDir6)\$^&.h
  179. #.kas.obj:
  180. # @$(KAS2C) $? $(SrcDir6)\$^&.c $(SrcDir6)\$^&.h
  181. # @$(CCMD) -Fo$(DestDir)\$^&.obj $?
  182. .obj: $(DestDir)
  183. .c: $(SrcDir);$(SrcDir2);$(SrcDir3);$(SrcDir4);$(SrcDir5);$(SrcDir6);$(SrcDir7)
  184. .cpp: $(SrcDir);$(SrcDir2);$(SrcDir3);$(SrcDir4);$(SrcDir5);$(SrcDir6);$(SrcDir7)
  185. .c.obj:
  186. @$(CCMD) -Fo$(DestDir)\$^&.obj $?
  187. .cpp.obj:
  188. @$(CCMD) /GX /GR -Fo$(DestDir)\$^&.obj $?
  189. .res: $(DestDir)
  190. .rc: $(SrcDir)
  191. .rc.res:
  192. @echo $?
  193. @$(RC) -fo$(DestDir)\$^&.res $?
  194. #
  195. # Convert .map files to .sym files...only useful if using kernel debugger
  196. #
  197. #.map: $(DestDir)
  198. #.sym: $(DestDir)
  199. #.map.sym:
  200. # mapsym32 -o $*.sym $?
  201. #
  202. # Explicit make rules
  203. #
  204. !ifeq %HW_External HW_External
  205. all: $(DestDir)\$(Target).exe
  206. !else
  207. all: $(DestDir)\$(Target).exe rgl.dll
  208. !endif
  209. !ifeq %HW_External HW_External
  210. $(DestDir)\$(Target).exe: $(OBJS) $(DestDir)\$(RES) $(StatLibs) $(DestDir)\$(Link_file)
  211. @echo Linking...
  212. @$(Link) $(LinkFlags) @$(DestDir)\$(Link_file)
  213. @copy $(DestDir)\$(Target).exe $(%HW_Root)\exe\$(Target).exe > NUL:
  214. @echo $(DestDir)\$(Target).exe built successfully.
  215. !else
  216. $(DestDir)\$(Target).exe: $(OBJS) $(DestDir)\$(RES) $(StatLibs) $(DestDir)\$(Link_file) rgl.dll
  217. @echo Linking...
  218. @$(Link) $(LinkFlags) @$(DestDir)\$(Link_file)
  219. @copy $(DestDir)\$(Target).exe $(%HW_Root)\exe\$(Target).exe > NUL:
  220. @echo $(DestDir)\$(Target).exe built successfully.
  221. !endif
  222. $(DestDir)\$(RES): $(Name).rc resource.h
  223. #
  224. # Explicit make rule for link file
  225. # Note: we don't include the .DEF or .RES because there are none yet
  226. #
  227. $(DestDir)\$(Link_file): makefile $(Name).mif
  228. @echo Reconstructing link file
  229. @del $(DestDir)\$(Link_file) > NUL:
  230. @echo $(LinkFlags) > $(DestDir)\$(Link_file)
  231. # @for %i in ($(Objs)) do @echo $(DestDir)\%i >> $(DestDir)\$(Link_file)
  232. # @for %i in ($(StatLibs)) do @echo Library %i >> $(DestDir)\$(Link_file)
  233. # @for %i in ($(Libs)) do @echo %i >> $(DestDir)\$(Link_file)
  234. @perl ..\..\tools\batch\makelnk.pl 0 $(DestDir) $(Link_file) $(Objs)
  235. @perl ..\..\tools\batch\makelnk.pl 1 $(DestDir) $(Link_file) $(Libs)
  236. @echo $(DestDir)\$(RES) >> $(DestDir)\$(Link_file)
  237. @echo -Out:$(DestDir)\$(Target).exe >> $(DestDir)\$(Link_file)
  238. !ifeq %HW_External HW_External
  239. # no RGL builds for external use...
  240. !else
  241. rgl.dll:
  242. @echo Making rGL ...
  243. @cd ..\rgl
  244. @wmake /s /h
  245. @copy rgl.dll $(%HW_Root)\exe > NUL:
  246. @copy rglsw.dll $(%HW_Root)\exe > NUL:
  247. @copy rgld3d.dll $(%HW_Root)\exe > NUL:
  248. !endif
  249. clean: .SYMBOLIC
  250. !ifeq %USERNAME gshaw
  251. @del /q $(DestDir)\*.* > NUL:
  252. @del /q $(SrcDir6)\*.* > NUL:
  253. !else
  254. @del /q /y $(DestDir)\*.* > NUL:
  255. @del /q /y $(SrcDir6)\*.* > NUL:
  256. !endif
  257. @del ..\rgl\*.lib > NUL:
  258. @del ..\rgl\*.dll > NUL:
  259. @del ..\rgl\obj\*.obj > NUL:
  260. @echo $(Name) Files cleaned successfully. Have to rebuild everything now.
  261. hclean: .SYMBOLIC
  262. @del /q $(DestDir)\*.* > NUL:
  263. @del /q $(SrcDir6)\*.* > NUL:
  264. @echo $(Name) Files cleaned successfully. Have to rebuild everything now.
  265. copy: .SYMBOLIC
  266. @copy $(DestDir)\$(Target).exe $(%HW_Root)\exe\$(Target).exe > NUL:
  267. depend: .SYMBOLIC
  268. @del $(%HW_Root)\src\Win32\$(DependName)
  269. cd $(%HW_Root)\src
  270. $(%HW_Root)\tools\bin\perl $(%HW_Root)\tools\batch\depend.pl >Win32\$(DependName)
  271. !include $(DependName)