1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
SRCDIR=../src
GHC=ghc
GHCFLAGS=-i$(SRCDIR)
GHCOPTFLAGS=-O2
.PHONY: all bnfc bnfctest doc docclean clean bnfcclean distclean
all: GHCFLAGS += $(GHCOPTFLAGS)
all:
$(GHC) $(GHCFLAGS) --make -o trci trci.hs
$(GHC) $(GHCFLAGS) --make -o transferc transferc.hs
bnfc: bnfcclean
cd $(SRCDIR) && bnfc -gadt -d -p Transfer Transfer/Core/Core.cf
perl -i -pe 's/^import Transfer.Core.ErrM/import Transfer.ErrM/' $(SRCDIR)/Transfer/Core/*.{hs,x,y}
-rm -f $(SRCDIR)/Transfer/Core/ErrM.hs
cd $(SRCDIR) && alex -g Transfer/Core/Lex.x
cd $(SRCDIR) && happy -gca Transfer/Core/Par.y
cd $(SRCDIR) && bnfc -gadt -d -p Transfer Transfer/Syntax/Syntax.cf
perl -i -pe 's/^import Transfer.Syntax.ErrM/import Transfer.ErrM/' $(SRCDIR)/Transfer/Syntax/*.{hs,x,y}
-rm -f $(SRCDIR)/Transfer/Syntax/ErrM.hs
cd $(SRCDIR) && alex -g Transfer/Syntax/Lex.x
cd $(SRCDIR) && happy -gca Transfer/Syntax/Par.y
bnfctest:
ghc $(GHCFLAGS) --make $(SRCDIR)/Transfer/Core/Test.hs -o test_core
ghc $(GHCFLAGS) --make $(SRCDIR)/Transfer/Syntax/Test.hs -o test_syntax
ghc $(GHCFLAGS) --make $(SRCDIR)/Transfer/Syntax/ResolveLayout.hs -o test_layout
doc:
(cd $(SRCDIR)/Transfer/Core/; latex Doc.tex; dvips Doc.dvi -o Doc.ps)
(cd $(SRCDIR)/Transfer/Syntax/; latex Doc.tex; dvips Doc.dvi -o Doc.ps)
docclean:
-rm -f $(SRCDIR)/Transfer/Core/*.{log,aux,dvi,ps}
-rm -f $(SRCDIR)/Transfer/Syntax/*.{log,aux,dvi,ps}
clean:
-rm -f *.o *.hi
find $(SRCDIR)/Transfer -name '*.o' -o -name '*.hi' | xargs rm -f
-rm -f trci
-rm -f transferc
-rm -f test_core test_syntax test_layout
bnfcclean:
-rm -f $(SRCDIR)/Transfer/Core/{Doc,Lex,Par,Layout,Skel,Print,Test,Abs}.*
-rm -f $(SRCDIR)/Transfer/Syntax/{Doc,Lex,Par,Layout,Skel,Print,Test,Abs}.*
distclean: clean bnfcclean
|