1# This is the original manually generated Makefile.  It may still be used
2# to build the collector.
3#
4# Primary targets:
5# gc.a - builds basic library
6# c++ - adds C++ interface to library
7# cords - adds cords (heavyweight strings) to library
8# test - prints porting information, then builds basic version of gc.a,
9#        and runs some tests of collector and cords.  Does not add cords or
10#        c++ interface to gc.a
11# cord/de - builds dumb editor based on cords.
12
13ABI_FLAG=
14# ABI_FLAG should be the cc flag that specifies the ABI.  On most
15# platforms this will be the empty string.  Possible values:
16# +DD64 for 64-bit executable on HP/UX.
17# -n32, -n64, -o32 for SGI/MIPS ABIs.
18
19AS_ABI_FLAG=$(ABI_FLAG)
20# ABI flag for assembler.  On HP/UX this is +A64 for 64 bit
21# executables.
22
23CC=cc $(ABI_FLAG)
24
25CXX=g++ $(ABI_FLAG)
26# Needed only for "make c++", which adds the c++ interface.
27
28AS=as $(AS_ABI_FLAG)
29# The above doesn't work with gas, which doesn't run cpp.
30# Define AS as `gcc -c -x assembler-with-cpp' instead.
31# Under Irix 6, you have to specify the ABI (-o32, -n32, or -64)
32# if you use something other than the default ABI on your machine.
33
34LD=ld
35
36# Redefining srcdir allows object code for the nonPCR version of the collector
37# to be generated in different directories.
38srcdir= .
39VPATH= $(srcdir)
40
41# Atomic_ops installation directory.  If this doesn't exist, we create
42# it from the included libatomic_ops distribution.
43AO_SRC_DIR=$(srcdir)/libatomic_ops
44AO_INSTALL_DIR=$(srcdir)/libatomic_ops-install
45
46CFLAGS= -O -I$(srcdir)/include -I$(AO_INSTALL_DIR)/include -DATOMIC_UNCOLLECTABLE -DNO_EXECUTE_PERMISSION -DALL_INTERIOR_POINTERS
47
48# To build the parallel collector on Linux, add to the above:
49# -DGC_LINUX_THREADS -DPARALLEL_MARK -DTHREAD_LOCAL_ALLOC
50# To build the thread-capable preload library that intercepts
51# malloc, add -DGC_USE_DLOPEN_WRAP -DREDIRECT_MALLOC=GC_malloc -fpic
52# To build the parallel collector in a static library on HP/UX,
53# add to the above:
54# -DGC_HPUX_THREADS -DTHREAD_LOCAL_ALLOC -D_POSIX_C_SOURCE=199506L -mt
55# FIXME: PARALLEL_MARK currently broken on HP/UX.
56# To build the thread-safe collector on Tru64, add to the above:
57# -pthread -DGC_OSF1_THREADS
58
59# HOSTCC and HOSTCFLAGS are used to build executables that will be run as
60# part of the build process, i.e. on the build machine.  These will usually
61# be the same as CC and CFLAGS, except in a cross-compilation environment.
62# Note that HOSTCFLAGS should include any -D flags that affect thread support.
63HOSTCC=$(CC)
64HOSTCFLAGS=$(CFLAGS)
65
66# For dynamic library builds, it may be necessary to add flags to generate
67# PIC code, e.g. -fPIC on Linux.
68
69# Setjmp_test may yield overly optimistic results when compiled
70# without optimization.
71
72# Look into doc/README.macros for the description of the "define arguments"
73# influencing the collector configuration.
74
75CXXFLAGS= $(CFLAGS)
76AR= ar
77RANLIB= ranlib
78
79
80OBJS= alloc.o reclaim.o allchblk.o misc.o mach_dep.o os_dep.o mark_rts.o \
81  headers.o mark.o obj_map.o blacklst.o finalize.o new_hblk.o dbg_mlc.o  \
82  malloc.o stubborn.o checksums.o pthread_support.o pthread_stop_world.o \
83  darwin_stop_world.o typd_mlc.o ptr_chck.o mallocx.o gcj_mlc.o specific.o \
84  gc_dlopen.o backgraph.o win32_threads.o pthread_start.o \
85  thread_local_alloc.o fnlz_mlc.o
86
87CSRCS= reclaim.c allchblk.c misc.c alloc.c mach_dep.c os_dep.c mark_rts.c \
88  headers.c mark.c obj_map.c pcr_interface.c blacklst.c finalize.c \
89  new_hblk.c real_malloc.c dyn_load.c dbg_mlc.c malloc.c stubborn.c \
90  checksums.c pthread_support.c pthread_stop_world.c darwin_stop_world.c \
91  typd_mlc.c ptr_chck.c mallocx.c gcj_mlc.c specific.c gc_dlopen.c \
92  backgraph.c win32_threads.c pthread_start.c thread_local_alloc.c fnlz_mlc.c
93
94CORD_SRCS= cord/cordbscs.c cord/cordxtra.c cord/cordprnt.c cord/tests/de.c \
95  cord/tests/cordtest.c include/cord.h include/ec.h \
96  include/cord_pos.h cord/tests/de_win.c cord/tests/de_win.h \
97  cord/tests/de_cmds.h cord/tests/de_win.rc
98
99CORD_OBJS= cord/cordbscs.o cord/cordxtra.o cord/cordprnt.o
100
101SRCS= $(CSRCS) \
102  include/gc.h include/gc_typed.h include/gc_tiny_fl.h \
103  include/gc_version.h include/private/gc_hdrs.h include/private/gc_priv.h \
104  include/private/gcconfig.h include/private/gc_pmark.h \
105  include/gc_inline.h include/gc_mark.h include/gc_disclaim.h \
106  tools/threadlibs.c \
107  tools/if_mach.c tools/if_not_there.c gc_cpp.cc include/gc_cpp.h \
108  tools/gcname.c include/weakpointer.h include/private/gc_locks.h \
109  include/new_gc_alloc.h include/gc_allocator.h \
110  include/javaxfc.h \
111  include/gc_backptr.h include/gc_gcj.h include/private/dbg_mlc.h \
112  include/private/specific.h include/leak_detector.h \
113  include/gc_pthread_redirects.h \
114  include/gc_config_macros.h include/private/pthread_support.h \
115  include/private/pthread_stop_world.h include/private/darwin_semaphore.h \
116  include/private/darwin_stop_world.h include/private/thread_local_alloc.h \
117  ia64_save_regs_in_stack.s sparc_mach_dep.S \
118  sparc_netbsd_mach_dep.s sparc_sunos4_mach_dep.s $(CORD_SRCS)
119
120DOC_FILES= README.QUICK doc/README.Mac doc/README.OS2 \
121  doc/README.amiga doc/README.cords doc/debugging.html \
122  doc/finalization.html doc/porting.html doc/overview.html \
123  doc/README.dj doc/README.hp doc/README.linux doc/README.rs6000 \
124  doc/README.sgi doc/README.solaris2 doc/README.uts \
125  doc/README.symbian doc/README.win32 README.md AUTHORS doc/gc.man \
126  doc/README.environment doc/tree.html doc/gcdescr.html \
127  doc/README.autoconf doc/README.macros doc/README.ews4800 \
128  doc/README.DGUX386 doc/README.arm.cross doc/leak.html \
129  doc/scale.html doc/gcinterface.html doc/README.darwin \
130  doc/simple_example.html doc/README.win64
131
132TESTS= tests/test.c tests/test_cpp.cc tests/trace_test.c \
133  tests/leak_test.c tests/thread_leak_test.c tests/middle.c \
134  tests/smash_test.c tests/huge_test.c
135
136GNU_BUILD_FILES= configure.ac Makefile.am configure install-sh Makefile.in \
137  aclocal.m4 config.sub config.guess \
138  include/include.am doc/doc.am \
139  ltmain.sh mkinstalldirs depcomp missing \
140  cord/cord.am tests/tests.am autogen.sh \
141  bdw-gc.pc.in compile
142
143OTHER_MAKEFILES= OS2_MAKEFILE NT_MAKEFILE gc.mak \
144  BCC_MAKEFILE EMX_MAKEFILE WCC_MAKEFILE Makefile.dj \
145  PCR-Makefile SMakefile.amiga \
146  digimars.mak Makefile.direct NT_STATIC_THREADS_MAKEFILE \
147  NT_X64_STATIC_THREADS_MAKEFILE NT_X64_THREADS_MAKEFILE \
148  build_atomic_ops.sh build_atomic_ops.sh.cygwin
149
150OTHER_FILES= tools/setjmp_t.c tools/callprocs.sh extra/MacOS.c \
151  extra/Mac_files/datastart.c extra/Mac_files/dataend.c \
152  extra/Mac_files/MacOS_config.h tools/add_gc_prefix.c gc_cpp.cpp \
153  extra/symbian/global_end.cpp extra/symbian/global_start.cpp \
154  extra/symbian/init_global_static_roots.cpp extra/symbian.cpp \
155  build/s60v3/bld.inf build/s60v3/libgc.mmp \
156  extra/AmigaOS.c extra/msvc_dbg.c include/private/msvc_dbg.h \
157  $(TESTS) $(GNU_BUILD_FILES) $(OTHER_MAKEFILES)
158
159CORD_INCLUDE_FILES= $(srcdir)/include/gc.h $(srcdir)/include/cord.h \
160  $(srcdir)/include/ec.h $(srcdir)/include/cord_pos.h
161
162UTILS= if_mach if_not_there threadlibs
163
164# Libraries needed for curses applications.  Only needed for de.
165CURSES= -lcurses -ltermlib
166
167# The following is irrelevant on most systems.  But a few
168# versions of make otherwise fork the shell specified in
169# the SHELL environment variable.
170SHELL= /bin/sh
171
172SPECIALCFLAGS= -I$(srcdir)/include -I$(AO_INSTALL_DIR)/include
173# Alternative flags to the C compiler for mach_dep.c.
174# Mach_dep.c often doesn't like optimization, and it's
175# not time-critical anyway.
176# Set SPECIALCFLAGS to -q nodirect_code on Encore.
177
178all: gc.a gctest
179
180# if AO_INSTALL_DIR doesn't exist, we assume that it is pointing to
181# the default location, and we need to build
182$(AO_INSTALL_DIR):
183	CC=$(CC) MAKE=$(MAKE) $(srcdir)/build_atomic_ops.sh
184
185LEAKFLAGS= $(CFLAGS) -DFIND_LEAK
186
187BSD-pkg-all: bsd-libgc.a bsd-libleak.a
188
189bsd-libgc.a:
190	$(MAKE) CFLAGS="$(CFLAGS)" clean c++-t
191	mv gc.a bsd-libgc.a
192
193bsd-libleak.a:
194	$(MAKE) -f Makefile.direct CFLAGS="$(LEAKFLAGS)" clean c++-nt
195	mv gc.a bsd-libleak.a
196
197BSD-pkg-install: BSD-pkg-all
198	${CP} bsd-libgc.a libgc.a
199	${INSTALL_DATA} libgc.a ${PREFIX}/lib
200	${INSTALL_DATA} gc.h gc_cpp.h ${PREFIX}/include
201	${INSTALL_MAN} doc/gc.man ${PREFIX}/man/man3/gc.3
202
203pcr: PCR-Makefile include/private/gc_private.h include/private/gc_hdrs.h \
204include/private/gc_locks.h include/gc.h include/private/gcconfig.h \
205mach_dep.o $(SRCS)
206	$(MAKE) -f PCR-Makefile depend
207	$(MAKE) -f PCR-Makefile
208
209$(OBJS) tests/test.o dyn_load.o dyn_load_sunos53.o: \
210  $(srcdir)/include/private/gc_priv.h \
211  $(srcdir)/include/private/gc_hdrs.h $(srcdir)/include/private/gc_locks.h \
212  $(srcdir)/include/gc.h $(srcdir)/include/gc_pthread_redirects.h \
213  $(srcdir)/include/private/gcconfig.h $(srcdir)/include/gc_typed.h \
214  $(srcdir)/include/gc_config_macros.h Makefile $(AO_INSTALL_DIR)
215# The dependency on Makefile is needed.  Changing
216# options affects the size of GC_arrays,
217# invalidating all .o files that rely on gc_priv.h
218
219Makefile: Makefile.direct
220	cp Makefile.direct Makefile
221
222mark.o typd_mlc.o finalize.o ptr_chck.o: $(srcdir)/include/gc_mark.h \
223					 $(srcdir)/include/private/gc_pmark.h
224
225specific.o pthread_support.o thread_local_alloc.o win32_threads.o: \
226  $(srcdir)/include/private/specific.h $(srcdir)/include/gc_inline.h \
227  $(srcdir)/include/private/thread_local_alloc.h
228
229dbg_mlc.o gcj_mlc.o: $(srcdir)/include/private/dbg_mlc.h
230
231tests/test.o: tests $(srcdir)/tests/test.c
232	$(CC) $(CFLAGS) -c $(srcdir)/tests/test.c
233	mv test.o tests/test.o
234
235tests:
236	mkdir tests
237
238base_lib gc.a: $(OBJS) dyn_load.o $(UTILS)
239	echo > base_lib
240	rm -f dont_ar_1
241	cp $(AO_INSTALL_DIR)/lib/libatomic_ops.a gc.a
242	./if_mach SPARC SOLARIS touch dont_ar_1
243	./if_mach SPARC SOLARIS $(AR) rus gc.a $(OBJS) dyn_load.o
244	./if_mach M68K AMIGA touch dont_ar_1
245	./if_mach M68K AMIGA $(AR) -vrus gc.a $(OBJS) dyn_load.o
246	./if_not_there dont_ar_1 $(AR) ru gc.a $(OBJS) dyn_load.o
247	./if_not_there dont_ar_1 $(RANLIB) gc.a || cat /dev/null
248#    Ignore ranlib failure; that usually means it doesn't exist, and
249#    isn't needed.
250
251cords: $(CORD_OBJS) cord/cordtest $(UTILS)
252	rm -f dont_ar_3
253	./if_mach SPARC SOLARIS touch dont_ar_3
254	./if_mach SPARC SOLARIS $(AR) rus gc.a $(CORD_OBJS)
255	./if_mach M68K AMIGA touch dont_ar_3
256	./if_mach M68K AMIGA $(AR) -vrus gc.a $(CORD_OBJS)
257	./if_not_there dont_ar_3 $(AR) ru gc.a $(CORD_OBJS)
258	./if_not_there dont_ar_3 $(RANLIB) gc.a || cat /dev/null
259
260gc_cpp.o: $(srcdir)/gc_cpp.cc $(srcdir)/include/gc_cpp.h $(srcdir)/include/gc.h Makefile
261	$(CXX) -c $(CXXFLAGS) $(srcdir)/gc_cpp.cc
262
263test_cpp: $(srcdir)/tests/test_cpp.cc $(srcdir)/include/gc_cpp.h gc_cpp.o $(srcdir)/include/gc.h \
264  base_lib $(UTILS)
265	rm -f test_cpp
266	./if_mach HP_PA HPUX $(CXX) $(CXXFLAGS) -o test_cpp $(srcdir)/tests/test_cpp.cc gc_cpp.o gc.a -ldld `./threadlibs`
267	./if_not_there test_cpp $(CXX) $(CXXFLAGS) -o test_cpp $(srcdir)/tests/test_cpp.cc gc_cpp.o gc.a `./threadlibs`
268
269c++-t: c++
270	./test_cpp 1
271
272c++-nt: c++
273	@echo "Use ./test_cpp 1 to test the leak library"
274
275c++: gc_cpp.o $(srcdir)/include/gc_cpp.h test_cpp
276	rm -f dont_ar_4
277	./if_mach SPARC SOLARIS touch dont_ar_4
278	./if_mach SPARC SOLARIS $(AR) rus gc.a gc_cpp.o
279	./if_mach M68K AMIGA touch dont_ar_4
280	./if_mach M68K AMIGA $(AR) -vrus gc.a gc_cpp.o
281	./if_not_there dont_ar_4 $(AR) ru gc.a gc_cpp.o
282	./if_not_there dont_ar_4 $(RANLIB) gc.a || cat /dev/null
283	./test_cpp 1
284	echo > c++
285
286dyn_load_sunos53.o: dyn_load.c
287	$(CC) $(CFLAGS) -DSUNOS53_SHARED_LIB -c $(srcdir)/dyn_load.c -o $@
288
289# SunOS5 shared library version of the collector
290sunos5gc.so: $(OBJS) dyn_load_sunos53.o
291	$(CC) -G -o sunos5gc.so $(OBJS) dyn_load_sunos53.o $(AO_INSTALL_DIR)/lib/libatomic_ops.a -ldl
292	ln sunos5gc.so libgc.so
293
294# Alpha/OSF shared library version of the collector
295libalphagc.so: $(OBJS)
296	$(LD) -shared -o libalphagc.so $(OBJS) dyn_load.o -lc
297	ln libalphagc.so libgc.so
298
299# IRIX shared library version of the collector
300libirixgc.so: $(OBJS) dyn_load.o
301	$(LD) -shared $(ABI_FLAG) -o libirixgc.so $(OBJS) dyn_load.o -lc
302	ln libirixgc.so libgc.so
303
304# Linux shared library version of the collector
305liblinuxgc.so: $(OBJS) dyn_load.o
306	gcc -shared -o liblinuxgc.so $(OBJS) dyn_load.o
307	ln liblinuxgc.so libgc.so
308
309# Build gctest with dynamic library
310dyn_test:
311	$(CC) $(CFLAGS) -o gctest tests/test.c libgc.so `./threadlibs`
312	./gctest
313
314# Alternative Linux rule.  This is preferable, but is likely to break the
315# Makefile for some non-linux platforms.
316# LIBOBJS= $(patsubst %.o, %.lo, $(OBJS))
317#
318#.SUFFIXES: .lo $(SUFFIXES)
319#
320#.c.lo:
321# $(CC) $(CFLAGS) $(CPPFLAGS) -fPIC -c $< -o $@
322#
323# liblinuxgc.so: $(LIBOBJS) dyn_load.lo
324# 	gcc -shared -Wl,-soname=libgc.so.0 -o libgc.so.0 $(LIBOBJS) dyn_load.lo
325#	touch liblinuxgc.so
326
327mach_dep.o: $(srcdir)/mach_dep.c $(srcdir)/sparc_mach_dep.S \
328  $(srcdir)/sparc_sunos4_mach_dep.s \
329  $(srcdir)/ia64_save_regs_in_stack.s \
330  $(srcdir)/sparc_netbsd_mach_dep.s $(UTILS)
331	rm -f mach_dep.o
332	./if_mach SPARC SOLARIS $(CC) -c -o mach_dep2.o $(srcdir)/sparc_mach_dep.S
333	./if_mach SPARC OPENBSD $(AS) -o mach_dep2.o $(srcdir)/sparc_sunos4_mach_dep.s
334	./if_mach SPARC NETBSD $(AS) -o mach_dep2.o $(srcdir)/sparc_netbsd_mach_dep.s
335	./if_mach SPARC "" $(CC) -c -o mach_dep1.o $(SPECIALCFLAGS) $(srcdir)/mach_dep.c
336	./if_mach SPARC "" $(LD) -r -o mach_dep.o mach_dep1.o mach_dep2.o
337	./if_mach IA64 "" $(AS) -o ia64_save_regs_in_stack.o $(srcdir)/ia64_save_regs_in_stack.s
338	./if_mach IA64 "" $(CC) -c -o mach_dep1.o $(SPECIALCFLAGS) $(srcdir)/mach_dep.c
339	./if_mach IA64 "" $(LD) -r -o mach_dep.o mach_dep1.o ia64_save_regs_in_stack.o
340	-./if_not_there mach_dep.o $(CC) -c $(SPECIALCFLAGS) $(srcdir)/mach_dep.c
341	-./if_not_there mach_dep.o `cygpath -w /bin/sh` $(CC) -c $(SPECIALCFLAGS) $(srcdir)/mach_dep.c
342	-./if_not_there mach_dep.o /bin/sh $(CC) -c $(SPECIALCFLAGS) $(srcdir)/mach_dep.c
343
344mark_rts.o: $(srcdir)/mark_rts.c $(UTILS)
345	rm -f mark_rts.o
346	-./if_mach ALPHA OSF1 $(CC) -c $(CFLAGS) -Wo,-notail $(srcdir)/mark_rts.c
347	-./if_not_there mark_rts.o $(CC) -c $(CFLAGS) $(srcdir)/mark_rts.c
348	-./if_not_there mark_rts.o `cygpath -w /bin/sh` $(CC) -c $(CFLAGS) $(srcdir)/mark_rts.c
349	-./if_not_there mark_rts.o /bin/sh $(CC) -c $(CFLAGS) $(srcdir)/mark_rts.c
350#   Work-around for DEC optimizer tail recursion elimination bug.
351#   The ALPHA-specific line should be removed if gcc is used.
352
353alloc.o: include/gc_version.h
354
355cord:
356	mkdir cord
357
358cord/cordbscs.o: cord $(srcdir)/cord/cordbscs.c $(CORD_INCLUDE_FILES)
359	$(CC) $(CFLAGS) -c -I$(srcdir) $(srcdir)/cord/cordbscs.c
360	mv cordbscs.o cord/cordbscs.o
361#  not all compilers understand -o filename
362
363cord/cordxtra.o: cord $(srcdir)/cord/cordxtra.c $(CORD_INCLUDE_FILES)
364	$(CC) $(CFLAGS) -c -I$(srcdir) $(srcdir)/cord/cordxtra.c
365	mv cordxtra.o cord/cordxtra.o
366
367cord/cordprnt.o: cord $(srcdir)/cord/cordprnt.c $(CORD_INCLUDE_FILES)
368	$(CC) $(CFLAGS) -c -I$(srcdir) $(srcdir)/cord/cordprnt.c
369	mv cordprnt.o cord/cordprnt.o
370
371cord/cordtest: $(srcdir)/cord/tests/cordtest.c $(CORD_OBJS) gc.a $(UTILS)
372	rm -f cord/cordtest
373	./if_mach SPARC DRSNX $(CC) $(CFLAGS) -o cord/cordtest $(srcdir)/cord/tests/cordtest.c $(CORD_OBJS) gc.a -lucb
374	./if_mach HP_PA HPUX $(CC) $(CFLAGS) -o cord/cordtest $(srcdir)/cord/tests/cordtest.c $(CORD_OBJS) gc.a -ldld `./threadlibs`
375	./if_mach M68K AMIGA $(CC) $(CFLAGS) -UGC_AMIGA_MAKINGLIB -o cord/cordtest $(srcdir)/cord/tests/cordtest.c $(CORD_OBJS) gc.a `./threadlibs`
376	./if_not_there cord/cordtest $(CC) $(CFLAGS) -o cord/cordtest $(srcdir)/cord/tests/cordtest.c $(CORD_OBJS) gc.a `./threadlibs`
377
378cord/de: $(srcdir)/cord/tests/de.c cord/cordbscs.o cord/cordxtra.o gc.a $(UTILS)
379	rm -f cord/de
380	./if_mach SPARC DRSNX $(CC) $(CFLAGS) -o cord/de $(srcdir)/cord/tests/de.c cord/cordbscs.o cord/cordxtra.o gc.a $(CURSES) -lucb `./threadlibs`
381	./if_mach HP_PA HPUX $(CC) $(CFLAGS) -o cord/de $(srcdir)/cord/tests/de.c cord/cordbscs.o cord/cordxtra.o gc.a $(CURSES) -ldld `./threadlibs`
382	./if_mach POWERPC AIX $(CC) $(CFLAGS) -o cord/de $(srcdir)/cord/tests/de.c cord/cordbscs.o cord/cordxtra.o gc.a -lcurses
383	./if_mach POWERPC DARWIN $(CC) $(CFLAGS) -o cord/de $(srcdir)/cord/tests/de.c cord/cordbscs.o cord/cordxtra.o gc.a
384	./if_mach I386 LINUX $(CC) $(CFLAGS) -o cord/de $(srcdir)/cord/tests/de.c cord/cordbscs.o cord/cordxtra.o gc.a -lcurses `./threadlibs`
385	./if_mach ALPHA LINUX $(CC) $(CFLAGS) -o cord/de $(srcdir)/cord/tests/de.c cord/cordbscs.o cord/cordxtra.o gc.a -lcurses `./threadlibs`
386	./if_mach IA64 LINUX $(CC) $(CFLAGS) -o cord/de $(srcdir)/cord/tests/de.c cord/cordbscs.o cord/cordxtra.o gc.a -lcurses `./threadlibs`
387	./if_mach M68K AMIGA $(CC) $(CFLAGS) -UGC_AMIGA_MAKINGLIB -o cord/de $(srcdir)/cord/tests/de.c cord/cordbscs.o cord/cordxtra.o gc.a -lcurses
388	./if_not_there cord/de $(CC) $(CFLAGS) -o cord/de $(srcdir)/cord/tests/de.c cord/cordbscs.o cord/cordxtra.o gc.a $(CURSES) `./threadlibs`
389
390if_mach: $(srcdir)/tools/if_mach.c $(srcdir)/include/private/gcconfig.h
391	$(HOSTCC) $(HOSTCFLAGS) -o if_mach $(srcdir)/tools/if_mach.c
392
393threadlibs: $(srcdir)/tools/threadlibs.c $(srcdir)/include/private/gcconfig.h Makefile
394	$(HOSTCC) $(HOSTCFLAGS) -o threadlibs $(srcdir)/tools/threadlibs.c
395
396if_not_there: $(srcdir)/tools/if_not_there.c
397	$(HOSTCC) $(HOSTCFLAGS) -o if_not_there $(srcdir)/tools/if_not_there.c
398
399clean:
400	rm -f gc.a *.o *.exe tests/*.o gctest gctest_dyn_link test_cpp \
401	      setjmp_test  mon.out gmon.out a.out core if_not_there if_mach \
402	      base_lib c++ threadlibs $(CORD_OBJS) cord/cordtest cord/de
403	-rm -f *~
404
405gctest: tests/test.o gc.a $(UTILS)
406	rm -f gctest
407	./if_mach SPARC DRSNX $(CC) $(CFLAGS) -o gctest  tests/test.o gc.a -lucb
408	./if_mach HP_PA HPUX $(CC) $(CFLAGS) -o gctest  tests/test.o gc.a -ldld `./threadlibs`
409	./if_mach M68K AMIGA $(CC) $(CFLAGS) -UGC_AMIGA_MAKINGLIB -o gctest  tests/test.o gc.a `./threadlibs`
410	./if_not_there gctest $(CC) $(CFLAGS) -o gctest tests/test.o gc.a `./threadlibs`
411
412# If an optimized setjmp_test generates a segmentation fault,
413# odds are your compiler is broken.  Gctest may still work.
414# Try compiling setjmp_t.c unoptimized.
415setjmp_test: $(srcdir)/tools/setjmp_t.c $(srcdir)/include/gc.h $(UTILS) $(AO_INSTALL_DIR)
416	$(CC) $(CFLAGS) -o setjmp_test $(srcdir)/tools/setjmp_t.c
417
418test:  KandRtest cord/cordtest
419	cord/cordtest
420
421# Those tests that work even with a K&R C compiler:
422KandRtest: setjmp_test gctest
423	./setjmp_test
424	./gctest
425
426add_gc_prefix: $(srcdir)/tools/add_gc_prefix.c $(srcdir)/include/gc_version.h
427	$(CC) -o add_gc_prefix $(srcdir)/tools/add_gc_prefix.c
428
429gcname: $(srcdir)/tools/gcname.c $(srcdir)/include/gc_version.h
430	$(CC) -o gcname $(srcdir)/tools/gcname.c
431
432# We assume this is being done from source directory.
433dist gc.tar: $(SRCS) $(DOC_FILES) $(OTHER_FILES) add_gc_prefix gcname
434	cp Makefile.direct Makefile
435	cd $(AO_SRC_DIR); $(MAKE) dist
436	if test $(srcdir)/libatomic_ops = $(AO_SRC_DIR); \
437	then \
438	  mv $(AO_SRC_DIR) $(AO_SRC_DIR).bak ; \
439	  tar xvfz $(AO_SRC_DIR).bak/libatomic_ops.tar.gz ; \
440	else \
441	  tar xvfz $(AO_SRC_DIR)/libatomic_ops.tar.gz ; \
442	fi
443	rm -f `./gcname`
444	ln -s . `./gcname`
445	./add_gc_prefix $(SRCS) $(DOC_FILES) $(OTHER_FILES) libatomic_ops > /tmp/gc.tar-files
446	tar cvfh gc.tar `cat /tmp/gc.tar-files`
447	cp gc.tar `./gcname`.tar
448	gzip `./gcname`.tar
449	rm `./gcname`
450
451gc.tar.Z: gc.tar
452	compress gc.tar
453
454gc.tar.gz: gc.tar
455	gzip gc.tar
456
457lint: $(CSRCS) tests/test.c
458	lint -DLINT $(CSRCS) tests/test.c | egrep -v "possible pointer alignment problem|abort|exit|sbrk|mprotect|syscall|change in ANSI|improper alignment"
459
460# BTL: added to test shared library version of collector.
461# Currently works only under SunOS5.  Requires GC_INIT call from statically
462# loaded client code.
463ABSDIR= `pwd`
464gctest_dyn_link: tests/test.o libgc.so
465	$(CC) -L$(ABSDIR) -R$(ABSDIR) -o gctest_dyn_link tests/test.o -lgc -ldl -lthread
466
467gctest_irix_dyn_link: tests/test.o libirixgc.so
468	$(CC) -L$(ABSDIR) -o gctest_irix_dyn_link tests/test.o -lirixgc
469
470SYM_PREFIX-libgc=GC
471
472reserved_namespace: $(SRCS)
473	for file in $(SRCS) tests/test.c tests/test_cpp.cc; do \
474		sed s/GC_/_GC_/g < $$file > tmp; \
475		cp tmp $$file; \
476		done
477
478user_namespace: $(SRCS)
479	for file in $(SRCS) tests/test.c tests/test_cpp.cc; do \
480		sed s/_GC_/GC_/g < $$file > tmp; \
481		cp tmp $$file; \
482		done
483