home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / sa104os2.zip / SATHR104.ZIP / SATHER / SYSTEM / GC / MAKEFILE < prev    next >
Text File  |  1994-12-21  |  12KB  |  252 lines

  1. # Primary targets:
  2. # gc.a - builds basic library
  3. # c++ - adds C++ interface to library and include directory
  4. # cords - adds cords (heavyweight strings) to library and include directory
  5. # test - prints porting information, then builds basic version of gc.a, and runs
  6. #        some tests of collector and cords.  Does not add cords or c++ interface to gc.a
  7. # cord/de - builds dumb editor based on cords.
  8. CC= cc
  9. CXX=g++ -ansi
  10. # Needed only for "make c++", which adds the c++ interface
  11. AS=as
  12.  
  13. CFLAGS= -O -DSILENT -DALL_INTERIOR_POINTERS -DNO_SIGNALS
  14. # Setjmp_test may yield overly optimistic results when compiled
  15. # without optimization.
  16. # -DSILENT disables statistics printing, and improves performance.
  17. # -DCHECKSUMS reports on erroneously clear dirty bits, and unexpectedly
  18. #   altered stubborn objects, at substantial performance cost.
  19. # -DFIND_LEAK causes the collector to assume that all inaccessible
  20. #   objects should have been explicitly deallocated, and reports exceptions
  21. # -DSOLARIS_THREADS enables support for Solaris (thr_) threads.
  22. #   (Clients should also define SOLARIS_THREADS and then include
  23. #   gc.h before performing thr_ or dl* or GC_ operations.)
  24. #   This is broken on nonSPARC machines.
  25. # -DALL_INTERIOR_POINTERS allows all pointers to the interior
  26. #   of objects to be recognized.  (See gc_priv.h for consequences.)
  27. # -DSMALL_CONFIG tries to tune the collector for small heap sizes,
  28. #   usually causing it to use less space in such situations.
  29. #   Incremental collection no longer works in this case.
  30. # -DDONT_ADD_BYTE_AT_END is meaningful only with
  31. #   -DALL_INTERIOR_POINTERS.  Normally -DALL_INTERIOR_POINTERS
  32. #   causes all objects to be padded so that pointers just past the end of
  33. #   an object can be recognized.  This can be expensive.  (The padding
  34. #   is normally more than one byte due to alignment constraints.)
  35. #   -DDONT_ADD_BYTE_AT_END disables the padding.
  36. # -DNO_SIGNALS does not disable signals during critical parts of
  37. #   the GC process.  This is no less correct than many malloc 
  38. #   implementations, and it sometimes has a significant performance
  39. #   impact.  However, it is dangerous for many not-quite-ANSI C
  40. #   programs that call things like printf in asynchronous signal handlers.
  41. # -DOPERATOR_NEW_ARRAY declares that the C++ compiler supports the
  42. #   new syntax "operator new[]" for allocating and deleting arrays.
  43. #   See gc_cpp.h for details.  No effect on the C part of the collector.
  44.  
  45. AR= ar
  46. RANLIB= ranlib
  47.  
  48.  
  49. # Redefining srcdir allows object code for the nonPCR version of the collector
  50. # to be generated in different directories.  In this case, the destination directory
  51. # should contain a copy of the original include directory.
  52. srcdir = .
  53. VPATH = $(srcdir)
  54.  
  55. OBJS= alloc.o reclaim.o allchblk.o misc.o mach_dep.o os_dep.o mark_rts.o headers.o mark.o obj_map.o blacklst.o finalize.o new_hblk.o dbg_mlc.o malloc.o stubborn.o checksums.o solaris_threads.o typd_mlc.o ptr_chck.o
  56.  
  57. CSRCS= reclaim.c allchblk.c misc.c alloc.c mach_dep.c os_dep.c mark_rts.c headers.c mark.c obj_map.c pcr_interface.c blacklst.c finalize.c new_hblk.c real_malloc.c dyn_load.c dbg_mlc.c malloc.c stubborn.c checksums.c solaris_threads.c typd_mlc.c ptr_chck.c
  58.  
  59. CORD_SRCS=  cord/cordbscs.c cord/cordxtra.c cord/cordprnt.c cord/de.c cord/cordtest.c cord/cord.h cord/ec.h cord/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
  60.  
  61. CORD_OBJS=  cord/cordbscs.o cord/cordxtra.o cord/cordprnt.o
  62.  
  63. SRCS= $(CSRCS) mips_mach_dep.s rs6000_mach_dep.s alpha_mach_dep.s sparc_mach_dep.s gc.h gc_typed.h gc_hdrs.h gc_priv.h gc_private.h config.h gc_mark.h include/gc_inl.h include/gc_inline.h gc.man if_mach.c if_not_there.c gc_cpp.cc gc_cpp.h $(CORD_SRCS)
  64.  
  65. OTHER_FILES= Makefile PCR-Makefile OS2_MAKEFILE NT_MAKEFILE \
  66.            README test.c test_cpp.cc setjmp_t.c SMakefile.amiga \
  67.            SCoptions.amiga README.amiga README.win32 cord/README \
  68.            cord/gc.h include/gc.h include/gc_typed.h include/cord.h \
  69.            include/ec.h include/private/cord_pos.h include/gc_c++.h \
  70.            README.QUICK callprocs pc_excludes barrett_diagram \
  71.            README.OS2 README.Mac MacProjects.sit.hqx MacOS.c \
  72.            EMX_MAKEFILE makefile.depend README.debugging \
  73.            include/gc_cpp.h
  74.  
  75. CORD_INCLUDE_FILES= $(srcdir)/gc.h $(srcdir)/cord/cord.h $(srcdir)/cord/ec.h \
  76.            $(srcdir)/cord/cord_pos.h
  77.  
  78. # Libraries needed for curses applications.  Only needed for de.
  79. CURSES= -lcurses -ltermlib
  80.  
  81. # The following is irrelevant on most systems.  But a few
  82. # versions of make otherwise fork the shell specified in
  83. # the SHELL environment variable.
  84. SHELL= /bin/sh
  85.  
  86. SPECIALCFLAGS = 
  87. # Alternative flags to the C compiler for mach_dep.c.
  88. # Mach_dep.c often doesn't like optimization, and it's
  89. # not time-critical anyway.
  90. # Set SPECIALCFLAGS to -q nodirect_code on Encore.
  91.  
  92. ALPHACFLAGS = -non_shared
  93. # Extra flags for linking compilation on DEC Alpha
  94.  
  95. all: gc.a gctest
  96.  
  97. pcr: PCR-Makefile gc_private.h gc_hdrs.h gc.h config.h mach_dep.o $(SRCS)
  98.     make -f PCR-Makefile depend
  99.     make -f PCR-Makefile
  100.  
  101. $(OBJS) test.o dyn_load.o dyn_load_sunos53.o: $(srcdir)/gc_priv.h $(srcdir)/gc_hdrs.h $(srcdir)/gc.h \
  102.     $(srcdir)/config.h $(srcdir)/gc_typed.h Makefile
  103. # The dependency on Makefile is needed.  Changing
  104. # options such as -DSILENT affects the size of GC_arrays,
  105. # invalidating all .o files that rely on gc_priv.h
  106.  
  107. mark.o typd_mlc.o finalize.o: $(srcdir)/gc_mark.h
  108.  
  109. gc.a: $(OBJS) dyn_load.o
  110.     rm -f on_sparc_sunos5
  111.     ./if_mach SPARC SUNOS5 touch on_sparc_sunos5
  112.     ./if_mach SPARC SUNOS5 $(AR) rus gc.a $(OBJS) dyn_load.o
  113.     ./if_not_there on_sparc_sunos5 $(AR) ru gc.a $(OBJS) dyn_load.o
  114.     ./if_not_there on_sparc_sunos5 $(RANLIB) gc.a || cat /dev/null
  115. #    ignore ranlib failure; that usually means it doesn't exist, and isn't needed
  116.  
  117. cords: $(CORD_OBJS) cord/cordtest
  118.     rm -f on_sparc_sunos5
  119.     ./if_mach SPARC SUNOS5 touch on_sparc_sunos5
  120.     ./if_mach SPARC SUNOS5 $(AR) rus gc.a $(CORD_OBJS)
  121.     ./if_not_there on_sparc_sunos5 $(AR) ru gc.a $(CORD_OBJS)
  122.     ./if_not_there on_sparc_sunos5 $(RANLIB) gc.a || cat /dev/null
  123.  
  124. gc_cpp.o: $(srcdir)/gc_cpp.cc $(srcdir)/gc_cpp.h $(srcdir)/gc.h Makefile
  125.     $(CXX) -c -O $(srcdir)/gc_cpp.cc
  126.     
  127. test_gc_c++: $(srcdir)/test_cpp.cc $(srcdir)/gc_cpp.h gc_cpp.o $(srcdir)/gc.h gc.a
  128.     $(CXX) -O -o test_gc_c++ $(srcdir)/test_cpp.cc gc_cpp.o gc.a
  129.  
  130. c++: gc_cpp.o $(srcdir)/gc_cpp.h test_gc_c++
  131.     rm -f on_sparc_sunos5
  132.     ./if_mach SPARC SUNOS5 touch on_sparc_sunos5
  133.     ./if_mach SPARC SUNOS5 $(AR) rus gc.a gc_cpp.o
  134.     ./if_not_there on_sparc_sunos5 $(AR) ru gc.a gc_cpp.o
  135.     ./if_not_there on_sparc_sunos5 $(RANLIB) gc.a || cat /dev/null
  136.     ./test_gc_c++ 1
  137.  
  138. dyn_load_sunos53.o: dyn_load.c
  139.     $(CC) $(CFLAGS) -DSUNOS53_SHARED_LIB -c dyn_load.c -o $@
  140.  
  141. # SunOS5 shared library version of the collector
  142. libgc.so: $(OBJS) dyn_load_sunos53.o
  143.     $(CC) -G -o libgc.so $(OBJS) dyn_load_sunos53.o -ldl
  144.  
  145. mach_dep.o: $(srcdir)/mach_dep.c $(srcdir)/mips_mach_dep.s $(srcdir)/rs6000_mach_dep.s if_mach if_not_there
  146.     rm -f mach_dep.o
  147.     ./if_mach MIPS "" $(AS) -o mach_dep.o $(srcdir)/mips_mach_dep.s
  148. #  The above doesn't work with gas, which doesn't run cpp.
  149. #  Rename the above file to end in .S, and then use
  150. #  gcc -c -o mach_dep.o mips_mach_dep.S instead.
  151.     ./if_mach RS6000 "" $(AS) -o mach_dep.o $(srcdir)/rs6000_mach_dep.s
  152.     ./if_mach ALPHA "" $(AS) -o mach_dep.o $(srcdir)/alpha_mach_dep.s
  153.     ./if_mach SPARC SUNOS5 $(AS) -o mach_dep.o $(srcdir)/sparc_mach_dep.s
  154.     ./if_not_there mach_dep.o $(CC) -c $(SPECIALCFLAGS) $(srcdir)/mach_dep.c
  155.  
  156. mark_rts.o: $(srcdir)/mark_rts.c if_mach if_not_there
  157.     rm -f mark_rts.o
  158.     ./if_mach ALPHA "" $(CC) -c $(CFLAGS) -Wo,-notail $(srcdir)/mark_rts.c
  159.     ./if_not_there mark_rts.o $(CC) -c $(CFLAGS) $(srcdir)/mark_rts.c
  160. #    work-around for DEC optimizer tail recursion elimination bug
  161.  
  162. cord/cordbscs.o: $(srcdir)/cord/cordbscs.c $(CORD_INCLUDE_FILES)
  163.     $(CC) $(CFLAGS) -c $(srcdir)/cord/cordbscs.c
  164.     mv cordbscs.o cord/cordbscs.o
  165. #  not all compilers understand -o filename
  166.  
  167. cord/cordxtra.o: $(srcdir)/cord/cordxtra.c $(CORD_INCLUDE_FILES)
  168.     $(CC) $(CFLAGS) -c $(srcdir)/cord/cordxtra.c
  169.     mv cordxtra.o cord/cordxtra.o
  170.  
  171. cord/cordprnt.o: $(srcdir)/cord/cordprnt.c $(CORD_INCLUDE_FILES)
  172.     $(CC) $(CFLAGS) -c $(srcdir)/cord/cordprnt.c
  173.     mv cordprnt.o cord/cordprnt.o
  174.  
  175. cord/cordtest: $(srcdir)/cord/cordtest.c $(CORD_OBJS) gc.a
  176.     rm -f cord/cordtest
  177.     ./if_mach SPARC SUNOS5 $(CC) $(CFLAGS) -o cord/cordtest $(srcdir)/cord/cordtest.c $(CORD_OBJS) gc.a -lthread -ldl
  178.     ./if_mach SPARC DRSNX $(CC) $(CFLAGS) -o cord/cordtest $(srcdir)/cord/cordtest.c $(CORD_OBJS) gc.a -lucb
  179.     ./if_not_there cord/cordtest $(CC) $(CFLAGS) -o cord/cordtest $(srcdir)/cord/cordtest.c $(CORD_OBJS) gc.a
  180.  
  181. cord/de: $(srcdir)/cord/de.c cord/cordbscs.o cord/cordxtra.o gc.a
  182.     rm -f cord/de
  183.     ./if_mach SPARC SUNOS5 $(CC) $(CFLAGS) -o cord/de $(srcdir)/cord/de.c cord/cordbscs.o cord/cordxtra.o gc.a $(CURSES) -lthread -ldl
  184.     ./if_mach SPARC DRSNX $(CC) $(CFLAGS) -o cord/de $(srcdir)/cord/de.c cord/cordbscs.o cord/cordxtra.o gc.a $(CURSES) -lucb
  185.     ./if_mach RS6000 "" $(CC) $(CFLAGS) -o cord/de $(srcdir)/cord/de.c cord/cordbscs.o cord/cordxtra.o gc.a -lcurses
  186.     ./if_mach I386 LINUX $(CC) $(CFLAGS) -o cord/de $(srcdir)/cord/de.c cord/cordbscs.o cord/cordxtra.o gc.a -lcurses
  187.     ./if_not_there cord/de $(CC) $(CFLAGS) -o cord/de $(srcdir)/cord/de.c cord/cordbscs.o cord/cordxtra.o gc.a $(CURSES)
  188.  
  189. if_mach: $(srcdir)/if_mach.c $(srcdir)/config.h
  190.     $(CC) $(CFLAGS) -o if_mach $(srcdir)/if_mach.c
  191.  
  192. if_not_there: $(srcdir)/if_not_there.c
  193.     $(CC) $(CFLAGS) -o if_not_there $(srcdir)/if_not_there.c
  194.  
  195. clean: 
  196.     rm -f gc.a test.o gctest $(OBJS) dyn_load.o dyn_load_sunos53.o \
  197.           gctest_dyn_link \
  198.           setjmp_test  mon.out gmon.out a.out core if_not_there if_mach \
  199.           $(CORD_OBJS) cord/cordtest cord/de
  200.     -rm -f *~
  201.  
  202. gctest: test.o gc.a if_mach if_not_there
  203.     rm -f gctest
  204.     ./if_mach ALPHA "" $(CC) $(CFLAGS) -o gctest $(ALPHACFLAGS) test.o gc.a
  205.     ./if_mach SPARC SUNOS5 $(CC) $(CFLAGS) -o gctest  test.o gc.a -lthread -ldl
  206.     ./if_mach SPARC DRSNX $(CC) $(CFLAGS) -o gctest  test.o gc.a -lucb
  207.     ./if_not_there gctest $(CC) $(CFLAGS) -o gctest test.o gc.a
  208.  
  209. # If an optimized setjmp_test generates a segmentation fault,
  210. # odds are your compiler is broken.  Gctest may still work.
  211. # Try compiling setjmp_t.c unoptimized.
  212. setjmp_test: $(srcdir)/setjmp_t.c $(srcdir)/gc.h if_mach if_not_there
  213.     rm -f setjmp_test
  214.     ./if_mach ALPHA "" $(CC) $(CFLAGS) -o setjmp_test $(ALPHACFLAGS) $(srcdir)/setjmp_t.c
  215.     ./if_not_there setjmp_test $(CC) $(CFLAGS) -o setjmp_test $(srcdir)/setjmp_t.c
  216.  
  217. test: setjmp_test gctest
  218.     ./setjmp_test
  219.     ./gctest
  220.     make cord/cordtest
  221.     cord/cordtest
  222.  
  223. gc.tar: $(SRCS) $(OTHER_FILES)
  224.     tar cvf gc.tar $(SRCS) $(OTHER_FILES)
  225.     
  226. pc_gc.tar: $(SRCS) $(OTHER_FILES)
  227.     tar cvfX pc_gc.tar pc_excludes $(SRCS) $(OTHER_FILES)
  228.  
  229. floppy: pc_gc.tar
  230.     -mmd a:/cord
  231.     -mmd a:/include
  232.     mkdir /tmp/pc_gc
  233.     cat pc_gc.tar | (cd /tmp/pc_gc; tar xvf -)
  234.     -mcopy -tmn /tmp/pc_gc/* a:
  235.     -mcopy -tmn /tmp/pc_gc/cord/* a:/cord
  236.     -mcopy -mn /tmp/pc_gc/cord/de_win.ICO a:/cord
  237.     -mcopy -tmn /tmp/pc_gc/include/* a:/cord
  238.     rm -r /tmp/pc_gc
  239.  
  240. gc.tar.Z: gc.tar
  241.     compress gc.tar
  242.  
  243. lint: $(CSRCS) test.c
  244.     lint -DLINT $(CSRCS) test.c | egrep -v "possible pointer alignment problem|abort|exit|sbrk|mprotect|syscall"
  245.     
  246. # BTL: added to test shared library version of collector.
  247. # Currently works only under SunOS5.  Requires GC_INIT call from statically
  248. # loaded client code.
  249. ABSDIR = `pwd`
  250. gctest_dyn_link: test.o libgc.so
  251.     $(CC) -L$(ABSDIR) -R$(ABSDIR) -o gctest_dyn_link test.o -lgc -ldl -lthread
  252.