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

  1. # Copyright (C) International Computer Science Institute, 1994.  COPYRIGHT  
  2. # NOTICE: This code is provided "AS IS" WITHOUT ANY WARRANTY and is subject 
  3. # to the terms of the SATHER LIBRARY GENERAL PUBLIC LICENSE contained in    
  4. # the file "Doc/License" of the Sather distribution.  The license is also   
  5. # available from ICSI, 1947 Center St., Suite 600, Berkeley CA 94704, USA.  
  6. # -----> Please email comments to "sather-bugs@icsi.berkeley.edu". <-----
  7.  
  8. # Be sure to read the file Doc/Installation!
  9. #
  10. # You'll need to set these variables to be appropriate to your system.
  11. #
  12. # What you set CC to will automatically be used for compiling the
  13. # garbage collector and used for ordinary (after the bootstrap) compiles
  14. # as well.  Some systems (OSF/1) need to use cc for the GC instead of gcc,
  15. # so you can set GC_CC to be something different.
  16. #
  17. # CFLAGS is only used during the bootstrap; CC options for regular
  18. # compiles must be specified in System/CONFIG.proto.
  19. #
  20. # CS is the executable name.
  21. #
  22. # Set SHOME to an absolute path to the directory this Makefile is in.
  23. #
  24. # Don't forget to edit (or at least inspect) the file System/CONFIG.proto.
  25.  
  26. CPP= /lib/cpp -C -P
  27. RANLIB= ranlib
  28. CC= gcc
  29. CFLAGS= -O
  30. GC_CC= ${CC}
  31. MV= mv
  32. CMP= cmp
  33. CS= cs
  34. SHOME= /u/davids/Sather
  35. AR= ar
  36. RM= rm -f
  37. TEST= test
  38. GC_MKFL= Makefile
  39.  
  40. SYSTEM= System/GC/gc.a System/base.a System/MACROS System/CONFIG System/ITERS
  41. BOOTCS= ${SHOME}/Boot/${CS}
  42.  
  43. # Make the boot compiler and give it a workout on itself and some test cases
  44. all: beware Compiler/${CS} quick_test
  45.  
  46. # Make and test everything
  47. testall: all fixedpoint_test
  48.  
  49. system: ${SYSTEM}
  50.  
  51. beware:
  52.     if [ ! -z "${SATHER_COMMANDS}" ]; then \
  53.       echo "You must turn off the SATHER_COMMANDS environment variable."; \
  54.       exit 1; \
  55.     fi
  56.  
  57. # The compiler which ends up in Compiler/ is the "fast" executable,
  58. # which means that checking is turned off and optimizations are on.
  59.  
  60. Compiler/${CS}: ${SYSTEM} ${BOOTCS} Compiler/*.sa Library/*.sa
  61.     cd Compiler; ${BOOTCS} -home ${SHOME} -com cs.commands -o ${CS} -fast -only_reachable
  62.  
  63. debug: ${SYSTEM} ${BOOTCS} Compiler/*.sa Library/*.sa
  64.     cd Compiler; ${BOOTCS} -home ${SHOME} -com cs.commands -o ${CS} -check all -debug -only_reachable -output_C -deterministic
  65.  
  66. ${BOOTCS}: ${SYSTEM}
  67.     cd Boot/cs.code; make CC='${CC}' CFLAGS='${CFLAGS}' CS='${CS}'
  68.  
  69. # The next four rules just make the stuff in System/
  70.  
  71. System/MACROS: System/MACROS.proto
  72.     ${CPP} System/MACROS.proto > System/MACROS
  73. System/CONFIG: System/CONFIG.proto
  74.     ${CPP} -DCC='${CC}' System/CONFIG.proto > System/CONFIG
  75. System/base.a: System/*.c System/*.h
  76.     cd System; ${CC} ${CFLAGS} -c *.c; ${AR} rc base.a *.o; 
  77.     ${RANLIB} System/base.a || cat /dev/null
  78. System/GC/gc.a:
  79.     cd System/GC; make -f '${GC_MKFL}' CFLAGS='${CFLAGS} -DSILENT' CC='${GC_CC}' RANLIB='${RANLIB}'
  80.  
  81. # There are two tests.  The first is the test classes in the library,
  82. # which is pretty straightforward.  The second is a full fixed-point
  83. # compilation of the compiler, which can take quite a while.
  84.  
  85. quick_test: Compiler/${CS}
  86.     cd Test; ../Compiler/${CS} -home ${SHOME} -com tests.commands -o ${TEST}; ./${TEST}>test-output
  87.  
  88. # The fixed-point test does the following:
  89. #
  90. #    1. Compile using Compiler/cs.
  91. #    2. Compile using result.
  92. #    3. Compile using _that_ result.
  93. #    4. Compare C files generated by (2) and (3).
  94. #    5. Clean up.
  95. #
  96. # This can take quite a long time so I've removed it from the things
  97. # that occur by default during a build.
  98.  
  99. fixedpoint_test: Compiler/${CS}
  100.     cd Test; \
  101.     echo "Compiling 1st..." ; \
  102.     ../Compiler/${CS} -com ../Compiler/cs.commands -home ${SHOME} -output_C -o ${CS} -O -deterministic -check all; \
  103.     ${MV} ${CS} first.${CS}; \
  104.     ${RM} -r ${CS}.code first.${CS}.code; \
  105.     echo "Compiling 2nd..." ; \
  106.     ./first.${CS}     -com ../Compiler/cs.commands -home ${SHOME} -output_C -o ${CS} -O -deterministic -check all; \
  107.     ${MV} ${CS} first.${CS}; \
  108.     ${MV} ${CS}.code first.${CS}.code; \
  109.     echo "Compiling 3rd..." ; \
  110.     ./first.${CS}     -com ../Compiler/cs.commands -home ${SHOME} -output_C -o ${CS} -O -deterministic -check all; \
  111.     echo "Checking for fixed point..." ; \
  112.     ${CMP} ${CS}.code/globals.c first.${CS}.code/globals.c; \
  113.     ${CMP} ${CS}.code/decs.h first.${CS}.code/decs.h; \
  114.     ${CMP} ${CS}.code/code0.c first.${CS}.code/code0.c; \
  115.     ${CMP} ${CS}.code/code1.c first.${CS}.code/code1.c; \
  116.     ${CMP} ${CS}.code/code2.c first.${CS}.code/code2.c; \
  117.     ${CMP} ${CS}.code/code3.c first.${CS}.code/code3.c; \
  118.     ${CMP} ${CS}.code/code4.c first.${CS}.code/code4.c; \
  119.     ${CMP} ${CS}.code/code5.c first.${CS}.code/code5.c; \
  120.     echo "Everything okay, cleaning up..." ; \
  121.     ${RM} -r ${CS}.code first.${CS}.code first.${CS} ${CS}
  122.  
  123. clean:
  124.     ${RM} System/*.o System/base.a
  125.     ${RM} System/MACROS System/CONFIG
  126.     cd System/GC; make -f ${GC_MKFL} clean
  127.     ${RM} Boot/${CS} Boot/${CS}.code/*.o
  128.     ${RM} -fr Compiler/${CS} Compiler/${CS}.code
  129.     cd Test; ${RM} -fr ${CS}.code first.${CS}.code ${CS} first.${CS}
  130.     ${RM} Test/${TEST} Test/test-output
  131.  
  132. # You'll never want to do these
  133. distribution: Compiler/cs
  134.     cd Compiler; ./cs -com cs.commands -home .. -o cs -O -output_C -only_C; rm -fr ../Boot/cs.code; mv cs.code ../Boot/
  135.     make clean
  136.     cd ..; tar cf - Sather | compress > Sather.tar.Z
  137.