-
Notifications
You must be signed in to change notification settings - Fork 4
/
Makefile
93 lines (83 loc) · 4.09 KB
/
Makefile
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
STYLES=latex backtickfence tildefence orgmode jekyll orgmode markdown asciidoc
all: src/Unlit/String.hs README.md
test: test/ghcunlit
runhaskell test/TestUnlit.hs
make roundtrip
roundtrip:
unlit -l haskell -i src/Unlit/Text.lhs -o test/roundtrip.unlit || exit 1
@for i in $(STYLES); do \
echo "$$i"; \
unlit -t $$i -l haskell -i src/Unlit/Text.lhs -o test/roundtrip.1 || exit 1; \
unlit -i test/roundtrip.1 -o test/roundtrip.2 || exit 1; \
diff test/roundtrip.2 test/roundtrip.unlit || exit 1; \
unlit -f $$i -t bird -i test/roundtrip.1 -o test/roundtrip.2 || exit 1; \
diff test/roundtrip.2 src/Unlit/Text.lhs || exit 1; \
for j in $(STYLES); do \
echo " <-> $$j"; \
unlit -f $$i -t $$j -i test/roundtrip.1 -o test/roundtrip.2 || exit 1; \
unlit -f $$j -t $$i -i test/roundtrip.2 -o test/roundtrip.3 || exit 1; \
diff test/roundtrip.1 test/roundtrip.3 || exit 1; \
done; \
echo "$$i inferred"; \
unlit -t $$i -l haskell -i src/Unlit/Text.lhs -o test/roundtrip.1 || exit 1; \
unlit -t bird -i test/roundtrip.1 -o test/roundtrip.2 || exit 1; \
diff test/roundtrip.2 src/Unlit/Text.lhs || exit 1; \
for j in $(STYLES); do \
echo " <-> $$j"; \
unlit -t $$j -i test/roundtrip.1 -o test/roundtrip.2 || exit 1; \
unlit -t $$i -i test/roundtrip.2 -o test/roundtrip.3 || exit 1; \
diff test/roundtrip.1 test/roundtrip.3 || exit 1; \
done; \
echo "$$i without empty lines"; \
sed '/^\s*$$/d' src/Unlit/Text.lhs > test/roundtrip.0; \
unlit -t $$i -l haskell -i test/roundtrip.0 -o test/roundtrip.1 || exit 1; \
unlit -f $$i -t bird -i test/roundtrip.1 -o test/roundtrip.2 || exit 1; \
diff test/roundtrip.2 test/roundtrip.0 || exit 1; \
for j in $(STYLES); do \
echo " <-> $$j"; \
unlit -f $$i -t $$j -i test/roundtrip.1 -o test/roundtrip.2 || exit 1; \
unlit -f $$j -t $$i -i test/roundtrip.2 -o test/roundtrip.3 || exit 1; \
diff test/roundtrip.1 test/roundtrip.3 || exit 1; \
done; \
echo "$$i inferred without empty lines"; \
sed '/^\s*$$/d' src/Unlit/Text.lhs > test/roundtrip.0; \
unlit -t $$i -l haskell -i test/roundtrip.0 -o test/roundtrip.1 || exit 1; \
unlit -t bird -i test/roundtrip.1 -o test/roundtrip.2 || exit 1; \
diff test/roundtrip.2 test/roundtrip.0 || exit 1; \
for j in $(STYLES); do \
echo " <-> $$j"; \
unlit -t $$j -i test/roundtrip.1 -o test/roundtrip.2 || exit 1; \
unlit -t $$i -i test/roundtrip.2 -o test/roundtrip.3 || exit 1; \
diff test/roundtrip.1 test/roundtrip.3 || exit 1; \
done \
done
test/ghcunlit: test/ghcunlit.c
gcc -O2 -o test/ghcunlit test/ghcunlit.c
dist: src/Main.hs src/Unlit/Text.lhs src/Unlit/String.hs
cabal configure
cabal sdist
build: src/Main.hs src/Unlit/Text.lhs src/Unlit/String.hs
cabal configure
cabal build
install: src/Main.hs src/Unlit/Text.lhs src/Unlit/String.hs
cabal configure
cabal install
README.md: Makefile src/Unlit/Text.lhs
cat src/Unlit/Text.lhs \
| unlit --language haskell -t backtickfence -l haskell \
| sed '1i [![Build Status](https://travis-ci.org/wenkokke/unlit.png?branch=master)](https://travis-ci.org/wenkokke/unlit)' \
> README.md
src/Unlit/String.hs: Makefile src/Unlit/Text.lhs
cat src/Unlit/Text.lhs \
| unlit -f bird \
| sed '1d;2d;17d;18d' \
| sed 's/Text/String/g;s/pack//g' \
| sed '15i import Prelude hiding \(all, or\)' \
| sed '16i import Data.List \(isPrefixOf, isInfixOf, isSuffixOf, dropWhileEnd\)' \
| sed '17i import qualified Data.Char as Char\n' \
| sed '19i stripStart, stripEnd, toLower :: String -> String' \
| sed '20i stripStart = dropWhile Char.isSpace' \
| sed '21i stripEnd = dropWhileEnd Char.isSpace' \
| sed '22i toLower = map Char.toLower' \
> src/Unlit/String.hs
.PHONY: test roundtrip dist build install