WCC_MAKEFILE 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  1. # Makefile for Watcom C/C++ 10.5, 10.6, 11.0 on NT, OS2 and DOS4GW.
  2. # May work with Watcom 10.0.
  3. # Uncoment one of the lines below for cross compilation.
  4. SYSTEM=MSWIN32
  5. #SYSTEM=DOS4GW
  6. #SYSTEM=OS2
  7. # The collector can be built either as dynamic or as static library.
  8. # Select the library type you need.
  9. #MAKE_AS_DLL=1
  10. MAKE_AS_LIB=1
  11. # Select calling conventions.
  12. # Possible choices are r and s.
  13. CALLING=s
  14. # Select target CPU.
  15. # Possible choices are 3, 4, 5, and 6.
  16. # The last choice available only since version 11.0.
  17. CPU=5
  18. # Set optimization options.
  19. # Watcom before 11.0 does not support option "-oh".
  20. OPTIM=-oneatx -s
  21. #OPTIM=-ohneatx -s
  22. DEFS=-DALL_INTERIOR_POINTERS -DSILENT -DNO_SIGNALS #-DSMALL_CONFIG #-DGC_DEBUG
  23. #####
  24. !ifndef SYSTEM
  25. !ifdef __MSDOS__
  26. SYSTEM=DOS4GW
  27. !else ifdef __NT__
  28. SYSTEM=MSWIN32
  29. !else ifdef __OS2__
  30. SYSTEM=OS2
  31. !else
  32. SYSTEM=Unknown
  33. !endif
  34. !endif
  35. !define $(SYSTEM)
  36. !ifdef DOS4GW
  37. SYSFLAG=-DDOS4GW -bt=dos
  38. !else ifdef MSWIN32
  39. SYSFLAG=-DMSWIN32 -bt=nt
  40. !else ifdef OS2
  41. SYSFLAG=-DOS2 -bt=os2
  42. !else
  43. !error undefined or unsupported target platform: $(SYSTEM)
  44. !endif
  45. !ifdef MAKE_AS_DLL
  46. DLLFLAG=-bd -DGC_DLL
  47. TEST_DLLFLAG=-DGC_DLL
  48. !else ifdef MAKE_AS_LIB
  49. DLLFLAG=
  50. TEST_DLLFLAG=
  51. !else
  52. !error Either MAKE_AS_LIB or MAKE_AS_DLL should be defined
  53. !endif
  54. CC=wcc386
  55. CXX=wpp386
  56. # -DUSE_GENERIC is required !
  57. CFLAGS=-$(CPU)$(CALLING) $(OPTIM) -zp4 -zc $(SYSFLAG) $(DLLFLAG) -DGC_BUILD -DUSE_GENERIC $(DEFS)
  58. CXXFLAGS= $(CFLAGS)
  59. TEST_CFLAGS=-$(CPU)$(CALLING) $(OPTIM) -zp4 -zc $(SYSFLAG) $(TEST_DLLFLAG) $(DEFS)
  60. TEST_CXXFLAGS= $(TEST_CFLAGS)
  61. OBJS= alloc.obj reclaim.obj allchblk.obj misc.obj &
  62. mach_dep.obj os_dep.obj mark_rts.obj headers.obj mark.obj &
  63. obj_map.obj blacklst.obj finalize.obj new_hblk.obj &
  64. dbg_mlc.obj malloc.obj stubborn.obj dyn_load.obj &
  65. typd_mlc.obj ptr_chck.obj mallocx.obj
  66. all: gc.lib gctest.exe test_cpp.exe
  67. !ifdef MAKE_AS_DLL
  68. gc.lib: gc.dll gc_cpp.obj
  69. *wlib -b -c -n -p=512 $@ +gc.dll +gc_cpp.obj
  70. gc.dll: $(OBJS) .AUTODEPEND
  71. @%create $*.lnk
  72. !ifdef DOS4GW
  73. @%append $*.lnk sys os2v2_dll
  74. !else ifdef MSWIN32
  75. @%append $*.lnk sys nt_dll
  76. !else ifdef OS2
  77. @%append $*.lnk sys os2v2_dll
  78. !endif
  79. @%append $*.lnk name $*
  80. @for %i in ($(OBJS)) do @%append $*.lnk file '%i'
  81. !ifeq CALLING s
  82. @%append $*.lnk export GC_is_marked
  83. @%append $*.lnk export GC_incr_words_allocd
  84. @%append $*.lnk export GC_incr_mem_freed
  85. @%append $*.lnk export GC_generic_malloc_words_small
  86. !else
  87. @%append $*.lnk export GC_is_marked_
  88. @%append $*.lnk export GC_incr_words_allocd_
  89. @%append $*.lnk export GC_incr_mem_freed_
  90. @%append $*.lnk export GC_generic_malloc_words_small_
  91. !endif
  92. *wlink @$*.lnk
  93. !else
  94. gc.lib: $(OBJS) gc_cpp.obj
  95. @%create $*.lb1
  96. @for %i in ($(OBJS)) do @%append $*.lb1 +'%i'
  97. @%append $*.lb1 +'gc_cpp.obj'
  98. *wlib -b -c -n -p=512 $@ @$*.lb1
  99. !endif
  100. gctest.exe: test.obj gc.lib
  101. %create $*.lnk
  102. !ifdef DOS4GW
  103. @%append $*.lnk sys dos4g
  104. !else ifdef MSWIN32
  105. @%append $*.lnk sys nt
  106. !else ifdef OS2
  107. @%append $*.lnk sys os2v2
  108. !endif
  109. @%append $*.lnk op case
  110. @%append $*.lnk op stack=256K
  111. @%append $*.lnk name $*
  112. @%append $*.lnk file test.obj
  113. @%append $*.lnk library gc.lib
  114. !ifdef MAKE_AS_DLL
  115. !ifeq CALLING s
  116. @%append $*.lnk import GC_is_marked gc
  117. !else
  118. @%append $*.lnk import GC_is_marked_ gc
  119. !endif
  120. !endif
  121. *wlink @$*.lnk
  122. test_cpp.exe: test_cpp.obj gc.lib
  123. %create $*.lnk
  124. !ifdef DOS4GW
  125. @%append $*.lnk sys dos4g
  126. !else ifdef MSWIN32
  127. @%append $*.lnk sys nt
  128. !else ifdef OS2
  129. @%append $*.lnk sys os2v2
  130. !endif
  131. @%append $*.lnk op case
  132. @%append $*.lnk op stack=256K
  133. @%append $*.lnk name $*
  134. @%append $*.lnk file test_cpp.obj
  135. @%append $*.lnk library gc.lib
  136. !ifdef MAKE_AS_DLL
  137. !ifeq CALLING s
  138. @%append $*.lnk import GC_incr_words_allocd gc
  139. @%append $*.lnk import GC_incr_mem_freed gc
  140. @%append $*.lnk import GC_generic_malloc_words_small gc
  141. !else
  142. @%append $*.lnk import GC_incr_words_allocd_ gc
  143. @%append $*.lnk import GC_incr_mem_freed_ gc
  144. @%append $*.lnk import GC_generic_malloc_words_small_ gc
  145. !endif
  146. !endif
  147. *wlink @$*.lnk
  148. gc_cpp.obj: gc_cpp.cc .AUTODEPEND
  149. $(CXX) $(TEST_CXXFLAGS) -iinclude $*.cc
  150. test.obj: tests\test.c .AUTODEPEND
  151. $(CC) $(TEST_CFLAGS) $*.c
  152. test_cpp.obj: tests\test_cpp.cc .AUTODEPEND
  153. $(CXX) $(TEST_CXXFLAGS) -iinclude $*.cc
  154. .c.obj: .AUTODEPEND
  155. $(CC) $(CFLAGS) $*.c
  156. .cc.obj: .AUTODEPEND
  157. $(CXX) $(CXXFLAGS) $*.cc
  158. clean : .SYMBOLIC
  159. @if exist *.obj del *.obj
  160. @if exist *.map del *.map
  161. @if exist *.lnk del *.lnk
  162. @if exist *.lb1 del *.lb1
  163. @if exist *.sym del *.sym
  164. @if exist *.err del *.err
  165. @if exist *.tmp del *.tmp
  166. @if exist *.lst del *.lst
  167. @if exist *.exe del *.exe
  168. @if exist *.log del *.log
  169. @if exist *.lib del *.lib
  170. @if exist *.dll del *.dll