Workaround 'NULL==*flh is always true' cppcheck style warning in allocobj
[platform/upstream/libgc.git] / Makefile.direct
1 # This is the original manually generated Makefile.  It may still be used
2 # to build the collector.
3 #
4 # Primary targets:
5 # all - builds gc.a, gccpp.a, gctba.a and cord.a
6 # base_lib - builds gc.a only (basic library)
7 # c++ - builds gccpp.a and gctba.a only (C++ interface to library)
8 # cords - builds cord.a only (heavyweight strings library)
9 # check - same as "all" but also prints porting information, and runs some
10 #         tests of collector and cords
11 # check-cpp - builds gc.a, gccpp.a and gctba.a, runs C++ only test
12 # cord/de - builds dumb editor based on cords.
13
14 ABI_FLAG=
15 # ABI_FLAG should be the cc flag that specifies the ABI.  On most
16 # platforms this will be the empty string.  Possible values:
17 # +DD64 for 64-bit executable on HP/UX.
18 # -n32, -n64, -o32 for SGI/MIPS ABIs.
19
20 AS_ABI_FLAG=$(ABI_FLAG)
21 # ABI flag for assembler.  On HP/UX this is +A64 for 64 bit
22 # executables.
23
24 CC=cc $(ABI_FLAG)
25 # Compiler executable name.  For EMX, replace to "gcc".
26
27 CXX=g++ $(ABI_FLAG)
28 # Needed only for "make c++", which builds the C++ interface.
29
30 AS=as $(AS_ABI_FLAG)
31 # The above doesn't work with gas, which doesn't run cpp.
32 # Define AS as `gcc -c -x assembler-with-cpp' instead.
33 # Under Irix 6, you have to specify the ABI (-o32, -n32, or -64)
34 # if you use something other than the default ABI on your machine.
35
36 LD=ld
37
38 # Redefining srcdir allows object code for the nonPCR version of the collector
39 # to be generated in different directories.
40 srcdir= .
41 VPATH= $(srcdir)
42
43 # Path to atomic_ops source.
44 AO_SRC_DIR=$(srcdir)/libatomic_ops
45
46 CFLAGS_EXTRA=
47 # We need CFLAGS_FOR_PIC because we might be building a shared library.
48 CFLAGS= -O -I$(srcdir)/include -I$(AO_SRC_DIR)/src \
49   -DALL_INTERIOR_POINTERS -DENABLE_DISCLAIM -DGC_ATOMIC_UNCOLLECTABLE \
50   -DGC_GCJ_SUPPORT -DJAVA_FINALIZATION -DNO_EXECUTE_PERMISSION \
51   -DUSE_MMAP -DUSE_MUNMAP $(CFLAGS_FOR_PIC) $(CFLAGS_EXTRA)
52
53 # To build the collector with threads support, add to the above:
54 # -DGC_THREADS -DPARALLEL_MARK -DTHREAD_LOCAL_ALLOC
55 #
56 # To build the preload library that intercepts malloc, add:
57 # -DGC_USE_DLOPEN_WRAP -DREDIRECT_MALLOC=GC_malloc -fpic
58
59 # To build the collector with fork() support by default, add to the above:
60 # -DHANDLE_FORK
61
62 # HOSTCC and HOSTCFLAGS are used to build executables that will be run as
63 # part of the build process, i.e. on the build machine.  These will usually
64 # be the same as CC and CFLAGS, except in a cross-compilation environment.
65 # Note that HOSTCFLAGS should include any -D flags that affect thread support.
66 HOSTCC=$(CC)
67 HOSTCFLAGS=$(CFLAGS)
68
69 # For dynamic library builds, it may be necessary to add flags to generate
70 # PIC code, e.g. -fPIC on Linux.
71
72 # Setjmp_test may yield overly optimistic results when compiled
73 # without optimization.
74
75 # Look into doc/README.macros for the description of the "define arguments"
76 # influencing the collector configuration.
77
78 CXXFLAGS= $(CFLAGS)
79 AR= ar
80
81 RANLIB= ranlib
82 # For EMX, replace "ranlib" with "ar s".
83
84
85 OBJS= alloc.o reclaim.o allchblk.o misc.o mach_dep.o os_dep.o mark_rts.o \
86   headers.o mark.o obj_map.o blacklst.o finalize.o new_hblk.o dbg_mlc.o  \
87   malloc.o checksums.o pthread_support.o pthread_stop_world.o \
88   darwin_stop_world.o typd_mlc.o ptr_chck.o mallocx.o gcj_mlc.o specific.o \
89   gc_dlopen.o backgraph.o win32_threads.o pthread_start.o \
90   thread_local_alloc.o fnlz_mlc.o atomic_ops.o atomic_ops_sysdeps.o
91
92 CSRCS= reclaim.c allchblk.c misc.c alloc.c mach_dep.c os_dep.c mark_rts.c \
93   headers.c mark.c obj_map.c blacklst.c finalize.c \
94   new_hblk.c dyn_load.c dbg_mlc.c malloc.c \
95   checksums.c pthread_support.c pthread_stop_world.c darwin_stop_world.c \
96   typd_mlc.c ptr_chck.c mallocx.c gcj_mlc.c specific.c gc_dlopen.c \
97   backgraph.c win32_threads.c pthread_start.c thread_local_alloc.c fnlz_mlc.c
98
99 CORD_SRCS= cord/cordbscs.c cord/cordxtra.c cord/cordprnt.c cord/tests/de.c \
100   cord/tests/cordtest.c include/cord.h include/ec.h \
101   include/cord_pos.h cord/tests/de_win.c cord/tests/de_win.h \
102   cord/tests/de_cmds.h cord/tests/de_win.rc
103
104 CORD_OBJS= cord/cordbscs.o cord/cordxtra.o cord/cordprnt.o
105
106 SRCS= $(CSRCS) \
107   include/gc.h include/gc_typed.h include/gc_tiny_fl.h \
108   include/gc_version.h include/private/gc_hdrs.h include/private/gc_priv.h \
109   include/private/gcconfig.h include/private/gc_pmark.h \
110   include/gc_inline.h include/gc_mark.h include/gc_disclaim.h \
111   tools/threadlibs.c tools/if_mach.c tools/if_not_there.c gc_badalc.cc \
112   gc_cpp.cc include/gc_cpp.h include/new_gc_alloc.h include/gc_alloc_ptrs.h \
113   include/gc_allocator.h include/javaxfc.h include/gc_backptr.h \
114   include/gc_gcj.h include/private/gc_locks.h include/private/dbg_mlc.h \
115   include/private/specific.h include/leak_detector.h \
116   include/gc_pthread_redirects.h include/private/gc_atomic_ops.h \
117   include/gc_config_macros.h include/private/pthread_support.h \
118   include/private/pthread_stop_world.h include/private/darwin_semaphore.h \
119   include/private/darwin_stop_world.h include/private/thread_local_alloc.h \
120   ia64_save_regs_in_stack.s sparc_mach_dep.S \
121   sparc_netbsd_mach_dep.s $(CORD_SRCS)
122
123 CORD_INCLUDE_FILES= $(srcdir)/include/gc.h $(srcdir)/include/cord.h \
124   $(srcdir)/include/ec.h $(srcdir)/include/cord_pos.h
125
126 # Executable file name extension.  For EMX, specify ".exe".
127 EXEEXT=
128
129 UTILS= if_mach$(EXEEXT) if_not_there$(EXEEXT) threadlibs$(EXEEXT)
130
131 # Libraries needed for curses applications.  Only needed for de.
132 # It might also require -ltermlib on some targets.
133 CURSES= -lcurses
134
135 # The following is irrelevant on most systems.  But a few
136 # versions of make otherwise fork the shell specified in
137 # the SHELL environment variable.
138 SHELL= /bin/sh
139
140 SPECIALCFLAGS= -I$(srcdir)/include -I$(AO_SRC_DIR)/src $(CFLAGS_FOR_PIC)
141 # Alternative flags to the C compiler for mach_dep.c.
142 # Mach_dep.c often doesn't like optimization, and it's
143 # not time-critical anyway.
144 # Set SPECIALCFLAGS to -q nodirect_code on Encore.
145
146 all: base_lib cords c++
147
148 atomic_ops.o: $(AO_SRC_DIR)/src/atomic_ops.c
149         $(CC) $(CFLAGS) -c -o $@ $(AO_SRC_DIR)/src/atomic_ops.c
150 # For some reason, Solaris make does not handle "$<" properly.
151
152 atomic_ops_sysdeps.o: $(AO_SRC_DIR)/src/atomic_ops_sysdeps.S
153         $(CC) $(CFLAGS) -c -o $@ $(AO_SRC_DIR)/src/atomic_ops_sysdeps.S
154
155 LEAKFLAGS= $(CFLAGS) -DFIND_LEAK
156
157 BSD-pkg-all: bsd-libgc.a bsd-libleak.a
158
159 bsd-libgc.a bsd-libgccpp.a bsd-libgctba.a:
160         $(MAKE) -f Makefile.direct CFLAGS="$(CFLAGS)" clean c++-t
161         mv gc.a bsd-libgc.a
162         mv gccpp.a bsd-libgccpp.a
163         mv gctba.a bsd-libgctba.a
164
165 bsd-libleak.a:
166         $(MAKE) -f Makefile.direct CFLAGS="$(LEAKFLAGS)" clean c++-nt
167         mv gc.a bsd-libleak.a
168
169 BSD-pkg-install: BSD-pkg-all
170         ${CP} bsd-libgc.a libgc.a
171         ${INSTALL_DATA} libgc.a ${PREFIX}/lib
172         ${CP} bsd-libgccpp.a libgccpp.a
173         ${INSTALL_DATA} libgccpp.a ${PREFIX}/lib
174         ${CP} bsd-libgctba.a libgctba.a
175         ${INSTALL_DATA} libgctba.a ${PREFIX}/lib
176         ${INSTALL_DATA} gc.h gc_cpp.h ${PREFIX}/include
177         ${INSTALL_MAN} doc/gc.man ${PREFIX}/man/man3/gc.3
178
179 pcr: PCR-Makefile include/private/gc_private.h include/private/gc_hdrs.h \
180   include/private/gc_locks.h include/gc.h include/private/gcconfig.h \
181   mach_dep.o $(SRCS)
182         $(MAKE) -f PCR-Makefile depend
183         $(MAKE) -f PCR-Makefile
184
185 $(OBJS) tests/test.o dyn_load.o dyn_load_sunos53.o: \
186   $(srcdir)/include/private/gc_priv.h \
187   $(srcdir)/include/private/gc_hdrs.h $(srcdir)/include/private/gc_locks.h \
188   $(srcdir)/include/gc.h $(srcdir)/include/gc_pthread_redirects.h \
189   $(srcdir)/include/private/gcconfig.h $(srcdir)/include/gc_typed.h \
190   $(srcdir)/include/gc_config_macros.h
191
192 mark.o typd_mlc.o finalize.o ptr_chck.o: $(srcdir)/include/gc_mark.h \
193                                          $(srcdir)/include/private/gc_pmark.h
194
195 specific.o pthread_support.o thread_local_alloc.o win32_threads.o: \
196   $(srcdir)/include/private/specific.h $(srcdir)/include/gc_inline.h \
197   $(srcdir)/include/private/thread_local_alloc.h
198
199 dbg_mlc.o gcj_mlc.o: $(srcdir)/include/private/dbg_mlc.h
200
201 tests/test.o: $(srcdir)/tests/test.c
202         mkdir tests || cat /dev/null
203         $(CC) $(CFLAGS) -c $(srcdir)/tests/test.c
204         mv test.o tests/test.o
205
206 base_lib gc.a: $(OBJS) dyn_load.o $(UTILS)
207         rm -f dont_ar_1
208         ./if_mach SPARC SOLARIS touch dont_ar_1
209         ./if_mach SPARC SOLARIS $(AR) rus gc.a $(OBJS) dyn_load.o
210         ./if_mach M68K AMIGA touch dont_ar_1
211         ./if_mach M68K AMIGA $(AR) -vrus gc.a $(OBJS) dyn_load.o
212         ./if_not_there dont_ar_1 || $(AR) ru gc.a $(OBJS) dyn_load.o
213         ./if_not_there dont_ar_1 || $(RANLIB) gc.a || cat /dev/null
214         echo > base_lib
215 #    Ignore ranlib failure; that usually means it doesn't exist, and
216 #    isn't needed.
217
218 cords cord.a: $(CORD_OBJS) $(UTILS)
219         rm -f dont_ar_3
220         ./if_mach SPARC SOLARIS touch dont_ar_3
221         ./if_mach SPARC SOLARIS $(AR) rus cord.a $(CORD_OBJS)
222         ./if_mach M68K AMIGA touch dont_ar_3
223         ./if_mach M68K AMIGA $(AR) -vrus cord.a $(CORD_OBJS)
224         ./if_not_there dont_ar_3 || $(AR) ru cord.a $(CORD_OBJS)
225         ./if_not_there dont_ar_3 || $(RANLIB) cord.a || cat /dev/null
226         echo > cords
227
228 gc_badalc.o: $(srcdir)/gc_badalc.cc $(srcdir)/include/gc_cpp.h \
229   $(srcdir)/include/gc.h
230         $(CXX) -c $(CXXFLAGS) $(srcdir)/gc_badalc.cc
231
232 gc_cpp.o: $(srcdir)/gc_cpp.cc $(srcdir)/include/gc_cpp.h $(srcdir)/include/gc.h
233         $(CXX) -c $(CXXFLAGS) $(srcdir)/gc_cpp.cc
234
235 test_cpp$(EXEEXT): $(srcdir)/tests/test_cpp.cc $(srcdir)/include/gc_cpp.h \
236   $(srcdir)/include/gc.h c++ base_lib $(UTILS)
237         rm -f test_cpp$(EXEEXT)
238         ./if_mach HP_PA HPUX $(CXX) $(CXXFLAGS) -o test_cpp $(srcdir)/tests/test_cpp.cc gc.a gccpp.a -ldld `./threadlibs`
239         ./if_not_there test_cpp$(EXEEXT) || $(CXX) $(CXXFLAGS) -DGC_NOT_DLL -o test_cpp$(EXEEXT) $(srcdir)/tests/test_cpp.cc gc.a gccpp.a `./threadlibs`
240
241 check-cpp: test_cpp$(EXEEXT)
242         ./test_cpp
243
244 c++-t: c++ test_cpp$(EXEEXT)
245         ./test_cpp 1
246
247 c++-nt: c++
248         @echo "Use ./test_cpp 1 to test the leak library"
249
250 c++ gccpp.a gctba.a: gc_badalc.o gc_cpp.o $(UTILS)
251         rm -f dont_ar_4
252         ./if_mach SPARC SOLARIS touch dont_ar_4
253         ./if_mach SPARC SOLARIS $(AR) rus gccpp.a gc_badalc.o gc_cpp.o
254         ./if_mach SPARC SOLARIS $(AR) rus gctba.a gc_badalc.o
255         ./if_mach M68K AMIGA touch dont_ar_4
256         ./if_mach M68K AMIGA $(AR) -vrus gccpp.a gc_badalc.o gc_cpp.o
257         ./if_mach M68K AMIGA $(AR) -vrus gctba.a gc_badalc.o
258         ./if_not_there dont_ar_4 || $(AR) ru gccpp.a gc_badalc.o gc_cpp.o
259         ./if_not_there dont_ar_4 || $(RANLIB) gccpp.a || cat /dev/null
260         ./if_not_there dont_ar_4 || $(AR) ru gctba.a gc_badalc.o
261         ./if_not_there dont_ar_4 || $(RANLIB) gctba.a || cat /dev/null
262         echo > c++
263
264 dyn_load_sunos53.o: dyn_load.c
265         $(CC) $(CFLAGS) -DSUNOS53_SHARED_LIB -c $(srcdir)/dyn_load.c -o $@
266
267 # SunOS5 shared library version of the collector
268 sunos5gc.so: $(OBJS) dyn_load_sunos53.o
269         $(CC) -G -o sunos5gc.so $(OBJS) dyn_load_sunos53.o -ldl
270         ln sunos5gc.so libgc.so
271
272 # Alpha/OSF shared library version of the collector
273 libalphagc.so: $(OBJS)
274         $(LD) -shared -o libalphagc.so $(OBJS) dyn_load.o -lc
275         ln libalphagc.so libgc.so
276
277 # IRIX shared library version of the collector
278 libirixgc.so: $(OBJS) dyn_load.o
279         $(LD) -shared $(ABI_FLAG) -o libirixgc.so $(OBJS) dyn_load.o -lc
280         ln libirixgc.so libgc.so
281
282 # Linux shared library version of the collector
283 liblinuxgc.so: $(OBJS) dyn_load.o
284         gcc -shared -o liblinuxgc.so $(OBJS) dyn_load.o
285         ln liblinuxgc.so libgc.so
286
287 # Build gctest with dynamic library
288 dyn_test:
289         $(CC) $(CFLAGS) -o gctest$(EXEEXT) tests/test.c libgc.so `./threadlibs`
290         ./gctest
291
292 # Alternative Linux rule.  This is preferable, but is likely to break the
293 # Makefile for some non-linux platforms.
294 # LIBOBJS= $(patsubst %.o, %.lo, $(OBJS))
295 #
296 #.SUFFIXES: .lo $(SUFFIXES)
297 #
298 #.c.lo:
299 # $(CC) $(CFLAGS) $(CPPFLAGS) -fPIC -c $< -o $@
300 #
301 # liblinuxgc.so: $(LIBOBJS) dyn_load.lo
302 #       gcc -shared -Wl,-soname=libgc.so.0 -o libgc.so.0 $(LIBOBJS) dyn_load.lo
303 #       touch liblinuxgc.so
304
305 mach_dep.o: $(srcdir)/mach_dep.c $(srcdir)/sparc_mach_dep.S \
306   $(srcdir)/ia64_save_regs_in_stack.s \
307   $(srcdir)/sparc_netbsd_mach_dep.s $(UTILS)
308         rm -f mach_dep.o
309         ./if_mach SPARC SOLARIS $(CC) -c -o mach_dep2.o $(srcdir)/sparc_mach_dep.S
310         ./if_mach SPARC OPENBSD $(CC) -c -o mach_dep2.o $(srcdir)/sparc_mach_dep.S
311         ./if_mach SPARC NETBSD $(AS) -o mach_dep2.o $(srcdir)/sparc_netbsd_mach_dep.s
312         ./if_mach SPARC "" $(CC) -c -o mach_dep1.o $(SPECIALCFLAGS) $(srcdir)/mach_dep.c
313         ./if_mach SPARC "" $(LD) -r -o mach_dep.o mach_dep1.o mach_dep2.o
314         ./if_mach IA64 "" $(AS) -o ia64_save_regs_in_stack.o $(srcdir)/ia64_save_regs_in_stack.s
315         ./if_mach IA64 "" $(CC) -c -o mach_dep1.o $(SPECIALCFLAGS) $(srcdir)/mach_dep.c
316         ./if_mach IA64 "" $(LD) -r -o mach_dep.o mach_dep1.o ia64_save_regs_in_stack.o
317         -./if_not_there mach_dep.o || $(CC) -c $(SPECIALCFLAGS) $(srcdir)/mach_dep.c
318         -./if_not_there mach_dep.o || `cygpath -w /bin/sh` $(CC) -c $(SPECIALCFLAGS) $(srcdir)/mach_dep.c
319         -./if_not_there mach_dep.o || /bin/sh $(CC) -c $(SPECIALCFLAGS) $(srcdir)/mach_dep.c
320
321 mark_rts.o: $(srcdir)/mark_rts.c $(UTILS)
322         rm -f mark_rts.o
323         -./if_mach ALPHA OSF1 $(CC) -c $(CFLAGS) -Wo,-notail $(srcdir)/mark_rts.c
324         -./if_not_there mark_rts.o || $(CC) -c $(CFLAGS) $(srcdir)/mark_rts.c
325         -./if_not_there mark_rts.o || `cygpath -w /bin/sh` $(CC) -c $(CFLAGS) $(srcdir)/mark_rts.c
326         -./if_not_there mark_rts.o || /bin/sh $(CC) -c $(CFLAGS) $(srcdir)/mark_rts.c
327 #   Work-around for DEC optimizer tail recursion elimination bug.
328 #   The ALPHA-specific line should be removed if gcc is used.
329
330 alloc.o: include/gc_version.h
331
332 cord/cordbscs.o: $(srcdir)/cord/cordbscs.c $(CORD_INCLUDE_FILES)
333         $(CC) $(CFLAGS) -c -I$(srcdir) $(srcdir)/cord/cordbscs.c
334         mkdir cord || cat /dev/null
335         mv cordbscs.o cord/cordbscs.o
336 #  not all compilers understand -o filename
337
338 cord/cordxtra.o: $(srcdir)/cord/cordxtra.c $(CORD_INCLUDE_FILES)
339         $(CC) $(CFLAGS) -c -I$(srcdir) $(srcdir)/cord/cordxtra.c
340         mkdir cord || cat /dev/null
341         mv cordxtra.o cord/cordxtra.o
342
343 cord/cordprnt.o: $(srcdir)/cord/cordprnt.c $(CORD_INCLUDE_FILES)
344         $(CC) $(CFLAGS) -c -I$(srcdir) $(srcdir)/cord/cordprnt.c
345         mkdir cord || cat /dev/null
346         mv cordprnt.o cord/cordprnt.o
347
348 cordtest$(EXEEXT): $(srcdir)/cord/tests/cordtest.c cords base_lib $(UTILS)
349         rm -f cordtest$(EXEEXT)
350         ./if_mach SPARC DRSNX $(CC) $(CFLAGS) -o cordtest $(srcdir)/cord/tests/cordtest.c gc.a cord.a -lucb
351         ./if_mach HP_PA HPUX $(CC) $(CFLAGS) -o cordtest $(srcdir)/cord/tests/cordtest.c gc.a cord.a -ldld `./threadlibs`
352         ./if_mach M68K AMIGA $(CC) $(CFLAGS) -UGC_AMIGA_MAKINGLIB -o cordtest $(srcdir)/cord/tests/cordtest.c gc.a cord.a `./threadlibs`
353         ./if_not_there cordtest$(EXEEXT) || $(CC) $(CFLAGS) -o cordtest$(EXEEXT) $(srcdir)/cord/tests/cordtest.c gc.a cord.a `./threadlibs`
354
355 cord/de: de$(EXEEXT)
356
357 de$(EXEEXT): $(srcdir)/cord/tests/de.c $(srcdir)/cord/tests/de_win.c \
358   $(srcdir)/cord/tests/de_win.h cords base_lib $(UTILS)
359         rm -f de$(EXEEXT)
360         ./if_mach SPARC DRSNX $(CC) $(CFLAGS) -o de $(srcdir)/cord/tests/de.c gc.a cord.a -lcurses -ltermlib -lucb `./threadlibs`
361         ./if_mach HP_PA HPUX $(CC) $(CFLAGS) -o de $(srcdir)/cord/tests/de.c gc.a cord.a -lcurses -ltermlib -ldld `./threadlibs`
362         ./if_mach POWERPC AIX $(CC) $(CFLAGS) -o de $(srcdir)/cord/tests/de.c gc.a cord.a -lcurses
363         ./if_mach POWERPC DARWIN $(CC) $(CFLAGS) -o de $(srcdir)/cord/tests/de.c gc.a cord.a
364         ./if_mach M68K AMIGA $(CC) $(CFLAGS) -UGC_AMIGA_MAKINGLIB -o de $(srcdir)/cord/tests/de.c gc.a cord.a -lcurses
365         ./if_not_there de$(EXEEXT) || $(CC) $(CFLAGS) -o de$(EXEEXT) $(srcdir)/cord/tests/de.c $(srcdir)/cord/tests/de_win.c gc.a cord.a $(CURSES) `./threadlibs`
366
367 if_mach$(EXEEXT): $(srcdir)/tools/if_mach.c \
368   $(srcdir)/include/private/gcconfig.h
369         $(HOSTCC) $(HOSTCFLAGS) -o if_mach$(EXEEXT) $(srcdir)/tools/if_mach.c
370
371 threadlibs$(EXEEXT): $(srcdir)/tools/threadlibs.c \
372   $(srcdir)/include/private/gcconfig.h
373         $(HOSTCC) $(HOSTCFLAGS) -o threadlibs$(EXEEXT) $(srcdir)/tools/threadlibs.c
374
375 if_not_there$(EXEEXT): $(srcdir)/tools/if_not_there.c
376         $(HOSTCC) $(HOSTCFLAGS) -o if_not_there$(EXEEXT) $(srcdir)/tools/if_not_there.c
377
378 clean:
379         rm -f *.a *.i *.o *.exe tests/*.o gctest gctest_dyn_link test_cpp \
380               setjmp_test mon.out gmon.out a.out core if_not_there if_mach \
381               base_lib c++ $(CORD_OBJS) cordtest de cords dont_ar_* threadlibs
382         -rm -f *~
383
384 gctest$(EXEEXT): tests/test.o base_lib $(UTILS)
385         rm -f gctest$(EXEEXT)
386         ./if_mach SPARC DRSNX $(CC) $(CFLAGS) -o gctest tests/test.o gc.a -lucb
387         ./if_mach HP_PA HPUX $(CC) $(CFLAGS) -o gctest tests/test.o gc.a -ldld `./threadlibs`
388         ./if_mach M68K AMIGA $(CC) $(CFLAGS) -UGC_AMIGA_MAKINGLIB -o gctest  tests/test.o gc.a `./threadlibs`
389         ./if_not_there gctest$(EXEEXT) || $(CC) $(CFLAGS) -o gctest$(EXEEXT) tests/test.o gc.a `./threadlibs`
390
391 # If an optimized setjmp_test generates a segmentation fault,
392 # odds are your compiler is broken.  Gctest may still work.
393 # Try compiling setjmp_t.c unoptimized.
394 setjmp_test$(EXEEXT): $(srcdir)/tools/setjmp_t.c $(srcdir)/include/gc.h \
395   $(UTILS)
396         $(CC) $(CFLAGS) -o setjmp_test$(EXEEXT) $(srcdir)/tools/setjmp_t.c
397
398 check: cordtest$(EXEEXT) gctest$(EXEEXT) setjmp_test$(EXEEXT) test_cpp$(EXEEXT)
399         ./setjmp_test
400         ./gctest
401         ./cordtest
402         ./test_cpp
403
404 # A synonym to "check" (for compatibility with older GC versions).
405 test: check
406
407 # BTL: added to test shared library version of collector.
408 # Currently works only under SunOS5.  Requires GC_INIT call from statically
409 # loaded client code.
410 ABSDIR= `pwd`
411 gctest_dyn_link: tests/test.o libgc.so
412         $(CC) -L$(ABSDIR) -R$(ABSDIR) -o gctest_dyn_link tests/test.o -lgc -ldl -lthread
413
414 gctest_irix_dyn_link: tests/test.o libirixgc.so
415         $(CC) -L$(ABSDIR) -o gctest_irix_dyn_link tests/test.o -lirixgc
416
417 SYM_PREFIX-libgc=GC
418
419 reserved_namespace: $(SRCS)
420         for file in $(SRCS) tests/test.c tests/test_cpp.cc; do \
421                 sed s/GC_/_GC_/g < $$file > tmp; \
422                 cp tmp $$file; \
423                 done
424
425 user_namespace: $(SRCS)
426         for file in $(SRCS) tests/test.c tests/test_cpp.cc; do \
427                 sed s/_GC_/GC_/g < $$file > tmp; \
428                 cp tmp $$file; \
429                 done