MAKE_LIB.MAK 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  1. #
  2. # Command & Conquer Red Alert(tm)
  3. # Copyright 2025 Electronic Arts Inc.
  4. #
  5. # This program is free software: you can redistribute it and/or modify
  6. # it under the terms of the GNU General Public License as published by
  7. # the Free Software Foundation, either version 3 of the License, or
  8. # (at your option) any later version.
  9. #
  10. # This program is distributed in the hope that it will be useful,
  11. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. # GNU General Public License for more details.
  14. #
  15. # You should have received a copy of the GNU General Public License
  16. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. #
  18. #***************************************************************************
  19. #** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S **
  20. #***************************************************************************
  21. #* *
  22. #* Project Name : Westwood Library .LIB makefile *
  23. #* *
  24. #* File Name : MAKEFILE *
  25. #* *
  26. #* Programmer : Julio R. Jerez *
  27. #* *
  28. #* Start Date : jan 24, 1995 *
  29. #* *
  30. #* Last Update : *
  31. #* *
  32. #*-------------------------------------------------------------------------*
  33. #* *
  34. #* Required environment variables: *
  35. #* WWFLAT = your root WWFLAT path *
  36. #* WWVCS = root directory for wwlib version control archive *
  37. #* WATCOM = your Watcom installation path *
  38. #* *
  39. #* Required changes to makefile: *
  40. #* PROJ_NAME = name of the library you're building *
  41. #* OBJECTS = list of objects in your library *
  42. #* *
  43. #* Optional changes to makefile: *
  44. #* PROJ_DIR = full pathname of your working directory *
  45. #* .path.xxx = full pathname where various file types live *
  46. #* *
  47. #***************************************************************************
  48. #---------------------------------------------------------------------------
  49. # Verify user's environment
  50. #---------------------------------------------------------------------------
  51. !ifndef %WWFLAT
  52. !error WWFLAT Environment var not configured.
  53. !endif
  54. !ifndef %WWVCS
  55. !error WWVCS Environment var not configured.
  56. !endif
  57. !ifndef %WATCOM
  58. !error WATCOM Environment var not configured.
  59. !endif
  60. #===========================================================================
  61. # User-defined section: the user should tailor this section for each project
  62. #===========================================================================
  63. PROJ_NAME = project_name
  64. PROJ_DIR = $(%WWFLAT)\$(PROJ_NAME)
  65. LIB_DIR = $(%WWFLAT)\lib
  66. !include $(%WWFLAT)\project.cfg
  67. #---------------------------------------------------------------------------
  68. # Project-dependent variables
  69. #---------------------------------------------------------------------------
  70. OBJECTS = &
  71. object1.obj &
  72. object2.obj &
  73. object3.obj
  74. #---------------------------------------------------------------------------
  75. # Path macros: one path for each file type.
  76. # These paths are used to tell make where to find/put each file type.
  77. #---------------------------------------------------------------------------
  78. .asm: $(PROJ_DIR)
  79. .c: $(PROJ_DIR)
  80. .cpp: $(PROJ_DIR)
  81. .h: $(PROJ_DIR)
  82. .obj: $(PROJ_DIR)
  83. .lib: $(WWLIB)\lib
  84. .exe: $(PROJ_DIR)
  85. #===========================================================================
  86. # Pre-defined section: there should be little need to modify this section.
  87. #===========================================================================
  88. #---------------------------------------------------------------------------
  89. # Tools/commands
  90. #---------------------------------------------------------------------------
  91. C_CMD = wcc386
  92. CPP_CMD = wpp386
  93. LIB_CMD = wlib
  94. LINK_CMD = wlink
  95. ASM_CMD = tasm32
  96. #---------------------------------------------------------------------------
  97. # Include & library paths
  98. # If LIB & INCLUDE are already defined, they are used in addition to the
  99. # WWLIB32 lib & include; otherwise, they're constructed from
  100. # BCDIR & TNTDIR
  101. #---------------------------------------------------------------------------
  102. LIBPATH = $(%WWFLAT)\LIB;$(%WATCOM)\LIB
  103. INCLUDEPATH = $(%WWFLAT)\INCLUDE;$(%WATCOM)\H
  104. #---------------------------------------------------------------------------
  105. # Implicit rules
  106. # Compiler:
  107. # ($< = full dependent with path)
  108. # Assembler:
  109. # output obj's are constructed from .obj: & the $& macro
  110. # ($< = full dependent with path)
  111. # tasm's cfg file is not invoked as a response file.
  112. #---------------------------------------------------------------------------
  113. .c.obj: $(%WWFLAT)\project.cfg .AUTODEPEND
  114. $(C_CMD) $(CC_CFG) $<
  115. .cpp.obj: $(%WWFLAT)\project.cfg .AUTODEPEND
  116. $(CPP_CMD) $(CC_CFG) $<
  117. .asm.obj: $(%WWFLAT)\project.cfg
  118. $(ASM_CMD) $(ASM_CFG) $<
  119. #---------------------------------------------------------------------------
  120. # Default target: configuration files & library (in that order)
  121. #---------------------------------------------------------------------------
  122. all: $(LIB_DIR)\$(PROJ_NAME).lib .SYMBOLIC
  123. #---------------------------------------------------------------------------
  124. # Build the library
  125. # The original library is deleted by the librarian
  126. # Lib objects & -+ commands are constructed by substituting within the
  127. # $^@ macro (which expands to all target dependents, separated with
  128. # spaces)
  129. # Tlib's cfg file is not invoked as a response file.
  130. # All headers & source files are copied into WWFLAT\SRCDEBUG, for debugging
  131. #---------------------------------------------------------------------------
  132. $(LIB_DIR)\$(PROJ_NAME).lib: $(OBJECTS) objects.lbc
  133. copy *.h $(%WWFLAT)\include
  134. copy *.inc $(%WWFLAT)\include
  135. copy *.cpp $(%WWFLAT)\srcdebug
  136. copy *.asm $(%WWFLAT)\srcdebug
  137. $(LIB_CMD) $(LIB_CFG) $^@ @objects.lbc
  138. #---------------------------------------------------------------------------
  139. # Objects now have a link file which is NOT generated everytime. Instead
  140. # it just has its own dependacy rule.
  141. #---------------------------------------------------------------------------
  142. objects.lbc : $(OBJECTS)
  143. %create $^@
  144. for %index in ($(OBJECTS)) do %append $^@ +%index
  145. #---------------------------------------------------------------------------
  146. # Create the test directory and make it.
  147. #---------------------------------------------------------------------------
  148. test:
  149. mkdir test
  150. cd test
  151. copy $(%WWVCS)\$(PROJ_NAME)\test\vcs.cfg
  152. update
  153. wmake
  154. cd ..
  155. #**************************** End of makefile ******************************