-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
110 lines (93 loc) · 3.54 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
# Root location of the Curry System specified by variable CURRYROOT
CURRYROOT := $(shell curry --nocypm :set v0 :set -time :add Curry.Compiler.Distribution :eval "putStrLn installDir" :quit)
# Curry system binary:
export CURRY = $(CURRYROOT)/bin/curry
# The tool name of the application:
TOOL = $(HOME)/.cpm/bin/cypm
# The compiler name (e.g., pakcs or kics2):
CURRYCOMPILER := $(shell $(CURRY) --compiler-name)
# Executable of CurryPP (for generating CPM.Repository.Select):
CURRYPP := $(shell which currypp)
# Executable of CurryCheck (for testing):
CURRYCHECK := $(shell which curry-check)
# The default options for the REPL (options "rts -T" required for KiCS2
# in order to get elapsed times):
ifeq ($(CURRYCOMPILER),kics2)
export REPL_OPTS = --noreadline :set -time :set rts -T
else
export REPL_OPTS = --noreadline :set -time
endif
# Source modules of CPM:
DEPS = src/CPM/*.curry src/CPM/*/*.curry src/CPM/Repository/Select.curry
.PHONY: build
build: fetchdeps src/CPM/ConfigPackage.curry $(DEPS)
@echo Root location of Curry system: $(CURRYROOT)
@if [ ! -d "$(CURRYROOT)" ] ; then echo "Error: not a valid directory!" ; exit 1; fi
@export CURRYPATH=""; \
for i in `ls vendor`; do \
export CURRYPATH="$$CURRYPATH:`pwd`/vendor/$$i/src"; \
done; \
echo "Set CURRYPATH to $$CURRYPATH"; \
cd src && $(CURRY) --nocypm $(REPL_OPTS) :l CPM.Main :save :quit
mkdir -p $(dir $(TOOL))
rm -f $(TOOL)
cd $(dir $(TOOL)) && ln -s $(CURDIR)/src/CPM.Main $(notdir $(TOOL))
@echo Tool installed into: $(TOOL)
@echo Please add \"$(dir $(TOOL))\" to your path!
# Create the ConfigPackage (which is usually created by `cypm install`)
src/CPM/ConfigPackage.curry: Makefile
@echo "module CPM.ConfigPackage where" > $@
@echo "packagePath :: String" >> $@
@echo "packagePath = \"$(CURDIR)\"" >> $@
@echo "packageVersion :: String" >> $@
@echo "packageVersion = \"3.3.0\"" >> $@
@echo "Curry configuration module '$@' written."
# Generate pure Curry module CPM.Repository.Select with CurryPP:
src/CPM/Repository/Select.curry: src/CPM/Repository/Select.curry.pp
ifeq ($(CURRYPP),)
touch $@ # do not make since 'currypp' is missing
else
rm -f $@ && cd src/CPM/Repository && ln -s Select.curry.pp Select.curry
cd src && $(CURRY) $(REPL_OPTS) :load CPM.Repository.Select :quit
rm $@ && mv src/CPM/Repository/Select.curry.CURRYPP $@
endif
.PHONY: buildperf
buildperf: fetchdeps
@export CURRYPATH=""; \
for i in `ls vendor`; do \
export CURRYPATH="$$CURRYPATH:`pwd`/vendor/$$i/src"; \
done; \
echo "Set CURRYPATH to $$CURRYPATH"; \
cd src && $(CURRY) $(REPL_OPTS) :l CPM.PerformanceTest :save :quit
.PHONY: clean
clean:
rm -Rf vendor
rm -Rf src/.curry
.PHONY: fetchdeps
fetchdeps:
./fetch-dependencies.sh
.PHONY: test
test: fetchdeps
@export CURRYPATH=""; \
for i in `ls vendor`; do \
export CURRYPATH="$$CURRYPATH:`pwd`/vendor/$$i/src"; \
done; \
if [ ! -x "$(CURRYCHECK)" ] ; then \
echo "Executable 'curry-check' is not installed!" && echo "To run the tests, install it by > cypm install currycheck" ; \
else \
cd src && $(CURRYCHECK) CPM.Package CPM.Resolution CPM.LookupSet ; fi
.PHONY: doc
doc: fetchdeps
@export CURRYPATH=""; \
for i in `ls vendor`; do \
export CURRYPATH="$$CURRYPATH:`pwd`/vendor/$$i/src"; \
done; \
export CURRYPATH="$$CURRYPATH:`pwd`/src"; \
$(CURRY) doc cdoc CPM.Main
.PHONY: cloc
cloc:
cloc --force-lang=Haskell,curry --exclude-ext=hs --exclude-lang=HTML,CSS \
--not-match-f='PUBLIC' --by-file src/CPM
.PHONY: manual
manual:
pdflatex -output-directory=docs docs/manual.tex