forked from ideas-edu/ideas
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
119 lines (88 loc) · 3.69 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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
default: ideas
all: ideas haddock hlint sdist
#---------------------------------------------------------------------------------------
# Applications, directories
CABAL = cabal
GHC = ghc
GHCI = ghci
HADDOCK = haddock
HLINT = hlint
RM = rm
GIT = git
GHCWARN = -Wall -fwarn-tabs
SRCDIR = src
OUTDIR = out
DOCSDIR = docs
HADDOCKDIR = $(DOCSDIR)/haddock
HS-SOURCES = $(wildcard $(SRCDIR)/*/*.hs $(SRCDIR)/*/*/*.hs $(SRCDIR)/*/*/*/*.hs $(SRCDIR)/*/*/*/*/*.hs)
#---------------------------------------------------------------------------------------
# GHC
ghci: revision
$(GHCI) -i$(SRCDIR) -odir $(OUTDIR) -hidir $(OUTDIR) $(GHCWARN)
ideas: revision
$(GHC) -i$(SRCDIR) -odir $(OUTDIR) -hidir $(OUTDIR) $(GHCWARN) $(HS-SOURCES) 2>&1 | tee $(DOCSDIR)/compile.txt
#---------------------------------------------------------------------------------------
# Version information
revision: $(SRCDIR)/Ideas/Main/Revision.hs
$(SRCDIR)/Ideas/Main/Revision.hs:
$(GIT) pull || true
# Updating $@
@echo "-- Automatically generated by Makefile. Do not change." > $@
@echo "module Ideas.Main.Revision where" >> $@
@echo "" >> $@
@echo "ideasVersion :: String" >> $@
@grep '^version' ideas.cabal | sed 's/version: *\(.*\)/ideasVersion = "\1"/' >> $@
@echo "" >> $@
$(GIT) log -1 --pretty=format:'ideasRevision :: String%nideasRevision = "%H"%n%nideasLastChanged :: String%nideasLastChanged = "%cd"%n' >> $@
.PHONY: $(SRCDIR)/Ideas/Main/Revision.hs
#---------------------------------------------------------------------------------------
# Documentation
haddock:
$(HADDOCK) --html -o $(HADDOCKDIR) --prologue=$(DOCSDIR)/prologue --title="Ideas: feedback services for intelligent tutoring systems" $(HS-SOURCES)
hlint:
$(HLINT) --report=$(DOCSDIR)/hlint.html $(HS-SOURCES)
exit 0
#---------------------------------------------------------------------------------------
# Cabal targets
configure: revision
$(CABAL) configure
build: revision
$(CABAL) build
install: revision
$(CABAL) install
sdist: configure
$(CABAL) sdist
#---------------------------------------------------------------------------------------
# Cleaning up
clean:
$(CABAL) clean
$(RM) -rf out
$(RM) -rf $(DOCSDIR)/hlint.html
$(RM) -rf $(DOCSDIR)/compile.txt
$(RM) -rf $(HADDOCKDIR)
#---------------------------------------------------------------------------------------
# Misc
nolicense:
find src -name \*.hs -print0 | xargs --null grep -L "LICENSE"
layered:
@grep -R import src/Ideas/Utils | grep "Ideas.Common" || true
@grep -R import src/Ideas/Utils | grep "Ideas.Encoding" || true
@grep -R import src/Ideas/Utils | grep "Ideas.Main" || true
@grep -R import src/Ideas/Utils | grep "Ideas.Service" || true
@grep -R import src/Ideas/Utils | grep "Ideas.Text" || true
@grep -R import src/Ideas/Text | grep "Ideas.Common" || true
@grep -R import src/Ideas/Text | grep "Ideas.Encoding" || true
@grep -R import src/Ideas/Text | grep "Ideas.Main" || true
@grep -R import src/Ideas/Text | grep "Ideas.Service" || true
@grep -R import src/Ideas/Common | grep "Ideas.Text" || true
@grep -R import src/Ideas/Common | grep "Ideas.Encoding" || true
@grep -R import src/Ideas/Common | grep "Ideas.Main" || true
@grep -R import src/Ideas/Common | grep "Ideas.Service" || true
@grep -R import src/Ideas/Service | grep "Ideas.Text" || true
@grep -R import src/Ideas/Service | grep "Ideas.Encoding" || true
@grep -R import src/Ideas/Service | grep "Ideas.Main" || true
@grep -R import src/Ideas/Encoding | grep "Ideas.Main" || true
@grep -R import src/Ideas/Main | grep "Ideas.Text" || true
@grep -R import src/Ideas/Main | grep "Ideas.Common" || true
noid:
find src -name \*.hs -print0 | xargs --null grep -L '$$Id'