home *** CD-ROM | disk | FTP | other *** search
/ cs.rhul.ac.uk / www.cs.rhul.ac.uk.zip / www.cs.rhul.ac.uk / pub / rdp / rdp_cs3470.tar / makefile~ < prev    next >
Text File  |  2009-02-05  |  11KB  |  376 lines

  1. ###############################################################################
  2. #
  3. # RDP release 1.50 by Adrian Johnstone (A.Johnstone@rhbnc.ac.uk) 20 December 1997
  4. #
  5. ###############################################################################
  6. #
  7. # Configuration section: uncomment one of the following blocks for gcc, g++,
  8. # djgpp, acc on Sunos, Borland C++ or Microsoft C++.
  9. #
  10. ###############################################################################
  11.  
  12. # Configuration for g++ on Unix. Also works for gcc if you set CC = g++
  13. CC      = gcc
  14. OBJ     = .o
  15. EXE     =
  16. DIFF    = diff -s
  17. RM      = rm
  18. CP      = cp
  19. SUPP_DIR = ./rdp_supp/
  20. CFLAGS = -I$(SUPP_DIR) -g
  21. LINK    = $(CC) -o ./
  22. MATHS   = -lm
  23. HERE    = ./
  24. OBJ_ONLY = -c
  25. # End of gcc on Unix configuration
  26.  
  27. # Configuration for gcc on DOS using djpgg.
  28. # Note: You can find diff,cp,rm etc by looking for DOSIX with archie
  29. #CC     = gcc
  30. #OBJ = .o
  31. #EXE =
  32. #DIFF = diff -b                 # assumes you have diff for dos
  33. #RM = rm                        # assumes you have rm for dos
  34. #CP = cp                        # assumes you have cp for dos
  35. #SUPP_DIR = ./rdp_supp/
  36. #CFLAGS = -I$(SUPP_DIR) -Wmissing-prototypes -Wstrict-prototypes -fno-common -Wall -ansi -pedantic
  37. #LINK = $(CC) $(CFLAGS) -o ./
  38. #MATHS = -lm
  39. #HERE = ./
  40. #COFF = coff2exe        # gcc util to add in DPMI => standalone .exe file
  41. #OBJ_ONLY = -c
  42. # End of gcc on DOS configuration
  43.  
  44. # Configuration for Sun acc 2.0 on SunOS
  45. #CC     = acc
  46. #OBJ = .o
  47. #EXE =
  48. #DIFF = diff -s
  49. #RM = rm
  50. #CP = cp
  51. #SUPP_DIR = ./rdp_supp/
  52. #CFLAGS = -I$(SUPP_DIR) -Xa -vc
  53. #LINK = $(CC) $(CFLAGS) -o ./
  54. #MATHS = -lm
  55. #HERE = ./
  56. #OBJ_ONLY = -c
  57. # End of Sun acc 2.0 on SunOS configuration
  58.  
  59. # Configuration for Borland C++ 5.0 under Windows-95
  60. #CC     = bcc32
  61. #OBJ    = .obj
  62. #EXE    = .exe
  63. #DIFF   = fc 
  64. #RM     = del
  65. #CP     = copy
  66. #SUPP_DIR = rdp_supp\\
  67. #CFLAGS = -I$(SUPP_DIR) -A -c -P -w
  68. #LINK   = $(CC) -e
  69. #MATHS  =
  70. #HERE   = 
  71. #OBJ_ONLY = -c
  72. # End of Borland C++ 5.0 under Windows-95 configuration
  73.  
  74. # Configuration for Borland C 3.1 on MS-DOS
  75. #CC     = bcc
  76. #OBJ    = .obj
  77. #EXE    = .exe
  78. #DIFF   = fc 
  79. #RM     = del
  80. #CP     = copy
  81. #SUPP_DIR = rdp_supp\\
  82. #CFLAGS = -I$(SUPP_DIR) -A -P -w -N -mh
  83. #LINK   = $(CC) -mh -o
  84. #MATHS  =
  85. #HERE   = 
  86. #OBJ_ONLY = -c
  87. # End of Borland C 3.1 on MS-DOS configuration
  88.  
  89. # Configuration for Microsoft C Version 7.00 on MS-DOS using nmake
  90. #CC     = cl
  91. #OBJ    = .obj
  92. #EXE    = .exe
  93. #DIFF   = fc 
  94. #RM     = del
  95. #CP     = copy
  96. #SUPP_DIR = .\rdp_supp^\
  97. #CFLAGS = /AL /W4 /I $(SUPP_DIR)
  98. #LINK   = $(CC) $(CFLAGS) -o.^\
  99. #MATHS  =
  100. #HERE   = .^\
  101. #OBJ_ONLY = /c
  102. # End of Configuration for Microsoft 'C' Version 7.00 on MS-DOS using nmake
  103.  
  104. ###############################################################################
  105. #
  106. # End of configuration : don't alter anything below this line
  107. #
  108. ###############################################################################
  109.  
  110. # Standard macros
  111.  
  112. RDP_AUX = rdp_aux$(OBJ) rdp_gram$(OBJ) rdp_prnt$(OBJ)
  113. RDP_SUPP = arg$(OBJ) graph$(OBJ) memalloc$(OBJ) scan$(OBJ) scanner$(OBJ) set$(OBJ) symbol$(OBJ) textio$(OBJ)
  114. RDP_OBJ = rdp_*$(OBJ)
  115.  
  116. # Standard suffix rules
  117.  
  118. .c$(OBJ):
  119.     $(CC) $(CFLAGS) $(OBJ_ONLY) $*.c
  120.  
  121. # default target: do everything
  122.  
  123. all: ms_test m_test mc_test ml_test mt_test pas_test pr_c_test rdp_test
  124.  
  125. # Build the support modules: do this locally in case user wants debug options
  126. arg$(OBJ): $(SUPP_DIR)arg.h $(SUPP_DIR)arg.c
  127.     $(CC) $(CFLAGS) $(OBJ_ONLY) $(SUPP_DIR)arg.c
  128.  
  129. graph$(OBJ): $(SUPP_DIR)graph.h $(SUPP_DIR)graph.c
  130.     $(CC) $(CFLAGS) $(OBJ_ONLY) $(SUPP_DIR)graph.c
  131.  
  132. memalloc$(OBJ): $(SUPP_DIR)memalloc.h $(SUPP_DIR)memalloc.c
  133.     $(CC) $(CFLAGS) $(OBJ_ONLY) $(SUPP_DIR)memalloc.c
  134.  
  135. scan$(OBJ): $(SUPP_DIR)scan.h $(SUPP_DIR)scan.c
  136.     $(CC) $(CFLAGS) $(OBJ_ONLY) $(SUPP_DIR)scan.c
  137.  
  138. scanner$(OBJ): $(SUPP_DIR)scan.h $(SUPP_DIR)scanner.c
  139.     $(CC) $(CFLAGS) $(OBJ_ONLY) $(SUPP_DIR)scanner.c
  140.  
  141. set$(OBJ): $(SUPP_DIR)set.h $(SUPP_DIR)set.c
  142.     $(CC) $(CFLAGS) $(OBJ_ONLY) $(SUPP_DIR)set.c
  143.  
  144. symbol$(OBJ): $(SUPP_DIR)symbol.h $(SUPP_DIR)symbol.c
  145.     $(CC) $(CFLAGS) $(OBJ_ONLY) $(SUPP_DIR)symbol.c
  146.  
  147. textio$(OBJ): $(SUPP_DIR)textio.h $(SUPP_DIR)textio.c
  148.     $(CC) $(CFLAGS) $(OBJ_ONLY) $(SUPP_DIR)textio.c
  149.  
  150. # compile distributed rdp
  151. rdp$(EXE): rdp$(OBJ) $(RDP_AUX) $(RDP_SUPP)
  152.     $(LINK)rdp$(EXE) rdp$(OBJ) $(RDP_OBJ) $(RDP_SUPP)
  153.  
  154. # generate and compile rdp1 from rdp.bnf
  155. rdp1.c: rdp$(EXE) rdp.bnf
  156.     $(HERE)rdp -F -ordp1 rdp
  157.  
  158. rdp1$(EXE): rdp1$(OBJ) $(RDP_AUX) $(RDP_SUPP)
  159.     $(LINK)rdp1$(EXE) rdp1$(OBJ) $(RDP_OBJ) $(RDP_SUPP)
  160.  
  161. # run rdp.bnf through rdp1 to make rdp2 and diff to see if they are the same
  162. rdp_test: rdp1$(EXE)
  163.     $(CP) rdp1.c rdp2.c
  164.     $(HERE)rdp1 -F -ordp1 rdp
  165.     -$(DIFF) rdp1.c rdp2.c
  166.  
  167. # generate, compile and test the mini syntax checker
  168. mini_syn.c: rdp$(EXE) mini_syn.bnf
  169.     $(HERE)rdp -F -omini_syn mini_syn
  170.  
  171. mini_syn$(EXE): mini_syn$(OBJ) $(RDP_SUPP)
  172.     $(LINK)mini_syn$(EXE) mini_syn$(OBJ) $(RDP_SUPP)
  173.  
  174. ms_test: mini_syn$(EXE) testcalc.m
  175.     $(HERE)mini_syn testcalc
  176.  
  177. # generate, compile and test the mini interpreter
  178. minicalc.c: rdp$(EXE) minicalc.bnf
  179.     $(HERE)rdp -F -ominicalc minicalc
  180.  
  181. minicalc$(EXE): minicalc$(OBJ) $(RDP_SUPP)
  182.     $(LINK)minicalc$(EXE) minicalc$(OBJ) $(RDP_SUPP) $(MATHS)
  183.  
  184. m_test: minicalc$(EXE) testcalc.m
  185.     $(HERE)minicalc testcalc
  186.  
  187. # generate, compile and test the minicond interpreter
  188. minicond.c: rdp$(EXE) minicond.bnf
  189.     $(HERE)rdp -F -ominicond minicond
  190.  
  191. minicond$(EXE): minicond$(OBJ) $(RDP_SUPP)
  192.     $(LINK)minicond$(EXE) minicond$(OBJ) $(RDP_SUPP) $(MATHS)
  193.  
  194. mc_test: minicond$(EXE) testcond.m
  195.     $(HERE)minicond testcond
  196.  
  197. # generate and compile the miniloop compiler
  198. miniloop.c: rdp$(EXE) miniloop.bnf 
  199.     $(HERE)rdp -F -ominiloop miniloop
  200.  
  201. miniloop$(EXE): miniloop$(OBJ) ml_aux$(OBJ) $(RDP_SUPP)
  202.     $(LINK)miniloop$(EXE) miniloop$(OBJ) ml_aux$(OBJ) $(RDP_SUPP) $(MATHS)
  203.  
  204. # generate and compile the minitree compiler
  205. minitree.c: rdp$(EXE) minitree.bnf 
  206.     $(HERE)rdp -F -ominitree minitree
  207.  
  208. minitree$(EXE): minitree$(OBJ) ml_aux$(OBJ) mt_aux$(OBJ) $(RDP_SUPP)
  209.     $(LINK)minitree$(EXE) minitree$(OBJ) m*_aux$(OBJ) $(RDP_SUPP)
  210.  
  211. # generate and compile the mvmasm assembler
  212. mvmasm.c: rdp$(EXE) mvmasm.bnf 
  213.     $(HERE)rdp -F -omvmasm mvmasm
  214.  
  215. mvmasm$(EXE): mvmasm$(OBJ) mvm_aux$(OBJ) $(RDP_SUPP)
  216.     $(LINK)mvmasm$(EXE) mvmasm$(OBJ) mvm_aux$(OBJ) $(RDP_SUPP) $(MATHS)
  217.  
  218. # compile the mvmsim simulator
  219. mvmsim$(EXE): mvmsim$(OBJ) $(RDP_SUPP)
  220.     $(LINK)mvmsim$(EXE) mvmsim$(OBJ) $(RDP_SUPP)
  221.  
  222. # test the single-pass compiler, assembler and simulator
  223. ml_test: miniloop$(EXE) mvmasm$(EXE) mvmsim$(EXE) testloop.m
  224.     $(HERE)miniloop -otestloop.mvm testloop
  225.     $(HERE)mvmasm -otestloop.sim testloop
  226.     $(HERE)mvmsim testloop.sim
  227.  
  228. # test the tree based compiler, assembler and simulator
  229. mt_test: minitree$(EXE) mvmasm$(EXE) mvmsim$(EXE) testtree.m
  230.     $(HERE)minitree -otesttree.mvm testtree
  231.     $(HERE)mvmasm -otesttree.sim testtree
  232.     $(HERE)mvmsim testtree.sim
  233.  
  234. # generate, compile and test the pascal parser
  235. pascal.c: rdp$(EXE) pascal.bnf
  236. # Need -F to override dangling else
  237.     $(HERE)rdp -opascal -F pascal
  238.  
  239. pascal$(EXE): pascal$(OBJ) $(RDP_SUPP)
  240.     $(LINK)pascal$(EXE) pascal$(OBJ) $(RDP_SUPP)
  241.  
  242. pas_test: pascal$(EXE) test.pas
  243.     $(HERE)pascal test
  244.  
  245. # generate and compile the ANSI C pretty printer
  246. pretty_c.c: rdp$(EXE) pretty_c.bnf
  247.     $(HERE)rdp -opretty_c pretty_c
  248.  
  249. pretty_c$(EXE): pretty_c$(OBJ) pr_c_aux$(OBJ) $(RDP_SUPP)
  250.     $(LINK)pretty_c$(EXE) pretty_c$(OBJ) pr_c_aux$(OBJ) $(RDP_SUPP)
  251.  
  252. pr_c_test: pretty_c$(EXE) test.c
  253.     $(HERE)pretty_c test
  254.     -$(DIFF) test.c test.bak
  255.     -$(RM) test.bak
  256.  
  257. #general targets to build parser for grammar defined in GRAMMAR macro
  258. parser: $(RDP_SUPP)
  259.     $(HERE)rdp $(GRAMMAR)
  260.     $(CC) $(CFLAGS) $(OBJ_ONLY) rdparser.c
  261.     $(LINK)rdparser$(EXE) rdparser$(OBJ) $(RDP_SUPP) $(MATHS)
  262.     $(HERE)rdparser -v -Vrdparser.vcg -l $(HERE)$(GRAMMAR).str
  263.  
  264. parserf: $(RDP_SUPP)
  265.     $(HERE)rdp -F $(GRAMMAR)
  266.     $(CC) $(CFLAGS) $(OBJ_ONLY) rdparser.c
  267.     $(LINK)rdparser$(EXE) rdparser$(OBJ) $(RDP_SUPP) $(MATHS)
  268.     $(HERE)rdparser -v -Vrdparser.vcg -l $(HERE)$(GRAMMAR).str
  269.  
  270. #run the pretty printer on all C source files
  271. pretty:    pretty_c$(EXE)
  272.     $(HERE)pretty_c mini_aux.c
  273.     $(HERE)pretty_c ml_aux.c
  274.     $(HERE)pretty_c mt_aux.c
  275.     $(HERE)pretty_c mvmsim.c
  276.     $(HERE)pretty_c mvm_aux.c
  277.     $(HERE)pretty_c pretty_c.c
  278.     $(HERE)pretty_c pr_c_aux.c
  279.     $(HERE)pretty_c rdp.c
  280.     $(HERE)pretty_c rdp_aux.c
  281.     $(HERE)pretty_c rdp_gram.c
  282.     $(HERE)pretty_c rdp_prnt.c
  283.     $(HERE)pretty_c rdp_supp/arg.c
  284.     $(HERE)pretty_c rdp_supp/graph.c
  285.     $(HERE)pretty_c rdp_supp/memalloc.c
  286.     $(HERE)pretty_c rdp_supp/scan.c
  287.     $(HERE)pretty_c rdp_supp/scanner.c
  288.     $(HERE)pretty_c rdp_supp/set.c
  289.     $(HERE)pretty_c rdp_supp/symbol.c
  290.     $(HERE)pretty_c rdp_supp/textio.c
  291.     $(HERE)pretty_c rdp_test/argtest.c
  292.     $(HERE)pretty_c rdp_test/grphtest.c
  293.     $(HERE)pretty_c rdp_test/scantest.c
  294.     $(HERE)pretty_c rdp_test/settest.c
  295.     $(HERE)pretty_c rdp_test/symtest.c
  296.     $(HERE)pretty_c rdp_test/texttest.c
  297.     $(HERE)pretty_c mini_aux.h
  298.     $(HERE)pretty_c ml_aux.h
  299.     $(HERE)pretty_c mt_aux.h
  300.     $(HERE)pretty_c mvm_aux.h
  301.     $(HERE)pretty_c mvm_def.h
  302.     $(HERE)pretty_c pretty_c.h
  303.     $(HERE)pretty_c pr_c_aux.h
  304.     $(HERE)pretty_c rdp.h
  305.     $(HERE)pretty_c rdp_aux.h
  306.     $(HERE)pretty_c rdp_gram.h
  307.     $(HERE)pretty_c rdp_prnt.h
  308.     $(HERE)pretty_c rdp_supp/arg.h
  309.     $(HERE)pretty_c rdp_supp/graph.h
  310.     $(HERE)pretty_c rdp_supp/memalloc.h
  311.     $(HERE)pretty_c rdp_supp/scan.h
  312.     $(HERE)pretty_c rdp_supp/set.h
  313.     $(HERE)pretty_c rdp_supp/symbol.h
  314.     $(HERE)pretty_c rdp_supp/textio.h
  315.  
  316. # run trap tests
  317. trap:
  318.     $(RM) rdparser.*
  319.     make -i -s GRAMMAR=rdp_trap/empty parser
  320.     make -i -s GRAMMAR=rdp_trap/comment parser
  321.     make -i -s GRAMMAR=rdp_trap/directiv parser
  322.     make -i -s GRAMMAR=rdp_trap/seq_g1 parser
  323.     make -i -s GRAMMAR=rdp_trap/seq_b1 parser
  324.     make -i -s GRAMMAR=rdp_trap/seq_b2 parser
  325.     make -i -s GRAMMAR=rdp_trap/seq_b3 parser
  326.     make -i -s GRAMMAR=rdp_trap/alt_g1 parser
  327.     make -i -s GRAMMAR=rdp_trap/alt_b1 parser
  328.     make -i -s GRAMMAR=rdp_trap/alt_b2 parser
  329.  
  330.  
  331. # get rid of intermediate files
  332. clean:
  333.     -$(RM) *$(OBJ)
  334.     -$(RM) *.bak
  335.     -$(RM) rdp1.*
  336.     -$(RM) rdp2.*
  337.     -$(RM) pascal.c
  338.     -$(RM) pascal.h
  339.     -$(RM) pretty_c.c
  340.     -$(RM) pretty_c.h
  341.     -$(RM) mini_syn.c
  342.     -$(RM) mini_syn.h
  343.     -$(RM) minicalc.c
  344.     -$(RM) minicalc.h
  345.     -$(RM) minicond.c
  346.     -$(RM) minicond.h
  347.     -$(RM) miniloop.c
  348.     -$(RM) miniloop.h
  349.     -$(RM) minitree.c
  350.     -$(RM) minitree.h
  351.     -$(RM) mvmasm.c
  352.     -$(RM) mvmasm.h
  353.     -$(RM) mvmasm.out
  354.     -$(RM) testloop.mvm
  355.     -$(RM) testloop.sim
  356.     -$(RM) testtree.mvm
  357.     -$(RM) testtree.sim
  358.     -$(RM) minitree.mvm
  359.     -$(RM) miniloop.mvm
  360.  
  361. # return to intial distribution state by deleting executables
  362. veryclean: clean
  363.     -$(RM) rdparser.c
  364.     -$(RM) rdparser.h
  365.     -$(RM) rdparser$(EXE)
  366.     -$(RM) pascal$(EXE)
  367.     -$(RM) mini_syn$(EXE)
  368.     -$(RM) minicalc$(EXE)
  369.     -$(RM) minicond$(EXE)
  370.     -$(RM) miniloop$(EXE)
  371.     -$(RM) minitree$(EXE)
  372.     -$(RM) mvmasm$(EXE)
  373.     -$(RM) mvmsim$(EXE)
  374.     -$(RM) pretty_c$(EXE)
  375.  
  376.