annotate lab2/Makefile @ 0:bfdcc3820b32

Basis
author Mike Spivey <mike@cs.ox.ac.uk>
date Thu, 05 Oct 2017 08:04:15 +0100
parents
children
rev   line source
0
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
1 # lab2/Makefile
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
2
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
3 ## Add your own test cases to this list
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
4 TEST = gcd array pascal binary
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
5
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
6 all: ppc
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
7
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
8 ppc: keiko.cmo lexer.cmo dict.cmo tree.cmo parser.cmo check.cmo \
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
9 peepopt.cmo kgen.cmo main.cmo
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
10 ocamlc ../lib/common.cma $^ -o $@
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
11
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
12 parser.mli parser.ml: parser.mly
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
13 ocamlyacc parser.mly
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
14
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
15 lexer.ml: lexer.mll
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
16 ocamllex lexer.mll
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
17
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
18 KEIKO = ../keiko
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
19
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
20 test: force
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
21 $(MAKE) $(TEST:%=test-%)
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
22
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
23 test-%: force
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
24 @echo "*** Test $*.p"
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
25 ./ppc $*.p >a.k
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
26 $(KEIKO)/pplink -nostdlib $(KEIKO)/lib.k a.k -o a.x >/dev/null
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
27 -$(KEIKO)/ppx ./a.x >a.test 2>&1
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
28 sed -n -e '1,/^(\*<</d' -e '/^>>\*)/q' -e p $*.p | diff - a.test
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
29 @echo "*** Passed"; echo
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
30
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
31 realclean: clean
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
32
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
33 clean: force
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
34 rm -f ppc ppx ppxj *.cma *.cmo *.cmi *.o
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
35 rm -f parser.mli parser.ml lexer.ml
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
36 rm -f a.k a.out a.x a.test
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
37
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
38 ML = check.ml check.mli dict.ml dict.mli keiko.ml keiko.mli kgen.ml \
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
39 kgen.mli lexer.ml lexer.mli main.ml parser.ml \
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
40 parser.mli tree.ml tree.mli peepopt.mli peepopt.ml
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
41
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
42 depend : $(ML) force
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
43 (sed '/^###/q' Makefile; echo; ocamldep $(ML)) >new
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
44 mv new Makefile
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
45
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
46 %.cmi : %.mli
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
47 ocamlc $(MLFLAGS) -c $<
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
48
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
49 %.cmo : %.ml
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
50 ocamlc $(MLFLAGS) -c $<
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
51
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
52 force:
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
53
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
54 MLFLAGS = -I ../lib
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
55
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
56 ###
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
57
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
58 check.cmo : tree.cmi keiko.cmi dict.cmi check.cmi
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
59 check.cmx : tree.cmx keiko.cmx dict.cmx check.cmi
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
60 check.cmi : tree.cmi
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
61 dict.cmo : dict.cmi
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
62 dict.cmx : dict.cmi
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
63 dict.cmi :
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
64 keiko.cmo : tree.cmi keiko.cmi
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
65 keiko.cmx : tree.cmx keiko.cmi
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
66 keiko.cmi :
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
67 kgen.cmo : tree.cmi peepopt.cmi keiko.cmi dict.cmi kgen.cmi
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
68 kgen.cmx : tree.cmx peepopt.cmx keiko.cmx dict.cmx kgen.cmi
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
69 kgen.cmi : tree.cmi
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
70 lexer.cmo : tree.cmi parser.cmi keiko.cmi lexer.cmi
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
71 lexer.cmx : tree.cmx parser.cmx keiko.cmx lexer.cmi
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
72 lexer.cmi : parser.cmi
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
73 main.cmo : tree.cmi parser.cmi lexer.cmi kgen.cmi dict.cmi check.cmi
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
74 main.cmx : tree.cmx parser.cmx lexer.cmx kgen.cmx dict.cmx check.cmx
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
75 parser.cmo : tree.cmi lexer.cmi keiko.cmi dict.cmi parser.cmi
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
76 parser.cmx : tree.cmx lexer.cmx keiko.cmx dict.cmx parser.cmi
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
77 parser.cmi : tree.cmi keiko.cmi dict.cmi
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
78 peepopt.cmo : keiko.cmi peepopt.cmi
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
79 peepopt.cmx : keiko.cmx peepopt.cmi
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
80 peepopt.cmi : keiko.cmi
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
81 tree.cmo : keiko.cmi dict.cmi tree.cmi
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
82 tree.cmx : keiko.cmx dict.cmx tree.cmi
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
83 tree.cmi : keiko.cmi dict.cmi