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