OSDN Git Service

Merged GC 5.0alpha4 with local changes, plus:
[pf3gnuchains/gcc-fork.git] / boehm-gc / Makefile.dj
1 # Primary targets:
2 # gc.a - builds basic library
3 # libgc.a - builds library for use with g++ "-fgc-keyword" extension
4 # c++ - adds C++ interface to library
5 # cords - adds cords (heavyweight strings) to library
6 # test - prints porting information, then builds basic version of gc.a,
7 #        and runs some tests of collector and cords.  Does not add cords or
8 #        c++ interface to gc.a
9 # cord/de$(EXE_SUFFIX) - builds dumb editor based on cords.
10 ABI_FLAG=
11 CC=gcc $(ABI_FLAG)
12 CXX=gxx $(ABI_FLAG)
13 AS=gcc -c -x assembler-with-cpp $(ABI_FLAG)
14 #  The above doesn't work with gas, which doesn't run cpp.
15 #  Define AS as `gcc -c -x assembler-with-cpp' instead.
16 #  Under Irix 6, you will have to specify the ABI (-o32, -n32, or -64)
17 #  if you use something other than the default ABI on your machine.
18
19 # special defines for DJGPP
20 CXXLD=gxx $(ABI_FLAG)
21 EXE_SUFFIX=.exe
22
23 CFLAGS= -O -DATOMIC_UNCOLLECTABLE -DNO_SIGNALS -DALL_INTERIOR_POINTERS -DNO_EXECUTE_PERMISSION -DSILENT
24
25 # For dynamic library builds, it may be necessary to add flags to generate
26 # PIC code, e.g. -fPIC on Linux.
27
28 # Setjmp_test may yield overly optimistic results when compiled
29 # without optimization.
30 # -DSILENT disables statistics printing, and improves performance.
31 # -DCHECKSUMS reports on erroneously clear dirty bits, and unexpectedly
32 #   altered stubborn objects, at substantial performance cost.
33 #   Use only for incremental collector debugging.
34 # -DFIND_LEAK causes the collector to assume that all inaccessible
35 #   objects should have been explicitly deallocated, and reports exceptions.
36 #   Finalization and the test program are not usable in this mode.
37 # -DSOLARIS_THREADS enables support for Solaris (thr_) threads.
38 #   (Clients should also define SOLARIS_THREADS and then include
39 #   gc.h before performing thr_ or dl* or GC_ operations.)
40 #   Must also define -D_REENTRANT.
41 # -D_SOLARIS_PTHREADS enables support for Solaris pthreads.
42 #   Define SOLARIS_THREADS as well.
43 # -DIRIX_THREADS enables support for Irix pthreads.  See README.irix.
44 # -DLINUX_THREADS enables support for Xavier Leroy's Linux threads.
45 #   see README.linux.  -D_REENTRANT may also be required.
46 # -DALL_INTERIOR_POINTERS allows all pointers to the interior
47 #   of objects to be recognized.  (See gc_priv.h for consequences.)
48 # -DSMALL_CONFIG tries to tune the collector for small heap sizes,
49 #   usually causing it to use less space in such situations.
50 #   Incremental collection no longer works in this case.
51 # -DLARGE_CONFIG tunes the collector for unusually large heaps.
52 #   Necessary for heaps larger than about 500 MB on most machines.
53 #   Recommended for heaps larger than about 64 MB.
54 # -DDONT_ADD_BYTE_AT_END is meaningful only with
55 #   -DALL_INTERIOR_POINTERS.  Normally -DALL_INTERIOR_POINTERS
56 #   causes all objects to be padded so that pointers just past the end of
57 #   an object can be recognized.  This can be expensive.  (The padding
58 #   is normally more than one byte due to alignment constraints.)
59 #   -DDONT_ADD_BYTE_AT_END disables the padding.
60 # -DNO_SIGNALS does not disable signals during critical parts of
61 #   the GC process.  This is no less correct than many malloc 
62 #   implementations, and it sometimes has a significant performance
63 #   impact.  However, it is dangerous for many not-quite-ANSI C
64 #   programs that call things like printf in asynchronous signal handlers.
65 # -DNO_EXECUTE_PERMISSION may cause some or all of the heap to not
66 #   have execute permission, i.e. it may be impossible to execute
67 #   code from the heap.  Currently this only affects the incremental
68 #   collector on UNIX machines.  It may greatly improve its performance,
69 #   since this may avoid some expensive cache synchronization.
70 # -DOPERATOR_NEW_ARRAY declares that the C++ compiler supports the
71 #   new syntax "operator new[]" for allocating and deleting arrays.
72 #   See gc_cpp.h for details.  No effect on the C part of the collector.
73 #   This is defined implicitly in a few environments.
74 # -DREDIRECT_MALLOC=X causes malloc, realloc, and free to be defined
75 #   as aliases for X, GC_realloc, and GC_free, respectively.
76 #   Calloc is redefined in terms of the new malloc.  X should
77 #   be either GC_malloc or GC_malloc_uncollectable.
78 #   The former is occasionally useful for working around leaks in code
79 #   you don't want to (or can't) look at.  It may not work for
80 #   existing code, but it often does.  Neither works on all platforms,
81 #   since some ports use malloc or calloc to obtain system memory.
82 #   (Probably works for UNIX, and win32.)
83 # -DIGNORE_FREE turns calls to free into a noop.  Only useful with
84 #   -DREDIRECT_MALLOC.
85 # -DNO_DEBUGGING removes GC_dump and the debugging routines it calls.
86 #   Reduces code size slightly at the expense of debuggability.
87 # -DJAVA_FINALIZATION makes it somewhat safer to finalize objects out of
88 #   order by specifying a nonstandard finalization mark procedure  (see
89 #   finalize.c).  Objects reachable from finalizable objects will be marked
90 #   in a sepearte postpass, and hence their memory won't be reclaimed.
91 #   Not recommended unless you are implementing a language that specifies
92 #   these semantics.
93 # -DFINALIZE_ON_DEMAND causes finalizers to be run only in response
94 #   to explicit GC_invoke_finalizers() calls.
95 # -DATOMIC_UNCOLLECTABLE includes code for GC_malloc_atomic_uncollectable.
96 #   This is useful if either the vendor malloc implementation is poor,
97 #   or if REDIRECT_MALLOC is used.
98 # -DHBLKSIZE=ddd, where ddd is a power of 2 between 512 and 16384, explicitly
99 #   sets the heap block size.  Each heap block is devoted to a single size and
100 #   kind of object.  For the incremental collector it makes sense to match
101 #   the most likely page size.  Otherwise large values result in more
102 #   fragmentation, but generally better performance for large heaps.
103 # -DUSE_MMAP use MMAP instead of sbrk to get new memory.
104 #   Works for Solaris and Irix.
105 # -DMMAP_STACKS (for Solaris threads) Use mmap from /dev/zero rather than
106 #   GC_scratch_alloc() to get stack memory.
107 # -DPRINT_BLACK_LIST Whenever a black list entry is added, i.e. whenever
108 #   the garbage collector detects a value that looks almost, but not quite,
109 #   like a pointer, print both the address containing the value, and the
110 #   value of the near-bogus-pointer.  Can be used to identifiy regions of
111 #   memory that are likely to contribute misidentified pointers.
112 # -DOLD_BLOCK_ALLOC Use the old, possibly faster, large block
113 #   allocation strategy.  The new strategy tries harder to minimize
114 #   fragmentation, sometimes at the expense of spending more time in the
115 #   large block allocator and/or collecting more frequently.
116 #   If you expect the allocator to promtly use an explicitly expanded
117 #   heap, this is highly recommended.
118 #
119
120
121
122 LIBGC_CFLAGS= -O -DNO_SIGNALS -DSILENT \
123     -DREDIRECT_MALLOC=GC_malloc_uncollectable \
124     -DDONT_ADD_BYTE_AT_END -DALL_INTERIOR_POINTERS
125 #   Flags for building libgc.a -- the last two are required.
126
127 CXXFLAGS= $(CFLAGS) -DOPERATOR_NEW_ARRAY
128 AR= ar
129 RANLIB= ranlib
130
131
132 # Redefining srcdir allows object code for the nonPCR version of the collector
133 # to be generated in different directories.  In this case, the destination directory
134 # should contain a copy of the original include directory.
135 srcdir = .
136 VPATH = $(srcdir)
137
138 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 irix_threads.o linux_threads.o typd_mlc.o ptr_chck.o mallocx.o solaris_pthreads.o
139
140 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 irix_threads.c linux_threads.c typd_mlc.c ptr_chck.c mallocx.c solaris_pthreads.c
141
142 CORD_SRCS=  cord/cordbscs.c cord/cordxtra.c cord/cordprnt.c cord/de.c cord/cordtest.c cord/cord.h cord/ec.h cord/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
143
144 CORD_OBJS=  cord/cordbscs.o cord/cordxtra.o cord/cordprnt.o
145
146 SRCS= $(CSRCS) mips_sgi_mach_dep.s rs6000_mach_dep.s alpha_mach_dep.s \
147     sparc_mach_dep.s gc.h gc_typed.h gc_hdrs.h gc_priv.h gc_private.h \
148     gcconfig.h gc_mark.h include/gc_inl.h include/gc_inline.h gc.man \
149     threadlibs.c if_mach.c if_not_there.c gc_cpp.cc gc_cpp.h weakpointer.h \
150     gcc_support.c mips_ultrix_mach_dep.s include/gc_alloc.h gc_alloc.h \
151     include/new_gc_alloc.h include/javaxfc.h sparc_sunos4_mach_dep.s \
152     solaris_threads.h $(CORD_SRCS)
153
154 OTHER_FILES= Makefile PCR-Makefile OS2_MAKEFILE NT_MAKEFILE BCC_MAKEFILE \
155            README test.c test_cpp.cc setjmp_t.c SMakefile.amiga \
156            SCoptions.amiga README.amiga README.win32 cord/README \
157            cord/gc.h include/gc.h include/gc_typed.h include/cord.h \
158            include/ec.h include/private/cord_pos.h include/private/gcconfig.h \
159            include/private/gc_hdrs.h include/private/gc_priv.h \
160            include/gc_cpp.h README.rs6000 \
161            include/weakpointer.h README.QUICK callprocs pc_excludes \
162            barrett_diagram README.OS2 README.Mac MacProjects.sit.hqx \
163            MacOS.c EMX_MAKEFILE makefile.depend README.debugging \
164            include/gc_cpp.h Mac_files/datastart.c Mac_files/dataend.c \
165            Mac_files/MacOS_config.h Mac_files/MacOS_Test_config.h \
166            add_gc_prefix.c README.solaris2 README.sgi README.hp README.uts \
167            win32_threads.c NT_THREADS_MAKEFILE gc.mak README.dj Makefile.dj \
168            README.alpha README.linux version.h Makefile.DLLs \
169            WCC_MAKEFILE
170
171 CORD_INCLUDE_FILES= $(srcdir)/gc.h $(srcdir)/cord/cord.h $(srcdir)/cord/ec.h \
172            $(srcdir)/cord/private/cord_pos.h
173
174 UTILS= if_mach$(EXE_SUFFIX) if_not_there$(EXE_SUFFIX)
175
176 # Libraries needed for curses applications.  Only needed for de.
177 CURSES= -lcurses -ltermlib
178
179 # The following is irrelevant on most systems.  But a few
180 # versions of make otherwise fork the shell specified in
181 # the SHELL environment variable.
182 SHELL= /bin/sh
183
184 SPECIALCFLAGS = 
185 # Alternative flags to the C compiler for mach_dep.c.
186 # Mach_dep.c often doesn't like optimization, and it's
187 # not time-critical anyway.
188 # Set SPECIALCFLAGS to -q nodirect_code on Encore.
189
190 all: gc.a gctest$(EXE_SUFFIX)
191
192 pcr: PCR-Makefile gc_private.h gc_hdrs.h gc.h gcconfig.h mach_dep.o $(SRCS)
193         make -f PCR-Makefile depend
194         make -f PCR-Makefile
195
196 $(OBJS) test.o dyn_load.o dyn_load_sunos53.o: $(srcdir)/gc_priv.h $(srcdir)/gc_hdrs.h $(srcdir)/gc.h \
197     $(srcdir)/gcconfig.h $(srcdir)/gc_typed.h Makefile
198 # The dependency on Makefile is needed.  Changing
199 # options such as -DSILENT affects the size of GC_arrays,
200 # invalidating all .o files that rely on gc_priv.h
201
202 mark.o typd_mlc.o finalize.o: $(srcdir)/gc_mark.h
203
204 base_lib gc.a: $(OBJS) dyn_load.o $(UTILS)
205         echo > base_lib
206         rm -f on_sparc_sunos5_1
207         ./if_mach SPARC SUNOS5 touch on_sparc_sunos5_1
208         ./if_mach SPARC SUNOS5 $(AR) rus gc.a $(OBJS) dyn_load.o
209         ./if_not_there on_sparc_sunos5_1 $(AR) ru gc.a $(OBJS) dyn_load.o
210         -./if_not_there on_sparc_sunos5_1 $(RANLIB) gc.a
211 #       ignore ranlib failure; that usually means it doesn't exist, and isn't needed
212
213 cords: $(CORD_OBJS) cord/cordtest$(EXE_SUFFIX) $(UTILS)
214         rm -f on_sparc_sunos5_3
215         ./if_mach SPARC SUNOS5 touch on_sparc_sunos5_3
216         ./if_mach SPARC SUNOS5 $(AR) rus gc.a $(CORD_OBJS)
217         ./if_not_there on_sparc_sunos5_3 $(AR) ru gc.a $(CORD_OBJS)
218         -./if_not_there on_sparc_sunos5_3 $(RANLIB) gc.a
219
220 gc_cpp.o: $(srcdir)/gc_cpp.cc $(srcdir)/gc_cpp.h $(srcdir)/gc.h Makefile
221         $(CXX) -c $(CXXFLAGS) $(srcdir)/gc_cpp.cc
222
223 test_cpp$(EXE_SUFFIX): $(srcdir)/test_cpp.cc $(srcdir)/gc_cpp.h gc_cpp.o $(srcdir)/gc.h \
224 base_lib $(UTILS)
225         rm -f test_cpp test_cpp$(EXE_SUFFIX)
226         ./if_mach HP_PA "" $(CXX) $(CXXFLAGS) -o test_cpp $(srcdir)/test_cpp.cc gc_cpp.o gc.a -ldld
227         ./if_not_there test_cpp$(EXE_SUFFIX) $(CXXLD) $(CXXFLAGS) -o test_cpp$(EXE_SUFFIX) $(srcdir)/test_cpp.cc gc_cpp.o gc.a
228         rm -f test_cpp
229
230 c++: gc_cpp.o $(srcdir)/gc_cpp.h test_cpp$(EXE_SUFFIX)
231         rm -f on_sparc_sunos5_4
232         ./if_mach SPARC SUNOS5 touch on_sparc_sunos5_4
233         ./if_mach SPARC SUNOS5 $(AR) rus gc.a gc_cpp.o
234         ./if_not_there on_sparc_sunos5_4 $(AR) ru gc.a gc_cpp.o
235         -./if_not_there on_sparc_sunos5_4 $(RANLIB) gc.a
236         ./test_cpp$(EXE_SUFFIX) 1
237         echo > c++
238
239 dyn_load_sunos53.o: dyn_load.c
240         $(CC) $(CFLAGS) -DSUNOS53_SHARED_LIB -c $(srcdir)/dyn_load.c -o $@
241
242 # SunOS5 shared library version of the collector
243 sunos5gc.so: $(OBJS) dyn_load_sunos53.o
244         $(CC) -G -o sunos5gc.so $(OBJS) dyn_load_sunos53.o -ldl
245         ln sunos5gc.so libgc.so
246
247 # Alpha/OSF shared library version of the collector
248 libalphagc.so: $(OBJS)
249         ld -shared -o libalphagc.so $(OBJS) dyn_load.o -lc
250         ln libalphagc.so libgc.so
251
252 # IRIX shared library version of the collector
253 libirixgc.so: $(OBJS) dyn_load.o
254         ld -shared $(ABI_FLAG) -o libirixgc.so $(OBJS) dyn_load.o -lc
255         ln libirixgc.so libgc.so
256
257 # Linux shared library version of the collector
258 liblinuxgc.so: $(OBJS) dyn_load.o
259         gcc -shared -o liblinuxgc.so $(OBJS) dyn_load.o -lo
260         ln liblinuxgc.so libgc.so
261
262 mach_dep.o: $(srcdir)/mach_dep.c $(srcdir)/mips_sgi_mach_dep.s $(srcdir)/mips_ultrix_mach_dep.s $(srcdir)/rs6000_mach_dep.s $(UTILS)
263         rm -f mach_dep.o
264         ./if_mach MIPS IRIX5 $(AS) -o mach_dep.o $(srcdir)/mips_sgi_mach_dep.s
265         ./if_mach MIPS RISCOS $(AS) -o mach_dep.o $(srcdir)/mips_ultrix_mach_dep.s
266         ./if_mach MIPS ULTRIX $(AS) -o mach_dep.o $(srcdir)/mips_ultrix_mach_dep.s
267         ./if_mach RS6000 "" $(AS) -o mach_dep.o $(srcdir)/rs6000_mach_dep.s
268         ./if_mach ALPHA "" $(AS) -o mach_dep.o $(srcdir)/alpha_mach_dep.s
269         ./if_mach SPARC SUNOS5 $(AS) -o mach_dep.o $(srcdir)/sparc_mach_dep.s
270         ./if_mach SPARC SUNOS4 $(AS) -o mach_dep.o $(srcdir)/sparc_sunos4_mach_dep.s
271         ./if_not_there mach_dep.o $(CC) -c $(SPECIALCFLAGS) $(srcdir)/mach_dep.c
272
273 mark_rts.o: $(srcdir)/mark_rts.c if_mach if_not_there $(UTILS)
274         rm -f mark_rts.o
275         -./if_mach ALPHA OSF1 $(CC) -c $(CFLAGS) -Wo,-notail $(srcdir)/mark_rts.c
276         ./if_not_there mark_rts.o $(CC) -c $(CFLAGS) $(srcdir)/mark_rts.c
277 #       Work-around for DEC optimizer tail recursion elimination bug.
278 #  The ALPHA-specific line should be removed if gcc is used.
279
280 alloc.o: version.h
281
282 cord/cordbscs.o: $(srcdir)/cord/cordbscs.c $(CORD_INCLUDE_FILES)
283         $(CC) $(CFLAGS) -c -I$(srcdir) $(srcdir)/cord/cordbscs.c
284         mv cordbscs.o cord/cordbscs.o
285 #  not all compilers understand -o filename
286
287 cord/cordxtra.o: $(srcdir)/cord/cordxtra.c $(CORD_INCLUDE_FILES)
288         $(CC) $(CFLAGS) -c -I$(srcdir) $(srcdir)/cord/cordxtra.c
289         mv cordxtra.o cord/cordxtra.o
290
291 cord/cordprnt.o: $(srcdir)/cord/cordprnt.c $(CORD_INCLUDE_FILES)
292         $(CC) $(CFLAGS) -c -I$(srcdir) $(srcdir)/cord/cordprnt.c
293         mv cordprnt.o cord/cordprnt.o
294
295 cord/cordtest$(EXE_SUFFIX): $(srcdir)/cord/cordtest.c $(CORD_OBJS) gc.a $(UTILS) /tmp
296         rm -f cord/cordtest$(EXE_SUFFIX)
297         ./if_mach SPARC DRSNX $(CC) $(CFLAGS) -o cord/cordtest$(EXE_SUFFIX) $(srcdir)/cord/cordtest.c $(CORD_OBJS) gc.a -lucb
298         ./if_mach HP_PA "" $(CC) $(CFLAGS) -o cord/cordtest$(EXE_SUFFIX) $(srcdir)/cord/cordtest.c $(CORD_OBJS) gc.a -ldld
299         ./if_not_there cord/cordtest$(EXE_SUFFIX) $(CC) $(CFLAGS) -o cord/cordtest $(srcdir)/cord/cordtest.c $(CORD_OBJS) gc.a
300         rm -f cord/cordtest cordtest
301         -mv cordtest$(EXE_SUFFIX) cord/
302
303 /tmp: $(UTILS)
304         ./if_not_there /tmp mkdir /tmp
305
306 cord/de$(EXE_SUFFIX): $(srcdir)/cord/de.c cord/cordbscs.o cord/cordxtra.o gc.a $(UTILS)
307         rm -f cord/de cord/de$(EXE_SUFFIX)
308         ./if_mach SPARC DRSNX $(CC) $(CFLAGS) -o cord/de $(srcdir)/cord/de.c cord/cordbscs.o cord/cordxtra.o gc.a $(CURSES) -lucb `./threadlibs`
309         ./if_mach HP_PA "" $(CC) $(CFLAGS) -o cord/de $(srcdir)/cord/de.c cord/cordbscs.o cord/cordxtra.o gc.a $(CURSES) -ldld
310         ./if_mach RS6000 "" $(CC) $(CFLAGS) -o cord/de $(srcdir)/cord/de.c cord/cordbscs.o cord/cordxtra.o gc.a -lcurses
311         ./if_mach I386 LINUX $(CC) $(CFLAGS) -o cord/de $(srcdir)/cord/de.c cord/cordbscs.o cord/cordxtra.o gc.a -lcurses `./threadlibs`
312         ./if_mach ALPHA LINUX $(CC) $(CFLAGS) -o cord/de $(srcdir)/cord/de.c cord/cordbscs.o cord/cordxtra.o gc.a -lcurses
313         ./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)
314
315 if_mach$(EXE_SUFFIX): $(srcdir)/if_mach.c $(srcdir)/gcconfig.h
316         rm -f if_mach if_mach$(EXE_SUFFIX)
317         $(CC) $(CFLAGS) -o if_mach $(srcdir)/if_mach.c
318         rm -f if_mach
319
320 threadlibs$(EXE_SUFFIX): $(srcdir)/threadlibs.c $(srcdir)/gcconfig.h Makefile
321         rm -f threadlibs threadlibs$(EXE_SUFFIX)
322         $(CC) $(CFLAGS) -o threadlibs $(srcdir)/threadlibs.c
323         rm -f threadlibs
324
325 if_not_there$(EXE_SUFFIX): $(srcdir)/if_not_there.c
326         rm -f if_not_there if_not_there$(EXE_SUFFIX)
327         $(CC) $(CFLAGS) -o if_not_there $(srcdir)/if_not_there.c
328         rm -f if_not_there
329
330 # Clean removes *.o several times,
331 # because as the first one doesn't seem to get them all!
332 clean: 
333         rm -f gc.a *.o
334         rm -f *.o
335         rm -f *.o
336         rm -f cord/*.o
337         rm -f gctest gctest_dyn_link test_cpp
338         rm -f setjmp_test  mon.out gmon.out a.out core if_not_there if_mach
339         rm -f threadlibs $(CORD_OBJS) cordtest cord/cordtest de cord/de
340         rm -f gctest$(EXE_SUFFIX) gctest_dyn_link$(EXE_SUFFIX) test_cpp$(EXE_SUFFIX)
341         rm -f setjmp_test$(EXE_SUFFIX) if_not_there$(EXE_SUFFIX) if_mach$(EXE_SUFFIX)
342         rm -f threadlibs$(EXE_SUFFIX) cord/cordtest$(EXE_SUFFIX)
343         -rm -f *~
344
345 gctest$(EXE_SUFFIX): test.o gc.a if_mach$(EXE_SUFFIX) if_not_there$(EXE_SUFFIX)
346         rm -f gctest gctest$(EXE_SUFFIX)
347         ./if_mach SPARC DRSNX $(CC) $(CFLAGS) -o gctest  test.o gc.a -lucb
348         ./if_mach HP_PA "" $(CC) $(CFLAGS) -o gctest  test.o gc.a -ldld
349         ./if_not_there gctest$(EXE_SUFFIX) $(CC) $(CFLAGS) -o gctest$(EXE_SUFFIX) test.o gc.a
350         rm -f gctest
351
352 # If an optimized setjmp_test generates a segmentation fault,
353 # odds are your compiler is broken.  Gctest may still work.
354 # Try compiling setjmp_t.c unoptimized.
355 setjmp_test$(EXE_SUFFIX): $(srcdir)/setjmp_t.c $(srcdir)/gc.h \
356                 if_mach$(EXE_SUFFIX) if_not_there$(EXE_SUFFIX)
357         rm -f setjmp_test$(EXE_SUFFIX)
358         $(CC) $(CFLAGS) -o setjmp_test $(srcdir)/setjmp_t.c
359         rm -f setjmp_test
360
361 test:  KandRtest cord/cordtest$(EXE_SUFFIX)
362         ./cord/cordtest$(EXE_SUFFIX)
363
364 # Those tests that work even with a K&R C compiler:
365 KandRtest: setjmp_test$(EXE_SUFFIX) gctest$(EXE_SUFFIX)
366         ./setjmp_test$(EXE_SUFFIX)
367         ./gctest$(EXE_SUFFIX)
368
369 add_gc_prefix$(EXE_SUFFIX): add_gc_prefix.c
370         $(CC) -o add_gc_prefix$(EXE_SUFFIX) $(srcdir)/add_gc_prefix.c
371         rm -f add_gc_prefix
372
373 gc.tar: $(SRCS) $(OTHER_FILES) add_gc_prefix
374         ./add_gc_prefix$(EXE_SUFFIX) $(SRCS) $(OTHER_FILES) > /tmp/gc.tar-files
375         (cd $(srcdir)/.. ; tar cvfh - `cat /tmp/gc.tar-files`) > gc.tar
376
377 pc_gc.tar: $(SRCS) $(OTHER_FILES)
378         tar cvfX pc_gc.tar pc_excludes $(SRCS) $(OTHER_FILES)
379
380 floppy: pc_gc.tar
381         -mmd a:/cord
382         -mmd a:/cord/private
383         -mmd a:/include
384         -mmd a:/include/private
385         mkdir /tmp/pc_gc
386         cat pc_gc.tar | (cd /tmp/pc_gc; tar xvf -)
387         -mcopy -tmn /tmp/pc_gc/* a:
388         -mcopy -tmn /tmp/pc_gc/cord/* a:/cord
389         -mcopy -mn /tmp/pc_gc/cord/de_win.ICO a:/cord
390         -mcopy -tmn /tmp/pc_gc/cord/private/* a:/cord/private
391         -mcopy -tmn /tmp/pc_gc/include/* a:/include
392         -mcopy -tmn /tmp/pc_gc/include/private/* a:/include/private
393         rm -r /tmp/pc_gc
394
395 gc.tar.Z: gc.tar
396         compress gc.tar
397
398 gc.tar.gz: gc.tar
399         gzip gc.tar
400
401 lint: $(CSRCS) test.c
402         lint -DLINT $(CSRCS) test.c | egrep -v "possible pointer alignment problem|abort|exit|sbrk|mprotect|syscall"
403
404 # BTL: added to test shared library version of collector.
405 # Currently works only under SunOS5.  Requires GC_INIT call from statically
406 # loaded client code.
407 ABSDIR = `pwd`
408 gctest_dyn_link: test.o libgc.so
409         $(CC) -L$(ABSDIR) -R$(ABSDIR) -o gctest_dyn_link test.o -lgc -ldl -lthread
410
411 gctest_irix_dyn_link: test.o libirixgc.so
412         $(CC) -L$(ABSDIR) -o gctest_irix_dyn_link test.o -lirixgc
413
414 test_dll.o: test.c libgc_globals.h
415         $(CC) $(CFLAGS) -DGC_USE_DLL -c test.c -o test_dll.o
416
417 test_dll: test_dll.o libgc_dll.a libgc.dll
418         $(CC) test_dll.o -L$(ABSDIR) -lgc_dll -o test_dll
419
420 SYM_PREFIX-libgc=GC
421
422 # Uncomment the following line to build a GNU win32 DLL
423 # include Makefile.DLLs
424
425 reserved_namespace: $(SRCS)
426         for file in $(SRCS) test.c test_cpp.cc; do \
427                 sed s/GC_/_GC_/g < $$file > tmp; \
428                 cp tmp $$file; \
429                 done
430
431 user_namespace: $(SRCS)
432         for file in $(SRCS) test.c test_cpp.cc; do \
433                 sed s/_GC_/GC_/g < $$file > tmp; \
434                 cp tmp $$file; \
435                 done
436