OSDN Git Service

Update to Automake 1.11.1.
[pf3gnuchains/gcc-fork.git] / boehm-gc / Makefile.dj
1 # This Makefile is intended only for DJGPP use.
2 # It is mainly a copy of the main Makefile, but tends to get out of sync
3 # with it.  A merge would probably be appropriate.
4
5 # Primary targets:
6 # gc.a - builds basic library
7 # libgc.a - builds library for use with g++ "-fgc-keyword" extension
8 #           -fgc-keyword was never really available.  Historical
9 #           interest only.
10 # c++ - adds C++ interface to library
11 # cords - adds cords (heavyweight strings) to library
12 # test - prints porting information, then builds basic version of gc.a,
13 #        and runs some tests of collector and cords.  Does not add cords or
14 #        c++ interface to gc.a
15 # cord/de$(EXE_SUFFIX) - builds dumb editor based on cords.
16 ABI_FLAG=
17 CC=gcc $(ABI_FLAG)
18 CXX=gxx $(ABI_FLAG)
19 AS=gcc -c -x assembler-with-cpp $(ABI_FLAG)
20 #  The above doesn't work with gas, which doesn't run cpp.
21 #  Define AS as `gcc -c -x assembler-with-cpp' instead.
22 #  Under Irix 6, you will have to specify the ABI (-o32, -n32, or -64)
23 #  if you use something other than the default ABI on your machine.
24
25 # special defines for DJGPP
26 CXXLD=gxx $(ABI_FLAG)
27 EXE_SUFFIX=.exe
28
29 srcdir= .
30 VPATH= $(srcdir)
31
32 CFLAGS= -gstabs+ -O2 -I$(srcdir)/include -DATOMIC_UNCOLLECTABLE -DNO_SIGNALS -DALL_INTERIOR_POINTERS -DNO_EXECUTE_PERMISSION -DSILENT
33
34 # Setjmp_test may yield overly optimistic results when compiled
35 # without optimization.
36 # -DSILENT disables statistics printing, and improves performance.
37 # -DFIND_LEAK causes GC_find_leak to be initially set.
38 #   This causes the collector to assume that all inaccessible
39 #   objects should have been explicitly deallocated, and reports exceptions.
40 #   Finalization and the test program are not usable in this mode.
41 # -DALL_INTERIOR_POINTERS allows all pointers to the interior
42 #   of objects to be recognized.  (See gc_priv.h for consequences.)
43 # -DSMALL_CONFIG tries to tune the collector for small heap sizes,
44 #   usually causing it to use less space in such situations.
45 #   Incremental collection no longer works in this case.
46 # -DLARGE_CONFIG tunes the collector for unusually large heaps.
47 #   Necessary for heaps larger than about 500 MB on most machines.
48 #   Recommended for heaps larger than about 64 MB.
49 # -DDONT_ADD_BYTE_AT_END is meaningful only with
50 #   -DALL_INTERIOR_POINTERS.  Normally -DALL_INTERIOR_POINTERS
51 #   causes all objects to be padded so that pointers just past the end of
52 #   an object can be recognized.  This can be expensive.  (The padding
53 #   is normally more than one byte due to alignment constraints.)
54 #   -DDONT_ADD_BYTE_AT_END disables the padding.
55 # -DNO_SIGNALS does not disable signals during critical parts of
56 #   the GC process.  This is no less correct than many malloc 
57 #   implementations, and it sometimes has a significant performance
58 #   impact.  However, it is dangerous for many not-quite-ANSI C
59 #   programs that call things like printf in asynchronous signal handlers.
60 #   This is on by default.  Turning it off has not been extensively tested with
61 #   compilers that reorder stores.  It should have been.
62 # -DNO_EXECUTE_PERMISSION may cause some or all of the heap to not
63 #   have execute permission, i.e. it may be impossible to execute
64 #   code from the heap.  Currently this only affects the incremental
65 #   collector on UNIX machines.  It may greatly improve its performance,
66 #   since this may avoid some expensive cache synchronization.
67 # -DGC_NO_OPERATOR_NEW_ARRAY declares that the C++ compiler does not support
68 #   the  new syntax "operator new[]" for allocating and deleting arrays.
69 #   See gc_cpp.h for details.  No effect on the C part of the collector.
70 #   This is defined implicitly in a few environments.  Must also be defined
71 #   by clients that use gc_cpp.h.
72 # -DREDIRECT_MALLOC=X causes malloc, realloc, and free to be defined
73 #   as aliases for X, GC_realloc, and GC_free, respectively.
74 #   Calloc is redefined in terms of the new malloc.  X should
75 #   be either GC_malloc or GC_malloc_uncollectable.
76 #   The former is occasionally useful for working around leaks in code
77 #   you don't want to (or can't) look at.  It may not work for
78 #   existing code, but it often does.  Neither works on all platforms,
79 #   since some ports use malloc or calloc to obtain system memory.
80 #   (Probably works for UNIX, and win32.)
81 # -DIGNORE_FREE turns calls to free into a noop.  Only useful with
82 #   -DREDIRECT_MALLOC.
83 # -DNO_DEBUGGING removes GC_dump and the debugging routines it calls.
84 #   Reduces code size slightly at the expense of debuggability.
85 # -DJAVA_FINALIZATION makes it somewhat safer to finalize objects out of
86 #   order by specifying a nonstandard finalization mark procedure  (see
87 #   finalize.c).  Objects reachable from finalizable objects will be marked
88 #   in a sepearte postpass, and hence their memory won't be reclaimed.
89 #   Not recommended unless you are implementing a language that specifies
90 #   these semantics.  Since 5.0, determines only only the initial value
91 #   of GC_java_finalization variable.
92 # -DFINALIZE_ON_DEMAND causes finalizers to be run only in response
93 #   to explicit GC_invoke_finalizers() calls.
94 #   In 5.0 this became runtime adjustable, and this only determines the
95 #   initial value of GC_finalize_on_demand.
96 # -DATOMIC_UNCOLLECTABLE includes code for GC_malloc_atomic_uncollectable.
97 #   This is useful if either the vendor malloc implementation is poor,
98 #   or if REDIRECT_MALLOC is used.
99 # -DHBLKSIZE=ddd, where ddd is a power of 2 between 512 and 16384, explicitly
100 #   sets the heap block size.  Each heap block is devoted to a single size and
101 #   kind of object.  For the incremental collector it makes sense to match
102 #   the most likely page size.  Otherwise large values result in more
103 #   fragmentation, but generally better performance for large heaps.
104 # -DPRINT_BLACK_LIST Whenever a black list entry is added, i.e. whenever
105 #   the garbage collector detects a value that looks almost, but not quite,
106 #   like a pointer, print both the address containing the value, and the
107 #   value of the near-bogus-pointer.  Can be used to identifiy regions of
108 #   memory that are likely to contribute misidentified pointers.
109 # -DKEEP_BACK_PTRS Add code to save back pointers in debugging headers
110 #   for objects allocated with the debugging allocator.  If all objects
111 #   through GC_MALLOC with GC_DEBUG defined, this allows the client
112 #   to determine how particular or randomly chosen objects are reachable
113 #   for debugging/profiling purposes.  The gc_backptr.h interface is
114 #   implemented only if this is defined.
115 # -DGC_ASSERTIONS Enable some internal GC assertion checking.  Currently
116 #   this facility is only used in a few places.  It is intended primarily
117 #   for debugging of the garbage collector itself, but could also
118 # -DDBG_HDRS_ALL Make sure that all objects have debug headers.  Increases
119 #   the reliability (from 99.9999% to 100%) of some of the debugging
120 #   code (especially KEEP_BACK_PTRS).  Makes -DSHORT_DBG_HDRS possible.
121 #   Assumes that all client allocation is done through debugging
122 #   allocators.
123 # -DSHORT_DBG_HDRS Assume that all objects have debug headers.  Shorten
124 #   the headers to minimize object size, at the expense of checking for
125 #   writes past the end of an object.  This is intended for environments
126 #   in which most client code is written in a "safe" language, such as
127 #   Scheme or Java.  Assumes that all client allocation is done using
128 #   the GC_debug_ functions (or through the macros that expand to these.
129 #   (Also eliminates the field for the requested object size.)
130 #   occasionally be useful for debugging of client code.  Slows down the
131 #   collector somewhat, but not drastically.
132 # -DCHECKSUMS reports on erroneously clear dirty bits, and unexpectedly
133 #   altered stubborn objects, at substantial performance cost.
134 #   Use only for debugging of the incremental collector.
135 # -DGC_GCJ_SUPPORT includes support for gcj (and possibly other systems
136 #   that include a pointer to a type descriptor in each allocated object).
137 #   Building this way requires an ANSI C compiler.
138 # -DUSE_I686_PREFETCH causes the collector to issue Pentium III style
139 #   prefetch instructions.  No effect except on X86 Linux platforms.
140 #   Assumes a very recent gcc-compatible compiler and assembler.
141 #   (Gas prefetcht0 support was added around May 1999.)
142 #   Empirically the code appears to still run correctly on Pentium II
143 #   processors, though with no performance benefit.  May not run on other
144 #   X86 processors?  In some cases this improves performance by
145 #   15% or so.
146 # -DUSE_3DNOW_PREFETCH causes the collector to issue AMD 3DNow style
147 #   prefetch instructions.  Same restrictions as USE_I686_PREFETCH.
148 #   UNTESTED!!
149 # -DGC_USE_LD_WRAP in combination with the gld flags listed in README.linux
150 #   causes the collector some system and pthread calls in a more transparent
151 #   fashion than the usual macro-based approach.  Requires GNU ld, and
152 #   currently probably works only with Linux.
153
154
155 CXXFLAGS= $(CFLAGS) -DGC_OPERATOR_NEW_ARRAY
156 AR= ar
157 RANLIB= ranlib
158
159
160 OBJS= alloc.o reclaim.o allchblk.o misc.o mach_dep.o os_dep.o mark_rts.o headers.o mark.o obj_map.o blacklst.o finalize.o new_hblk.o dbg_mlc.o malloc.o stubborn.o checksums.o solaris_threads.o typd_mlc.o ptr_chck.o mallocx.o solaris_pthreads.o gcj_mlc.o specific.o
161
162 CSRCS= reclaim.c allchblk.c misc.c alloc.c mach_dep.c os_dep.c mark_rts.c headers.c mark.c obj_map.c pcr_interface.c blacklst.c finalize.c new_hblk.c real_malloc.c dyn_load.c dbg_mlc.c malloc.c stubborn.c checksums.c solaris_threads.c typd_mlc.c ptr_chck.c mallocx.c solaris_pthreads.c gcj_mlc.c specific.c
163
164 CORD_SRCS=  cord/cordbscs.c cord/cordxtra.c cord/cordprnt.c cord/de.c cord/cordtest.c include/cord.h include/ec.h include/private/cord_pos.h cord/de_win.c cord/de_win.h cord/de_cmds.h cord/de_win.ICO cord/de_win.RC cord/SCOPTIONS.amiga cord/SMakefile.amiga
165
166 CORD_OBJS=  cord/cordbscs.o cord/cordxtra.o cord/cordprnt.o
167
168 SRCS= $(CSRCS) mips_sgi_mach_dep.S rs6000_mach_dep.s alpha_mach_dep.S \
169     sparc_mach_dep.S include/gc.h include/gc_typed.h \
170     include/private/gc_hdrs.h include/private/gc_priv.h \
171     include/private/gcconfig.h include/private/gc_mark.h \
172     include/gc_inl.h include/gc_inline.h gc.man \
173     threadlibs.c if_mach.c if_not_there.c gc_cpp.cc include/gc_cpp.h \
174     include/weakpointer.h include/private/gc_locks.h \
175     gcc_support.c mips_ultrix_mach_dep.s include/gc_alloc.h \
176     include/new_gc_alloc.h include/javaxfc.h sparc_sunos4_mach_dep.s \
177     include/private/solaris_threads.h include/gc_backptr.h \
178     hpux_test_and_clear.s include/gc_gcj.h \
179     include/gc_local_alloc.h include/private/dbg_mlc.h \
180     include/private/specific.h powerpc_darwin_mach_dep.s \
181     include/leak_detector.h $(CORD_SRCS)
182
183 OTHER_FILES= Makefile PCR-Makefile OS2_MAKEFILE NT_MAKEFILE BCC_MAKEFILE \
184            README tests/test.c test_cpp.cc setjmp_t.c SMakefile.amiga \
185            SCoptions.amiga README.amiga README.win32 cord/README \
186            README.rs6000 README.QUICK callprocs pc_excludes \
187            barrett_diagram README.OS2 README.Mac MacProjects.sit.hqx \
188            MacOS.c EMX_MAKEFILE README.debugging \
189            Mac_files/datastart.c Mac_files/dataend.c \
190            Mac_files/MacOS_config.h Mac_files/MacOS_Test_config.h \
191            add_gc_prefix.c README.solaris2 README.sgi README.hp README.uts \
192            win32_threads.c NT_THREADS_MAKEFILE gc.mak README.dj Makefile.dj \
193            README.alpha README.linux README.MacOSX version.h Makefile.DLLs \
194            WCC_MAKEFILE nursery.c include/gc_nursery.h include/gc_copy_descr.h
195
196 CORD_INCLUDE_FILES= $(srcdir)/include/gc.h $(srcdir)/include/cord.h \
197         $(srcdir)/include/ec.h $(srcdir)/include/private/cord_pos.h
198
199 UTILS= if_mach$(EXE_SUFFIX) if_not_there$(EXE_SUFFIX)
200
201 # Libraries needed for curses applications.  Only needed for de.
202 CURSES= -lcurses -ltermlib
203
204 # The following is irrelevant on most systems.  But a few
205 # versions of make otherwise fork the shell specified in
206 # the SHELL environment variable.
207 SHELL= /bin/sh
208
209 SPECIALCFLAGS = -I$(srcdir)/include
210 # Alternative flags to the C compiler for mach_dep.c.
211 # Mach_dep.c often doesn't like optimization, and it's
212 # not time-critical anyway.
213 # Set SPECIALCFLAGS to -q nodirect_code on Encore.
214
215 all: gc.a gctest$(EXE_SUFFIX)
216
217 $(OBJS) test.o dyn_load.o dyn_load_sunos53.o: \
218     $(srcdir)/include/private/gc_priv.h \
219     $(srcdir)/include/private/gc_hdrs.h $(srcdir)/include/private/gc_locks.h \
220     $(srcdir)/include/gc.h \
221     $(srcdir)/include/private/gcconfig.h $(srcdir)/include/gc_typed.h \
222     Makefile
223 # The dependency on Makefile is needed.  Changing
224 # options such as -DSILENT affects the size of GC_arrays,
225 # invalidating all .o files that rely on gc_priv.h
226
227 mark.o typd_mlc.o finalize.o: $(srcdir)/include/gc_mark.h
228
229 base_lib gc.a: $(OBJS) dyn_load.o $(UTILS)
230         echo > base_lib
231         rm -f on_sparc_sunos5_1
232         ./if_mach SPARC SUNOS5 touch on_sparc_sunos5_1
233         ./if_mach SPARC SUNOS5 $(AR) rus gc.a $(OBJS) dyn_load.o
234         ./if_not_there on_sparc_sunos5_1 $(AR) ru gc.a $(OBJS) dyn_load.o
235         -./if_not_there on_sparc_sunos5_1 $(RANLIB) gc.a
236 #       ignore ranlib failure; that usually means it doesn't exist, and isn't needed
237
238 cords: $(CORD_OBJS) cord/cordtest$(EXE_SUFFIX) $(UTILS)
239         rm -f on_sparc_sunos5_3
240         ./if_mach SPARC SUNOS5 touch on_sparc_sunos5_3
241         ./if_mach SPARC SUNOS5 $(AR) rus gc.a $(CORD_OBJS)
242         ./if_not_there on_sparc_sunos5_3 $(AR) ru gc.a $(CORD_OBJS)
243         -./if_not_there on_sparc_sunos5_3 $(RANLIB) gc.a
244
245 gc_cpp.o: $(srcdir)/gc_cpp.cc $(srcdir)/include/gc_cpp.h $(srcdir)/include/gc.h Makefile
246         $(CXX) -c $(CXXFLAGS) $(srcdir)/gc_cpp.cc
247
248 test_cpp$(EXE_SUFFIX): $(srcdir)/test_cpp.cc $(srcdir)/include/gc_cpp.h gc_cpp.o $(srcdir)/include/gc.h \
249 base_lib $(UTILS)
250         rm -f test_cpp test_cpp$(EXE_SUFFIX)
251         ./if_mach HP_PA "" $(CXX) $(CXXFLAGS) -o test_cpp $(srcdir)/test_cpp.cc gc_cpp.o gc.a -ldld
252         ./if_not_there test_cpp$(EXE_SUFFIX) $(CXXLD) $(CXXFLAGS) -o test_cpp$(EXE_SUFFIX) $(srcdir)/test_cpp.cc gc_cpp.o gc.a
253         rm -f test_cpp
254
255 c++: gc_cpp.o $(srcdir)/include/gc_cpp.h test_cpp$(EXE_SUFFIX)
256         rm -f on_sparc_sunos5_4
257         ./if_mach SPARC SUNOS5 touch on_sparc_sunos5_4
258         ./if_mach SPARC SUNOS5 $(AR) rus gc.a gc_cpp.o
259         ./if_not_there on_sparc_sunos5_4 $(AR) ru gc.a gc_cpp.o
260         -./if_not_there on_sparc_sunos5_4 $(RANLIB) gc.a
261         ./test_cpp$(EXE_SUFFIX) 1
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 -lo
285         ln liblinuxgc.so libgc.so
286
287 mach_dep.o: $(srcdir)/mach_dep.c $(srcdir)/mips_sgi_mach_dep.S $(srcdir)/mips_ultrix_mach_dep.s \
288             $(srcdir)/rs6000_mach_dep.s $(srcdir)/powerpc_darwin_mach_dep.s $(UTILS)
289         rm -f mach_dep.o
290         ./if_mach MIPS IRIX5 $(AS) -o mach_dep.o $(srcdir)/mips_sgi_mach_dep.S
291         ./if_mach MIPS RISCOS $(AS) -o mach_dep.o $(srcdir)/mips_ultrix_mach_dep.s
292         ./if_mach MIPS ULTRIX $(AS) -o mach_dep.o $(srcdir)/mips_ultrix_mach_dep.s
293         ./if_mach RS6000 "" $(AS) -o mach_dep.o $(srcdir)/rs6000_mach_dep.s
294         ./if_mach POWERPC MACOSX $(AS) -o mach_dep.o $(srcdir)/powerpc_darwin_mach_dep.s
295         ./if_mach ALPHA "" $(AS) -o mach_dep.o $(srcdir)/alpha_mach_dep.S
296         ./if_mach SPARC SUNOS5 $(AS) -o mach_dep.o $(srcdir)/sparc_mach_dep.S
297         ./if_mach SPARC SUNOS4 $(AS) -o mach_dep.o $(srcdir)/sparc_sunos4_mach_dep.s
298         ./if_not_there mach_dep.o $(CC) -c $(SPECIALCFLAGS) $(srcdir)/mach_dep.c
299
300 mark_rts.o: $(srcdir)/mark_rts.c if_mach if_not_there $(UTILS)
301         rm -f mark_rts.o
302         -./if_mach ALPHA OSF1 $(CC) -c $(CFLAGS) -Wo,-notail $(srcdir)/mark_rts.c
303         ./if_not_there mark_rts.o $(CC) -c $(CFLAGS) $(srcdir)/mark_rts.c
304 #       Work-around for DEC optimizer tail recursion elimination bug.
305 #  The ALPHA-specific line should be removed if gcc is used.
306
307 alloc.o: version.h
308
309 cord/cordbscs.o: $(srcdir)/cord/cordbscs.c $(CORD_INCLUDE_FILES)
310         $(CC) $(CFLAGS) -c -I$(srcdir) $(srcdir)/cord/cordbscs.c
311         mv cordbscs.o cord/cordbscs.o
312 #  not all compilers understand -o filename
313
314 cord/cordxtra.o: $(srcdir)/cord/cordxtra.c $(CORD_INCLUDE_FILES)
315         $(CC) $(CFLAGS) -c -I$(srcdir) $(srcdir)/cord/cordxtra.c
316         mv cordxtra.o cord/cordxtra.o
317
318 cord/cordprnt.o: $(srcdir)/cord/cordprnt.c $(CORD_INCLUDE_FILES)
319         $(CC) $(CFLAGS) -c -I$(srcdir) $(srcdir)/cord/cordprnt.c
320         mv cordprnt.o cord/cordprnt.o
321
322 cord/cordtest$(EXE_SUFFIX): $(srcdir)/cord/cordtest.c $(CORD_OBJS) gc.a $(UTILS) /tmp
323         rm -f cord/cordtest$(EXE_SUFFIX)
324         ./if_mach SPARC DRSNX $(CC) $(CFLAGS) -o cord/cordtest$(EXE_SUFFIX) $(srcdir)/cord/cordtest.c $(CORD_OBJS) gc.a -lucb
325         ./if_mach HP_PA "" $(CC) $(CFLAGS) -o cord/cordtest$(EXE_SUFFIX) $(srcdir)/cord/cordtest.c $(CORD_OBJS) gc.a -ldld
326         ./if_not_there cord/cordtest$(EXE_SUFFIX) $(CC) $(CFLAGS) -o cord/cordtest $(srcdir)/cord/cordtest.c $(CORD_OBJS) gc.a
327         rm -f cord/cordtest cordtest
328         -mv cordtest$(EXE_SUFFIX) cord/
329
330 /tmp: $(UTILS)
331         ./if_not_there /tmp mkdir /tmp
332
333 cord/de$(EXE_SUFFIX): $(srcdir)/cord/de.c cord/cordbscs.o cord/cordxtra.o gc.a $(UTILS)
334         rm -f cord/de cord/de$(EXE_SUFFIX)
335         ./if_mach SPARC DRSNX $(CC) $(CFLAGS) -o cord/de $(srcdir)/cord/de.c cord/cordbscs.o cord/cordxtra.o gc.a $(CURSES) -lucb `./threadlibs`
336         ./if_mach HP_PA "" $(CC) $(CFLAGS) -o cord/de $(srcdir)/cord/de.c cord/cordbscs.o cord/cordxtra.o gc.a $(CURSES) -ldld
337         ./if_mach RS6000 "" $(CC) $(CFLAGS) -o cord/de $(srcdir)/cord/de.c cord/cordbscs.o cord/cordxtra.o gc.a -lcurses
338         ./if_mach I386 LINUX $(CC) $(CFLAGS) -o cord/de $(srcdir)/cord/de.c cord/cordbscs.o cord/cordxtra.o gc.a -lcurses `./threadlibs`
339         ./if_mach ALPHA LINUX $(CC) $(CFLAGS) -o cord/de $(srcdir)/cord/de.c cord/cordbscs.o cord/cordxtra.o gc.a -lcurses
340         ./if_not_there cord/de$(EXE_SUFFIX) $(CC) $(CFLAGS) -o cord/de$(EXE_SUFFIX) $(srcdir)/cord/de.c cord/cordbscs.o cord/cordxtra.o gc.a $(CURSES)
341
342 if_mach$(EXE_SUFFIX): $(srcdir)/if_mach.c $(srcdir)/include/private/gcconfig.h
343         rm -f if_mach if_mach$(EXE_SUFFIX)
344         $(CC) $(CFLAGS) -o if_mach $(srcdir)/if_mach.c
345
346 threadlibs$(EXE_SUFFIX): $(srcdir)/threadlibs.c $(srcdir)include/private/gcconfig.h Makefile
347         rm -f threadlibs threadlibs$(EXE_SUFFIX)
348         $(CC) $(CFLAGS) -o threadlibs $(srcdir)/threadlibs.c
349
350 if_not_there$(EXE_SUFFIX): $(srcdir)/if_not_there.c
351         rm -f if_not_there if_not_there$(EXE_SUFFIX)
352         $(CC) $(CFLAGS) -o if_not_there $(srcdir)/if_not_there.c
353
354 # Clean removes *.o several times,
355 # because as the first one doesn't seem to get them all!
356 clean: 
357         rm -f gc.a *.o
358         rm -f *.o
359         rm -f *.o
360         rm -f cord/*.o
361         rm -f gctest gctest_dyn_link test_cpp
362         rm -f setjmp_test  mon.out gmon.out a.out core if_not_there if_mach
363         rm -f threadlibs $(CORD_OBJS) cordtest cord/cordtest de cord/de
364         rm -f gctest$(EXE_SUFFIX) gctest_dyn_link$(EXE_SUFFIX) test_cpp$(EXE_SUFFIX)
365         rm -f setjmp_test$(EXE_SUFFIX) if_not_there$(EXE_SUFFIX) if_mach$(EXE_SUFFIX)
366         rm -f threadlibs$(EXE_SUFFIX) cord/cordtest$(EXE_SUFFIX)
367         -rm -f *~
368
369 gctest$(EXE_SUFFIX): tests/test.o gc.a if_mach$(EXE_SUFFIX) if_not_there$(EXE_SUFFIX)
370         rm -f gctest gctest$(EXE_SUFFIX)
371         ./if_mach SPARC DRSNX $(CC) $(CFLAGS) -o gctest  tests/test.o gc.a -lucb
372         ./if_mach HP_PA "" $(CC) $(CFLAGS) -o gctest  tests/test.o gc.a -ldld
373         ./if_not_there gctest$(EXE_SUFFIX) $(CC) $(CFLAGS) -o gctest$(EXE_SUFFIX) tests/test.o gc.a
374         rm -f gctest
375
376 # If an optimized setjmp_test generates a segmentation fault,
377 # odds are your compiler is broken.  Gctest may still work.
378 # Try compiling setjmp_t.c unoptimized.
379 setjmp_test$(EXE_SUFFIX): $(srcdir)/setjmp_t.c $(srcdir)/include/gc.h \
380                 if_mach$(EXE_SUFFIX) if_not_there$(EXE_SUFFIX)
381         rm -f setjmp_test$(EXE_SUFFIX)
382         $(CC) $(CFLAGS) -o setjmp_test $(srcdir)/setjmp_t.c
383         rm -f setjmp_test
384
385 test:  KandRtest cord/cordtest$(EXE_SUFFIX)
386         ./cord/cordtest$(EXE_SUFFIX)
387
388 # Those tests that work even with a K&R C compiler:
389 KandRtest: setjmp_test$(EXE_SUFFIX) gctest$(EXE_SUFFIX)
390         ./setjmp_test$(EXE_SUFFIX)
391         ./gctest$(EXE_SUFFIX)
392
393 add_gc_prefix$(EXE_SUFFIX): add_gc_prefix.c
394         $(CC) -o add_gc_prefix$(EXE_SUFFIX) $(srcdir)/add_gc_prefix.c
395         rm -f add_gc_prefix
396
397 gc.tar: $(SRCS) $(OTHER_FILES) add_gc_prefix
398         ./add_gc_prefix$(EXE_SUFFIX) $(SRCS) $(OTHER_FILES) > /tmp/gc.tar-files
399         (cd $(srcdir)/.. ; tar cvfh - `cat /tmp/gc.tar-files`) > gc.tar
400
401 pc_gc.tar: $(SRCS) $(OTHER_FILES)
402         tar cvfX pc_gc.tar pc_excludes $(SRCS) $(OTHER_FILES)
403
404 gc.tar.Z: gc.tar
405         compress gc.tar
406
407 gc.tar.gz: gc.tar
408         gzip gc.tar
409
410 lint: $(CSRCS) tests/test.c
411         lint -DLINT $(CSRCS) tests/test.c | egrep -v "possible pointer alignment problem|abort|exit|sbrk|mprotect|syscall"
412
413 # BTL: added to test shared library version of collector.
414 # Currently works only under SunOS5.  Requires GC_INIT call from statically
415 # loaded client code.
416 ABSDIR = `pwd`
417 gctest_dyn_link: test.o libgc.so
418         $(CC) -L$(ABSDIR) -R$(ABSDIR) -o gctest_dyn_link test.o -lgc -ldl -lthread
419
420 test_dll.o: tests/test.c libgc_globals.h
421         $(CC) $(CFLAGS) -DGC_USE_DLL -c tests/test.c -o test_dll.o
422
423 test_dll: test_dll.o libgc_dll.a libgc.dll
424         $(CC) test_dll.o -L$(ABSDIR) -lgc_dll -o test_dll
425
426 SYM_PREFIX-libgc=GC
427
428 # Uncomment the following line to build a GNU win32 DLL
429 # include Makefile.DLLs
430