Makefile.direct raw

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