annotate lab1/Makefile @ 1:b5139af1a420 tip basis

Fixed permissions on compile scripts
author Mike Spivey <mike@cs.ox.ac.uk>
date Fri, 13 Oct 2017 17:27:58 +0100
parents bfdcc3820b32
children
rev   line source
0
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
1 # lab1/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 repeat loop case
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 tree.cmo parser.cmo peepopt.cmo kgen.cmo main.cmo
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
9 ocamlc ../lib/common.cma $^ -o $@
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
10
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
11 parser.mli parser.ml: parser.mly
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
12 ocamlyacc -v parser.mly
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
13
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
14 lexer.ml: lexer.mll
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
15 ocamllex lexer.mll
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
16
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
17 tree.cmo: MLFLAGS += -w u
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
18
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
19 KEIKO = ../keiko
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
20
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
21 test : force
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
22 $(MAKE) $(TEST:%=test-%)
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
23
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
24 test-%: force
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
25 @echo "*** Test $*.p"
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
26 ./ppc $*.p >a.k
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
27 $(KEIKO)/pplink -nostdlib $(KEIKO)/lib.k a.k -o a.x >/dev/null
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
28 $(KEIKO)/ppx ./a.x >a.test
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
29 sed -n -e '1,/^(\*<</d' -e '/^>>\*)/q' -e p $*.p | diff - a.test
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
30 @echo "*** Passed"; echo
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
31
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
32 realclean: clean
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
33
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
34 clean: force
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
35 rm -f ppc *.cma *.cmo *.cmi
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
36 rm -f parser.mli parser.ml lexer.ml parser.output
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
37 rm -f a.k a.out a.x a.test
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
38
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
39 ML = keiko.ml keiko.mli kgen.ml kgen.mli lexer.mli \
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
40 lexer.ml main.ml parser.mli parser.ml tree.ml tree.mli \
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
41 peepopt.mli peepopt.ml
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
42
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
43 depend : $(ML) force
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
44 (sed '/^###/q' Makefile; echo; ocamldep $(ML)) >new
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
45 mv new Makefile
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
46
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
47 %.cmi : %.mli
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
48 ocamlc $(MLFLAGS) -c $<
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
49
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
50 %.cmo : %.ml
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
51 ocamlc $(MLFLAGS) -c $<
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
52
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
53 force:
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
54
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
55 MLFLAGS = -I ../lib
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
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
59 keiko.cmo : tree.cmi keiko.cmi
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
60 keiko.cmx : tree.cmx keiko.cmi
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
61 keiko.cmi :
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
62 kgen.cmo : tree.cmi peepopt.cmi keiko.cmi kgen.cmi
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
63 kgen.cmx : tree.cmx peepopt.cmx keiko.cmx kgen.cmi
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
64 kgen.cmi : tree.cmi
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
65 lexer.cmo : tree.cmi parser.cmi keiko.cmi lexer.cmi
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
66 lexer.cmx : tree.cmx parser.cmx keiko.cmx lexer.cmi
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
67 lexer.cmi : tree.cmi parser.cmi
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
68 main.cmo : tree.cmi parser.cmi lexer.cmi kgen.cmi
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
69 main.cmx : tree.cmx parser.cmx lexer.cmx kgen.cmx
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
70 parser.cmo : tree.cmi lexer.cmi keiko.cmi parser.cmi
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
71 parser.cmx : tree.cmx lexer.cmx keiko.cmx parser.cmi
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
72 parser.cmi : tree.cmi keiko.cmi
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
73 peepopt.cmo : keiko.cmi peepopt.cmi
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
74 peepopt.cmx : keiko.cmx peepopt.cmi
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
75 peepopt.cmi : keiko.cmi
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
76 tree.cmo : keiko.cmi tree.cmi
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
77 tree.cmx : keiko.cmx tree.cmi
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
78 tree.cmi : keiko.cmi