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