Makefile.dist 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681
  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. AS_ABI_FLAG=$(ABI_FLAG)
  18. # ABI flag for assembler. On HP/UX this is +A64 for 64 bit
  19. # executables.
  20. CC=cc $(ABI_FLAG)
  21. CXX=g++ $(ABI_FLAG)
  22. AS=as $(AS_ABI_FLAG)
  23. # The above doesn't work with gas, which doesn't run cpp.
  24. # Define AS as `gcc -c -x assembler-with-cpp' instead.
  25. # Redefining srcdir allows object code for the nonPCR version of the collector
  26. # to be generated in different directories.
  27. srcdir= .
  28. VPATH= $(srcdir)
  29. CFLAGS= -O -I$(srcdir)/include -DATOMIC_UNCOLLECTABLE -DNO_SIGNALS -DNO_EXECUTE_PERMISSION -DSILENT -DALL_INTERIOR_POINTERS
  30. # To build the parallel collector on Linux, add to the above:
  31. # -DGC_LINUX_THREADS -DPARALLEL_MARK -DTHREAD_LOCAL_ALLOC
  32. # To build the parallel collector in a static library on HP/UX,
  33. # add to the above:
  34. # -DGC_HPUX_THREADS -DPARALLEL_MARK -DTHREAD_LOCAL_ALLOC -D_POSIX_C_SOURCE=199506L
  35. # To build the thread-safe collector on Tru64, add to the above:
  36. # -pthread -DGC_OSF1_THREADS
  37. # HOSTCC and HOSTCFLAGS are used to build executables that will be run as
  38. # part of the build process, i.e. on the build machine. These will usually
  39. # be the same as CC and CFLAGS, except in a cross-compilation environment.
  40. # Note that HOSTCFLAGS should include any -D flags that affect thread support.
  41. HOSTCC=$(CC)
  42. HOSTCFLAGS=$(CFLAGS)
  43. # For dynamic library builds, it may be necessary to add flags to generate
  44. # PIC code, e.g. -fPIC on Linux.
  45. # Setjmp_test may yield overly optimistic results when compiled
  46. # without optimization.
  47. # These define arguments influence the collector configuration:
  48. # -DSILENT disables statistics printing, and improves performance.
  49. # -DFIND_LEAK causes GC_find_leak to be initially set.
  50. # This causes the collector to assume that all inaccessible
  51. # objects should have been explicitly deallocated, and reports exceptions.
  52. # Finalization and the test program are not usable in this mode.
  53. # -DGC_SOLARIS_THREADS enables support for Solaris (thr_) threads.
  54. # (Clients should also define GC_SOLARIS_THREADS and then include
  55. # gc.h before performing thr_ or dl* or GC_ operations.)
  56. # Must also define -D_REENTRANT.
  57. # -DGC_SOLARIS_PTHREADS enables support for Solaris pthreads.
  58. # (Internally this define GC_SOLARIS_THREADS as well.)
  59. # -DGC_IRIX_THREADS enables support for Irix pthreads. See README.irix.
  60. # -DGC_HPUX_THREADS enables support for HP/UX 11 pthreads.
  61. # Also requires -D_REENTRANT or -D_POSIX_C_SOURCE=199506L. See README.hp.
  62. # -DGC_LINUX_THREADS enables support for Xavier Leroy's Linux threads.
  63. # see README.linux. -D_REENTRANT may also be required.
  64. # -DGC_OSF1_THREADS enables support for Tru64 pthreads. Untested.
  65. # -DGC_FREEBSD_THREADS enables support for FreeBSD pthreads. Untested.
  66. # Appeared to run into some underlying thread problems.
  67. # -DGC_DARWIN_THREADS enables support for Mac OS X pthreads. Untested.
  68. # -DGC_DGUX386_THREADS enables support for DB/UX on I386 threads.
  69. # See README.DGUX386.
  70. # -DGC_WIN32_THREADS enables support for win32 threads. That makes sense
  71. # for this Makefile only under Cygwin.
  72. # -DGC_THREADS should set the appropriate one of the above macros.
  73. # It assumes pthreads for Solaris.
  74. # -DALL_INTERIOR_POINTERS allows all pointers to the interior
  75. # of objects to be recognized. (See gc_priv.h for consequences.)
  76. # Alternatively, GC_all_interior_pointers can be set at process
  77. # initialization time.
  78. # -DSMALL_CONFIG tries to tune the collector for small heap sizes,
  79. # usually causing it to use less space in such situations.
  80. # Incremental collection no longer works in this case.
  81. # -DLARGE_CONFIG tunes the collector for unusually large heaps.
  82. # Necessary for heaps larger than about 500 MB on most machines.
  83. # Recommended for heaps larger than about 64 MB.
  84. # -DDONT_ADD_BYTE_AT_END is meaningful only with -DALL_INTERIOR_POINTERS or
  85. # GC_all_interior_pointers = 1. Normally -DALL_INTERIOR_POINTERS
  86. # causes all objects to be padded so that pointers just past the end of
  87. # an object can be recognized. This can be expensive. (The padding
  88. # is normally more than one byte due to alignment constraints.)
  89. # -DDONT_ADD_BYTE_AT_END disables the padding.
  90. # -DNO_SIGNALS does not disable signals during critical parts of
  91. # the GC process. This is no less correct than many malloc
  92. # implementations, and it sometimes has a significant performance
  93. # impact. However, it is dangerous for many not-quite-ANSI C
  94. # programs that call things like printf in asynchronous signal handlers.
  95. # This is on by default. Turning it off has not been extensively tested with
  96. # compilers that reorder stores. It should have been.
  97. # -DNO_EXECUTE_PERMISSION may cause some or all of the heap to not
  98. # have execute permission, i.e. it may be impossible to execute
  99. # code from the heap. Currently this only affects the incremental
  100. # collector on UNIX machines. It may greatly improve its performance,
  101. # since this may avoid some expensive cache synchronization.
  102. # -DGC_NO_OPERATOR_NEW_ARRAY declares that the C++ compiler does not support
  103. # the new syntax "operator new[]" for allocating and deleting arrays.
  104. # See gc_cpp.h for details. No effect on the C part of the collector.
  105. # This is defined implicitly in a few environments. Must also be defined
  106. # by clients that use gc_cpp.h.
  107. # -DREDIRECT_MALLOC=X causes malloc to be defined as alias for X.
  108. # Unless the following macros are defined, realloc is also redirected
  109. # to GC_realloc, and free is redirected to GC_free.
  110. # Calloc and strdup are redefined in terms of the new malloc. X should
  111. # be either GC_malloc or GC_malloc_uncollectable, or
  112. # GC_debug_malloc_replacement. (The latter invokes GC_debug_malloc
  113. # with dummy source location information, but still results in
  114. # properly remembered call stacks on Linux/X86 and Solaris/SPARC.
  115. # It requires that the following two macros also be used.)
  116. # The former is occasionally useful for working around leaks in code
  117. # you don't want to (or can't) look at. It may not work for
  118. # existing code, but it often does. Neither works on all platforms,
  119. # since some ports use malloc or calloc to obtain system memory.
  120. # (Probably works for UNIX, and win32.) If you build with DBG_HDRS_ALL,
  121. # you should only use GC_debug_malloc_replacement as a malloc
  122. # replacement.
  123. # -DREDIRECT_REALLOC=X causes GC_realloc to be redirected to X.
  124. # The canonical use is -DREDIRECT_REALLOC=GC_debug_realloc_replacement,
  125. # together with -DREDIRECT_MALLOC=GC_debug_malloc_replacement to
  126. # generate leak reports with call stacks for both malloc and realloc.
  127. # This also requires the following:
  128. # -DREDIRECT_FREE=X causes free to be redirected to X. The
  129. # canonical use is -DREDIRECT_FREE=GC_debug_free.
  130. # -DIGNORE_FREE turns calls to free into a noop. Only useful with
  131. # -DREDIRECT_MALLOC.
  132. # -DNO_DEBUGGING removes GC_dump and the debugging routines it calls.
  133. # Reduces code size slightly at the expense of debuggability.
  134. # -DJAVA_FINALIZATION makes it somewhat safer to finalize objects out of
  135. # order by specifying a nonstandard finalization mark procedure (see
  136. # finalize.c). Objects reachable from finalizable objects will be marked
  137. # in a sepearte postpass, and hence their memory won't be reclaimed.
  138. # Not recommended unless you are implementing a language that specifies
  139. # these semantics. Since 5.0, determines only only the initial value
  140. # of GC_java_finalization variable.
  141. # -DFINALIZE_ON_DEMAND causes finalizers to be run only in response
  142. # to explicit GC_invoke_finalizers() calls.
  143. # In 5.0 this became runtime adjustable, and this only determines the
  144. # initial value of GC_finalize_on_demand.
  145. # -DATOMIC_UNCOLLECTABLE includes code for GC_malloc_atomic_uncollectable.
  146. # This is useful if either the vendor malloc implementation is poor,
  147. # or if REDIRECT_MALLOC is used.
  148. # -DHBLKSIZE=ddd, where ddd is a power of 2 between 512 and 16384, explicitly
  149. # sets the heap block size. Each heap block is devoted to a single size and
  150. # kind of object. For the incremental collector it makes sense to match
  151. # the most likely page size. Otherwise large values result in more
  152. # fragmentation, but generally better performance for large heaps.
  153. # -DUSE_MMAP use MMAP instead of sbrk to get new memory.
  154. # Works for Solaris and Irix.
  155. # -DUSE_MUNMAP causes memory to be returned to the OS under the right
  156. # circumstances. This currently disables VM-based incremental collection.
  157. # This is currently experimental, and works only under some Unix,
  158. # Linux and Windows versions.
  159. # -DMMAP_STACKS (for Solaris threads) Use mmap from /dev/zero rather than
  160. # GC_scratch_alloc() to get stack memory.
  161. # -DPRINT_BLACK_LIST Whenever a black list entry is added, i.e. whenever
  162. # the garbage collector detects a value that looks almost, but not quite,
  163. # like a pointer, print both the address containing the value, and the
  164. # value of the near-bogus-pointer. Can be used to identifiy regions of
  165. # memory that are likely to contribute misidentified pointers.
  166. # -DKEEP_BACK_PTRS Add code to save back pointers in debugging headers
  167. # for objects allocated with the debugging allocator. If all objects
  168. # through GC_MALLOC with GC_DEBUG defined, this allows the client
  169. # to determine how particular or randomly chosen objects are reachable
  170. # for debugging/profiling purposes. The gc_backptr.h interface is
  171. # implemented only if this is defined.
  172. # -DGC_ASSERTIONS Enable some internal GC assertion checking. Currently
  173. # this facility is only used in a few places. It is intended primarily
  174. # for debugging of the garbage collector itself, but could also
  175. # -DDBG_HDRS_ALL Make sure that all objects have debug headers. Increases
  176. # the reliability (from 99.9999% to 100% mod. bugs) of some of the debugging
  177. # code (especially KEEP_BACK_PTRS). Makes -DSHORT_DBG_HDRS possible.
  178. # Assumes that all client allocation is done through debugging
  179. # allocators.
  180. # -DSHORT_DBG_HDRS Assume that all objects have debug headers. Shorten
  181. # the headers to minimize object size, at the expense of checking for
  182. # writes past the end of an object. This is intended for environments
  183. # in which most client code is written in a "safe" language, such as
  184. # Scheme or Java. Assumes that all client allocation is done using
  185. # the GC_debug_ functions, or through the macros that expand to these,
  186. # or by redirecting malloc to GC_debug_malloc_replacement.
  187. # (Also eliminates the field for the requested object size.)
  188. # occasionally be useful for debugging of client code. Slows down the
  189. # collector somewhat, but not drastically.
  190. # -DSAVE_CALL_COUNT=<n> Set the number of call frames saved with objects
  191. # allocated through the debugging interface. Affects the amount of
  192. # information generated in leak reports. Only matters on platforms
  193. # on which we can quickly generate call stacks, currently Linux/(X86 & SPARC)
  194. # and Solaris/SPARC and platforms that provide execinfo.h.
  195. # Default is zero. On X86, client
  196. # code should NOT be compiled with -fomit-frame-pointer.
  197. # -DSAVE_CALL_NARGS=<n> Set the number of functions arguments to be
  198. # saved with each call frame. Default is zero. Ignored if we
  199. # don't know how to retrieve arguments on the platform.
  200. # -DCHECKSUMS reports on erroneously clear dirty bits, and unexpectedly
  201. # altered stubborn objects, at substantial performance cost.
  202. # Use only for debugging of the incremental collector.
  203. # -DGC_GCJ_SUPPORT includes support for gcj (and possibly other systems
  204. # that include a pointer to a type descriptor in each allocated object).
  205. # Building this way requires an ANSI C compiler.
  206. # -DUSE_I686_PREFETCH causes the collector to issue Pentium III style
  207. # prefetch instructions. No effect except on X86 Linux platforms.
  208. # Assumes a very recent gcc-compatible compiler and assembler.
  209. # (Gas prefetcht0 support was added around May 1999.)
  210. # Empirically the code appears to still run correctly on Pentium II
  211. # processors, though with no performance benefit. May not run on other
  212. # X86 processors? In some cases this improves performance by
  213. # 15% or so.
  214. # -DUSE_3DNOW_PREFETCH causes the collector to issue AMD 3DNow style
  215. # prefetch instructions. Same restrictions as USE_I686_PREFETCH.
  216. # Minimally tested. Didn't appear to be an obvious win on a K6-2/500.
  217. # -DUSE_PPC_PREFETCH causes the collector to issue PowerPC style
  218. # prefetch instructions. No effect except on PowerPC OS X platforms.
  219. # Performance impact untested.
  220. # -DGC_USE_LD_WRAP in combination with the old flags listed in README.linux
  221. # causes the collector some system and pthread calls in a more transparent
  222. # fashion than the usual macro-based approach. Requires GNU ld, and
  223. # currently probably works only with Linux.
  224. # -DTHREAD_LOCAL_ALLOC defines GC_local_malloc(), GC_local_malloc_atomic()
  225. # and GC_local_gcj_malloc(). Needed for gc_gcj.h interface. These allocate
  226. # in a way that usually does not involve acquisition of a global lock.
  227. # Currently requires -DGC_LINUX_THREADS, but should be easy to port to
  228. # other pthreads environments. Recommended for multiprocessors.
  229. # -DUSE_COMPILER_TLS causes thread local allocation to use compiler-supported
  230. # "__thread" thread-local variables. This is the default in HP/UX. It
  231. # may help performance on recent Linux installations. (It failed for
  232. # me on RedHat 8, but appears to work on RedHat 9.)
  233. # -DPARALLEL_MARK allows the marker to run in multiple threads. Recommended
  234. # for multiprocessors. Currently requires Linux on X86 or IA64, though
  235. # support for other Posix platforms should be fairly easy to add,
  236. # if the thread implementation is otherwise supported.
  237. # -DNO_GETENV prevents the collector from looking at environment variables.
  238. # These may otherwise alter its configuration, or turn off GC altogether.
  239. # I don't know of a reason to disable this, except possibly if the
  240. # resulting process runs as a privileged user?
  241. # -DUSE_GLOBAL_ALLOC. Win32 only. Use GlobalAlloc instead of
  242. # VirtualAlloc to allocate the heap. May be needed to work around
  243. # a Windows NT/2000 issue. Incompatible with USE_MUNMAP.
  244. # See README.win32 for details.
  245. # -DMAKE_BACK_GRAPH. Enable GC_PRINT_BACK_HEIGHT environment variable.
  246. # See README.environment for details. Experimental. Limited platform
  247. # support. Implies DBG_HDRS_ALL. All allocation should be done using
  248. # the debug interface.
  249. # -DSTUBBORN_ALLOC allows allocation of "hard to change" objects, and thus
  250. # makes incremental collection easier. Was enabled by default until 6.0.
  251. # Rarely used, to my knowledge.
  252. # -DHANDLE_FORK attempts to make GC_malloc() work in a child process fork()ed
  253. # from a multithreaded parent. Currently only supported by pthread_support.c.
  254. # (Similar code should work on Solaris or Irix, but it hasn't been tried.)
  255. # -DTEST_WITH_SYSTEM_MALLOC causes gctest to allocate (and leak) large chunks
  256. # of memory with the standard system malloc. This will cause the root
  257. # set and collected heap to grow significantly if malloced memory is
  258. # somehow getting traced by the collector. This has no impact on the
  259. # generated library; it only affects the test.
  260. # -DPOINTER_MASK=0x... causes candidate pointers to be ANDed with the
  261. # given mask before being considered. If either this or the following
  262. # macro is defined, it will be assumed that all pointers stored in
  263. # the heap need to be processed this way. Stack and register pointers
  264. # will be considered both with and without processing.
  265. # These macros are normally needed only to support systems that use
  266. # high-order pointer tags. EXPERIMENTAL.
  267. # -DPOINTER_SHIFT=n causes the collector to left shift candidate pointers
  268. # by the indicated amount before trying to interpret them. Applied
  269. # after POINTER_MASK. EXPERIMENTAL. See also the preceding macro.
  270. #
  271. CXXFLAGS= $(CFLAGS)
  272. AR= ar
  273. RANLIB= ranlib
  274. 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 aix_irix_threads.o pthread_support.o pthread_stop_world.o darwin_stop_world.o typd_mlc.o ptr_chck.o mallocx.o solaris_pthreads.o gcj_mlc.o specific.o gc_dlopen.o backgraph.o win32_threads.o
  275. 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 aix_irix_threads.c pthread_support.c pthread_stop_world.c darwin_stop_world.c typd_mlc.c ptr_chck.c mallocx.c solaris_pthreads.c gcj_mlc.c specific.c gc_dlopen.c backgraph.c win32_threads.c
  276. 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
  277. CORD_OBJS= cord/cordbscs.o cord/cordxtra.o cord/cordprnt.o
  278. SRCS= $(CSRCS) mips_sgi_mach_dep.s rs6000_mach_dep.s alpha_mach_dep.S \
  279. sparc_mach_dep.S include/gc.h include/gc_typed.h \
  280. include/private/gc_hdrs.h include/private/gc_priv.h \
  281. include/private/gcconfig.h include/private/gc_pmark.h \
  282. include/gc_inl.h include/gc_inline.h include/gc_mark.h \
  283. threadlibs.c if_mach.c if_not_there.c gc_cpp.cc include/gc_cpp.h \
  284. gcname.c include/weakpointer.h include/private/gc_locks.h \
  285. gcc_support.c mips_ultrix_mach_dep.s include/gc_alloc.h \
  286. include/new_gc_alloc.h include/gc_allocator.h \
  287. include/javaxfc.h sparc_sunos4_mach_dep.s sparc_netbsd_mach_dep.s \
  288. include/private/solaris_threads.h include/gc_backptr.h \
  289. hpux_test_and_clear.s include/gc_gcj.h \
  290. include/gc_local_alloc.h include/private/dbg_mlc.h \
  291. include/private/specific.h powerpc_darwin_mach_dep.s \
  292. include/leak_detector.h include/gc_amiga_redirects.h \
  293. include/gc_pthread_redirects.h ia64_save_regs_in_stack.s \
  294. include/gc_config_macros.h include/private/pthread_support.h \
  295. include/private/pthread_stop_world.h include/private/darwin_semaphore.h \
  296. include/private/darwin_stop_world.h $(CORD_SRCS)
  297. DOC_FILES= README.QUICK doc/README.Mac doc/README.MacOSX doc/README.OS2 \
  298. doc/README.amiga doc/README.cords doc/debugging.html \
  299. doc/README.dj doc/README.hp doc/README.linux doc/README.rs6000 \
  300. doc/README.sgi doc/README.solaris2 doc/README.uts \
  301. doc/README.win32 doc/barrett_diagram doc/README \
  302. doc/README.contributors doc/README.changes doc/gc.man \
  303. doc/README.environment doc/tree.html doc/gcdescr.html \
  304. doc/README.autoconf doc/README.macros doc/README.ews4800 \
  305. doc/README.DGUX386 doc/README.arm.cross doc/leak.html \
  306. doc/scale.html doc/gcinterface.html doc/README.darwin \
  307. doc/simple_example.html
  308. TESTS= tests/test.c tests/test_cpp.cc tests/trace_test.c \
  309. tests/leak_test.c tests/thread_leak_test.c tests/middle.c
  310. GNU_BUILD_FILES= configure.in Makefile.am configure acinclude.m4 \
  311. libtool.m4 install-sh configure.host Makefile.in \
  312. aclocal.m4 config.sub config.guess \
  313. include/Makefile.am include/Makefile.in \
  314. doc/Makefile.am doc/Makefile.in \
  315. ltmain.sh mkinstalldirs depcomp missing
  316. OTHER_MAKEFILES= OS2_MAKEFILE NT_MAKEFILE NT_THREADS_MAKEFILE gc.mak \
  317. BCC_MAKEFILE EMX_MAKEFILE WCC_MAKEFILE Makefile.dj \
  318. PCR-Makefile SMakefile.amiga Makefile.DLLs \
  319. digimars.mak Makefile.direct NT_STATIC_THREADS_MAKEFILE
  320. # Makefile and Makefile.direct are copies of each other.
  321. OTHER_FILES= Makefile setjmp_t.c callprocs pc_excludes \
  322. MacProjects.sit.hqx MacOS.c \
  323. Mac_files/datastart.c Mac_files/dataend.c \
  324. Mac_files/MacOS_config.h Mac_files/MacOS_Test_config.h \
  325. add_gc_prefix.c gc_cpp.cpp \
  326. version.h AmigaOS.c \
  327. $(TESTS) $(GNU_BUILD_FILES) $(OTHER_MAKEFILES)
  328. CORD_INCLUDE_FILES= $(srcdir)/include/gc.h $(srcdir)/include/cord.h \
  329. $(srcdir)/include/ec.h $(srcdir)/include/private/cord_pos.h
  330. UTILS= if_mach if_not_there threadlibs
  331. # Libraries needed for curses applications. Only needed for de.
  332. CURSES= -lcurses -ltermlib
  333. # The following is irrelevant on most systems. But a few
  334. # versions of make otherwise fork the shell specified in
  335. # the SHELL environment variable.
  336. SHELL= /bin/sh
  337. SPECIALCFLAGS = -I$(srcdir)/include
  338. # Alternative flags to the C compiler for mach_dep.c.
  339. # Mach_dep.c often doesn't like optimization, and it's
  340. # not time-critical anyway.
  341. # Set SPECIALCFLAGS to -q nodirect_code on Encore.
  342. all: gc.a gctest
  343. LEAKFLAGS=$(CFLAGS) -DFIND_LEAK
  344. BSD-pkg-all: bsd-libgc.a bsd-libleak.a
  345. bsd-libgc.a:
  346. $(MAKE) CFLAGS="$(CFLAGS)" clean c++-t
  347. mv gc.a bsd-libgc.a
  348. bsd-libleak.a:
  349. $(MAKE) -f Makefile.direct CFLAGS="$(LEAKFLAGS)" clean c++-nt
  350. mv gc.a bsd-libleak.a
  351. BSD-pkg-install: BSD-pkg-all
  352. ${CP} bsd-libgc.a libgc.a
  353. ${INSTALL_DATA} libgc.a ${PREFIX}/lib
  354. ${INSTALL_DATA} gc.h gc_cpp.h ${PREFIX}/include
  355. ${INSTALL_MAN} doc/gc.man ${PREFIX}/man/man3/gc.3
  356. pcr: PCR-Makefile include/private/gc_private.h include/private/gc_hdrs.h \
  357. include/private/gc_locks.h include/gc.h include/private/gcconfig.h \
  358. mach_dep.o $(SRCS)
  359. $(MAKE) -f PCR-Makefile depend
  360. $(MAKE) -f PCR-Makefile
  361. $(OBJS) tests/test.o dyn_load.o dyn_load_sunos53.o: \
  362. $(srcdir)/include/private/gc_priv.h \
  363. $(srcdir)/include/private/gc_hdrs.h $(srcdir)/include/private/gc_locks.h \
  364. $(srcdir)/include/gc.h $(srcdir)/include/gc_pthread_redirects.h \
  365. $(srcdir)/include/private/gcconfig.h $(srcdir)/include/gc_typed.h \
  366. $(srcdir)/include/gc_config_macros.h Makefile
  367. # The dependency on Makefile is needed. Changing
  368. # options such as -DSILENT affects the size of GC_arrays,
  369. # invalidating all .o files that rely on gc_priv.h
  370. mark.o typd_mlc.o finalize.o ptr_chck.o: $(srcdir)/include/gc_mark.h $(srcdir)/include/private/gc_pmark.h
  371. specific.o pthread_support.o: $(srcdir)/include/private/specific.h
  372. solaris_threads.o solaris_pthreads.o: $(srcdir)/include/private/solaris_threads.h
  373. dbg_mlc.o gcj_mlc.o: $(srcdir)/include/private/dbg_mlc.h
  374. tests/test.o: tests $(srcdir)/tests/test.c
  375. $(CC) $(CFLAGS) -c $(srcdir)/tests/test.c
  376. mv test.o tests/test.o
  377. tests:
  378. mkdir tests
  379. base_lib gc.a: $(OBJS) dyn_load.o $(UTILS)
  380. echo > base_lib
  381. rm -f dont_ar_1
  382. ./if_mach SPARC SUNOS5 touch dont_ar_1
  383. ./if_mach SPARC SUNOS5 $(AR) rus gc.a $(OBJS) dyn_load.o
  384. ./if_mach M68K AMIGA touch dont_ar_1
  385. ./if_mach M68K AMIGA $(AR) -vrus gc.a $(OBJS) dyn_load.o
  386. ./if_not_there dont_ar_1 $(AR) ru gc.a $(OBJS) dyn_load.o
  387. ./if_not_there dont_ar_1 $(RANLIB) gc.a || cat /dev/null
  388. # ignore ranlib failure; that usually means it doesn't exist, and isn't needed
  389. cords: $(CORD_OBJS) cord/cordtest $(UTILS)
  390. rm -f dont_ar_3
  391. ./if_mach SPARC SUNOS5 touch dont_ar_3
  392. ./if_mach SPARC SUNOS5 $(AR) rus gc.a $(CORD_OBJS)
  393. ./if_mach M68K AMIGA touch dont_ar_3
  394. ./if_mach M68K AMIGA $(AR) -vrus gc.a $(CORD_OBJS)
  395. ./if_not_there dont_ar_3 $(AR) ru gc.a $(CORD_OBJS)
  396. ./if_not_there dont_ar_3 $(RANLIB) gc.a || cat /dev/null
  397. gc_cpp.o: $(srcdir)/gc_cpp.cc $(srcdir)/include/gc_cpp.h $(srcdir)/include/gc.h Makefile
  398. $(CXX) -c $(CXXFLAGS) $(srcdir)/gc_cpp.cc
  399. test_cpp: $(srcdir)/tests/test_cpp.cc $(srcdir)/include/gc_cpp.h gc_cpp.o $(srcdir)/include/gc.h \
  400. base_lib $(UTILS)
  401. rm -f test_cpp
  402. ./if_mach HP_PA HPUX $(CXX) $(CXXFLAGS) -o test_cpp $(srcdir)/tests/test_cpp.cc gc_cpp.o gc.a -ldld `./threadlibs`
  403. ./if_not_there test_cpp $(CXX) $(CXXFLAGS) -o test_cpp $(srcdir)/tests/test_cpp.cc gc_cpp.o gc.a `./threadlibs`
  404. c++-t: c++
  405. ./test_cpp 1
  406. c++-nt: c++
  407. @echo "Use ./test_cpp 1 to test the leak library"
  408. c++: gc_cpp.o $(srcdir)/include/gc_cpp.h test_cpp
  409. rm -f dont_ar_4
  410. ./if_mach SPARC SUNOS5 touch dont_ar_4
  411. ./if_mach SPARC SUNOS5 $(AR) rus gc.a gc_cpp.o
  412. ./if_mach M68K AMIGA touch dont_ar_4
  413. ./if_mach M68K AMIGA $(AR) -vrus gc.a gc_cpp.o
  414. ./if_not_there dont_ar_4 $(AR) ru gc.a gc_cpp.o
  415. ./if_not_there dont_ar_4 $(RANLIB) gc.a || cat /dev/null
  416. ./test_cpp 1
  417. echo > c++
  418. dyn_load_sunos53.o: dyn_load.c
  419. $(CC) $(CFLAGS) -DSUNOS53_SHARED_LIB -c $(srcdir)/dyn_load.c -o $@
  420. # SunOS5 shared library version of the collector
  421. sunos5gc.so: $(OBJS) dyn_load_sunos53.o
  422. $(CC) -G -o sunos5gc.so $(OBJS) dyn_load_sunos53.o -ldl
  423. ln sunos5gc.so libgc.so
  424. # Alpha/OSF shared library version of the collector
  425. libalphagc.so: $(OBJS)
  426. ld -shared -o libalphagc.so $(OBJS) dyn_load.o -lc
  427. ln libalphagc.so libgc.so
  428. # IRIX shared library version of the collector
  429. libirixgc.so: $(OBJS) dyn_load.o
  430. ld -shared $(ABI_FLAG) -o libirixgc.so $(OBJS) dyn_load.o -lc
  431. ln libirixgc.so libgc.so
  432. # Linux shared library version of the collector
  433. liblinuxgc.so: $(OBJS) dyn_load.o
  434. gcc -shared -o liblinuxgc.so $(OBJS) dyn_load.o
  435. ln liblinuxgc.so libgc.so
  436. # Alternative Linux rule. This is preferable, but is likely to break the
  437. # Makefile for some non-linux platforms.
  438. # LIBOBJS= $(patsubst %.o, %.lo, $(OBJS))
  439. #
  440. #.SUFFIXES: .lo $(SUFFIXES)
  441. #
  442. #.c.lo:
  443. # $(CC) $(CFLAGS) $(CPPFLAGS) -fPIC -c $< -o $@
  444. #
  445. # liblinuxgc.so: $(LIBOBJS) dyn_load.lo
  446. # gcc -shared -Wl,-soname=libgc.so.0 -o libgc.so.0 $(LIBOBJS) dyn_load.lo
  447. # touch liblinuxgc.so
  448. mach_dep.o: $(srcdir)/mach_dep.c $(srcdir)/mips_sgi_mach_dep.s \
  449. $(srcdir)/mips_ultrix_mach_dep.s \
  450. $(srcdir)/rs6000_mach_dep.s $(srcdir)/powerpc_darwin_mach_dep.s \
  451. $(srcdir)/sparc_mach_dep.S $(srcdir)/sparc_sunos4_mach_dep.s \
  452. $(srcdir)/ia64_save_regs_in_stack.s \
  453. $(srcdir)/sparc_netbsd_mach_dep.s $(UTILS)
  454. rm -f mach_dep.o
  455. ./if_mach MIPS IRIX5 $(CC) -c -o mach_dep.o $(srcdir)/mips_sgi_mach_dep.s
  456. ./if_mach MIPS RISCOS $(AS) -o mach_dep.o $(srcdir)/mips_ultrix_mach_dep.s
  457. ./if_mach MIPS ULTRIX $(AS) -o mach_dep.o $(srcdir)/mips_ultrix_mach_dep.s
  458. ./if_mach POWERPC DARWIN $(AS) -o mach_dep.o $(srcdir)/powerpc_darwin_mach_dep.s
  459. ./if_mach ALPHA LINUX $(CC) -c -o mach_dep.o $(srcdir)/alpha_mach_dep.S
  460. ./if_mach SPARC SUNOS5 $(CC) -c -o mach_dep.o $(srcdir)/sparc_mach_dep.S
  461. ./if_mach SPARC SUNOS4 $(AS) -o mach_dep.o $(srcdir)/sparc_sunos4_mach_dep.s
  462. ./if_mach SPARC OPENBSD $(AS) -o mach_dep.o $(srcdir)/sparc_sunos4_mach_dep.s
  463. ./if_mach SPARC NETBSD $(AS) -o mach_dep.o $(srcdir)/sparc_netbsd_mach_dep.s
  464. ./if_mach IA64 "" as $(AS_ABI_FLAG) -o ia64_save_regs_in_stack.o $(srcdir)/ia64_save_regs_in_stack.s
  465. ./if_mach IA64 "" $(CC) -c -o mach_dep1.o $(SPECIALCFLAGS) $(srcdir)/mach_dep.c
  466. ./if_mach IA64 "" ld -r -o mach_dep.o mach_dep1.o ia64_save_regs_in_stack.o
  467. ./if_not_there mach_dep.o $(CC) -c $(SPECIALCFLAGS) $(srcdir)/mach_dep.c
  468. mark_rts.o: $(srcdir)/mark_rts.c $(UTILS)
  469. rm -f mark_rts.o
  470. -./if_mach ALPHA OSF1 $(CC) -c $(CFLAGS) -Wo,-notail $(srcdir)/mark_rts.c
  471. ./if_not_there mark_rts.o $(CC) -c $(CFLAGS) $(srcdir)/mark_rts.c
  472. # Work-around for DEC optimizer tail recursion elimination bug.
  473. # The ALPHA-specific line should be removed if gcc is used.
  474. alloc.o: version.h
  475. cord:
  476. mkdir cord
  477. cord/cordbscs.o: cord $(srcdir)/cord/cordbscs.c $(CORD_INCLUDE_FILES)
  478. $(CC) $(CFLAGS) -c -I$(srcdir) $(srcdir)/cord/cordbscs.c
  479. mv cordbscs.o cord/cordbscs.o
  480. # not all compilers understand -o filename
  481. cord/cordxtra.o: cord $(srcdir)/cord/cordxtra.c $(CORD_INCLUDE_FILES)
  482. $(CC) $(CFLAGS) -c -I$(srcdir) $(srcdir)/cord/cordxtra.c
  483. mv cordxtra.o cord/cordxtra.o
  484. cord/cordprnt.o: cord $(srcdir)/cord/cordprnt.c $(CORD_INCLUDE_FILES)
  485. $(CC) $(CFLAGS) -c -I$(srcdir) $(srcdir)/cord/cordprnt.c
  486. mv cordprnt.o cord/cordprnt.o
  487. cord/cordtest: $(srcdir)/cord/cordtest.c $(CORD_OBJS) gc.a $(UTILS)
  488. rm -f cord/cordtest
  489. ./if_mach SPARC DRSNX $(CC) $(CFLAGS) -o cord/cordtest $(srcdir)/cord/cordtest.c $(CORD_OBJS) gc.a -lucb
  490. ./if_mach HP_PA HPUX $(CC) $(CFLAGS) -o cord/cordtest $(srcdir)/cord/cordtest.c $(CORD_OBJS) gc.a -ldld `./threadlibs`
  491. ./if_mach M68K AMIGA $(CC) $(CFLAGS) -UGC_AMIGA_MAKINGLIB -o cord/cordtest $(srcdir)/cord/cordtest.c $(CORD_OBJS) gc.a `./threadlibs`
  492. ./if_not_there cord/cordtest $(CC) $(CFLAGS) -o cord/cordtest $(srcdir)/cord/cordtest.c $(CORD_OBJS) gc.a `./threadlibs`
  493. cord/de: $(srcdir)/cord/de.c cord/cordbscs.o cord/cordxtra.o gc.a $(UTILS)
  494. rm -f cord/de
  495. ./if_mach SPARC DRSNX $(CC) $(CFLAGS) -o cord/de $(srcdir)/cord/de.c cord/cordbscs.o cord/cordxtra.o gc.a $(CURSES) -lucb `./threadlibs`
  496. ./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`
  497. ./if_mach RS6000 "" $(CC) $(CFLAGS) -o cord/de $(srcdir)/cord/de.c cord/cordbscs.o cord/cordxtra.o gc.a -lcurses
  498. ./if_mach POWERPC DARWIN $(CC) $(CFLAGS) -o cord/de $(srcdir)/cord/de.c cord/cordbscs.o cord/cordxtra.o gc.a
  499. ./if_mach I386 LINUX $(CC) $(CFLAGS) -o cord/de $(srcdir)/cord/de.c cord/cordbscs.o cord/cordxtra.o gc.a -lcurses `./threadlibs`
  500. ./if_mach ALPHA LINUX $(CC) $(CFLAGS) -o cord/de $(srcdir)/cord/de.c cord/cordbscs.o cord/cordxtra.o gc.a -lcurses `./threadlibs`
  501. ./if_mach IA64 LINUX $(CC) $(CFLAGS) -o cord/de $(srcdir)/cord/de.c cord/cordbscs.o cord/cordxtra.o gc.a -lcurses `./threadlibs`
  502. ./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
  503. ./if_not_there cord/de $(CC) $(CFLAGS) -o cord/de $(srcdir)/cord/de.c cord/cordbscs.o cord/cordxtra.o gc.a $(CURSES) `./threadlibs`
  504. if_mach: $(srcdir)/if_mach.c $(srcdir)/include/private/gcconfig.h
  505. $(HOSTCC) $(HOSTCFLAGS) -o if_mach $(srcdir)/if_mach.c
  506. threadlibs: $(srcdir)/threadlibs.c $(srcdir)/include/private/gcconfig.h Makefile
  507. $(HOSTCC) $(HOSTCFLAGS) -o threadlibs $(srcdir)/threadlibs.c
  508. if_not_there: $(srcdir)/if_not_there.c
  509. $(HOSTCC) $(HOSTCFLAGS) -o if_not_there $(srcdir)/if_not_there.c
  510. clean:
  511. rm -f gc.a *.o *.exe tests/*.o gctest gctest_dyn_link test_cpp \
  512. setjmp_test mon.out gmon.out a.out core if_not_there if_mach \
  513. threadlibs $(CORD_OBJS) cord/cordtest cord/de
  514. -rm -f *~
  515. gctest: tests/test.o gc.a $(UTILS)
  516. rm -f gctest
  517. ./if_mach SPARC DRSNX $(CC) $(CFLAGS) -o gctest tests/test.o gc.a -lucb
  518. ./if_mach HP_PA HPUX $(CC) $(CFLAGS) -o gctest tests/test.o gc.a -ldld `./threadlibs`
  519. ./if_mach M68K AMIGA $(CC) $(CFLAGS) -UGC_AMIGA_MAKINGLIB -o gctest tests/test.o gc.a `./threadlibs`
  520. ./if_not_there gctest $(CC) $(CFLAGS) -o gctest tests/test.o gc.a `./threadlibs`
  521. # If an optimized setjmp_test generates a segmentation fault,
  522. # odds are your compiler is broken. Gctest may still work.
  523. # Try compiling setjmp_t.c unoptimized.
  524. setjmp_test: $(srcdir)/setjmp_t.c $(srcdir)/include/gc.h $(UTILS)
  525. $(CC) $(CFLAGS) -o setjmp_test $(srcdir)/setjmp_t.c
  526. test: KandRtest cord/cordtest
  527. cord/cordtest
  528. # Those tests that work even with a K&R C compiler:
  529. KandRtest: setjmp_test gctest
  530. ./setjmp_test
  531. ./gctest
  532. add_gc_prefix: $(srcdir)/add_gc_prefix.c $(srcdir)/version.h
  533. $(CC) -o add_gc_prefix $(srcdir)/add_gc_prefix.c
  534. gcname: $(srcdir)/gcname.c $(srcdir)/version.h
  535. $(CC) -o gcname $(srcdir)/gcname.c
  536. gc.tar: $(SRCS) $(DOC_FILES) $(OTHER_FILES) add_gc_prefix gcname
  537. cp Makefile Makefile.old
  538. cp Makefile.direct Makefile
  539. rm -f `./gcname`
  540. ln -s . `./gcname`
  541. ./add_gc_prefix $(SRCS) $(DOC_FILES) $(OTHER_FILES) > /tmp/gc.tar-files
  542. tar cvfh gc.tar `cat /tmp/gc.tar-files`
  543. cp gc.tar `./gcname`.tar
  544. gzip `./gcname`.tar
  545. rm `./gcname`
  546. pc_gc.tar: $(SRCS) $(OTHER_FILES)
  547. tar cvfX pc_gc.tar pc_excludes $(SRCS) $(OTHER_FILES)
  548. floppy: pc_gc.tar
  549. -mmd a:/cord
  550. -mmd a:/cord/private
  551. -mmd a:/include
  552. -mmd a:/include/private
  553. mkdir /tmp/pc_gc
  554. cat pc_gc.tar | (cd /tmp/pc_gc; tar xvf -)
  555. -mcopy -tmn /tmp/pc_gc/* a:
  556. -mcopy -tmn /tmp/pc_gc/cord/* a:/cord
  557. -mcopy -mn /tmp/pc_gc/cord/de_win.ICO a:/cord
  558. -mcopy -tmn /tmp/pc_gc/cord/private/* a:/cord/private
  559. -mcopy -tmn /tmp/pc_gc/include/* a:/include
  560. -mcopy -tmn /tmp/pc_gc/include/private/* a:/include/private
  561. rm -r /tmp/pc_gc
  562. gc.tar.Z: gc.tar
  563. compress gc.tar
  564. gc.tar.gz: gc.tar
  565. gzip gc.tar
  566. lint: $(CSRCS) tests/test.c
  567. lint -DLINT $(CSRCS) tests/test.c | egrep -v "possible pointer alignment problem|abort|exit|sbrk|mprotect|syscall|change in ANSI|improper alignment"
  568. # BTL: added to test shared library version of collector.
  569. # Currently works only under SunOS5. Requires GC_INIT call from statically
  570. # loaded client code.
  571. ABSDIR = `pwd`
  572. gctest_dyn_link: tests/test.o libgc.so
  573. $(CC) -L$(ABSDIR) -R$(ABSDIR) -o gctest_dyn_link tests/test.o -lgc -ldl -lthread
  574. gctest_irix_dyn_link: tests/test.o libirixgc.so
  575. $(CC) -L$(ABSDIR) -o gctest_irix_dyn_link tests/test.o -lirixgc
  576. # The following appear to be dead, especially since libgc_globals.h
  577. # is apparently lost.
  578. test_dll.o: tests/test.c libgc_globals.h
  579. $(CC) $(CFLAGS) -DGC_USE_DLL -c tests/test.c -o test_dll.o
  580. test_dll: test_dll.o libgc_dll.a libgc.dll
  581. $(CC) test_dll.o -L$(ABSDIR) -lgc_dll -o test_dll
  582. SYM_PREFIX-libgc=GC
  583. # Uncomment the following line to build a GNU win32 DLL
  584. # include Makefile.DLLs
  585. reserved_namespace: $(SRCS)
  586. for file in $(SRCS) tests/test.c tests/test_cpp.cc; do \
  587. sed s/GC_/_GC_/g < $$file > tmp; \
  588. cp tmp $$file; \
  589. done
  590. user_namespace: $(SRCS)
  591. for file in $(SRCS) tests/test.c tests/test_cpp.cc; do \
  592. sed s/_GC_/GC_/g < $$file > tmp; \
  593. cp tmp $$file; \
  594. done