-
Notifications
You must be signed in to change notification settings - Fork 9
/
Makefile
64 lines (50 loc) · 1.53 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
SRCROOT = $(shell pwd)
CABAL = cabal
FIND = find
HC = ghc
HPC = hpc
HCFLAGS =
CABALFLAGS =
MAIN_SRC = $(foreach d,$(shell $(FIND) src/main/haskell/Network -type d),$(wildcard $(d)/*.hs))
TEST_HOAUTH = dist/bin/test_hoauth
TEST_SRC = $(foreach d,$(shell $(FIND) src/test/haskell/Test/Network -type d),$(wildcard $(d)/*.hs))
.PHONY: default
default: compile
.PHONY: dist
dist:
$(CABAL) configure && $(CABAL) $(CABALFLAGS) sdist
.PHONY: doc
doc:
$(CABAL) configure && $(CABAL) $(CABALFLAGS) haddock
.PHONY: default
default: compile
.PHONY: compile
compile: $(addsuffix .o,$(basename $(MAIN_SRC)))
.PHONY: compile-hpc
compile-hpc: HCFLAGS += -fhpc
compile-hpc: $(addsuffix .o,$(basename $(MAIN_SRC)))
.PHONY: test
test: $(TEST_HOAUTH)
$(TEST_HOAUTH)
.PHONY: test-hpc
test-hpc: compile-hpc $(TEST_HOAUTH)
-@$(TEST_HOAUTH) >/dev/null
$(HPC) markup --destdir=dist/hpc test_hoauth.tix
$(HPC) report test_hoauth.tix
.PHONY: clean
clean:
$(CABAL) clean
$(FIND) src/main/haskell -name \*.o -exec rm -f {} \;
$(FIND) src/main/haskell -name \*.hi -exec rm -f {} \;
$(FIND) src/test/haskell -name \*.o -exec rm -f {} \;
$(FIND) src/test/haskell -name \*.hi -exec rm -f {} \;
rm -f -r dist
rm -f -r *.tix
rm -f -r .hpc
$(TEST_HOAUTH): src/test/haskell/test_hoauth.hs $(MAIN_SRC) $(TEST_SRC)
@[ -d dist ] || mkdir dist
@[ -d dist/bin ] || mkdir dist/bin
$(HC) -o $(@) -isrc/test/haskell -isrc/main/haskell --make $(HCFLAGS) $(<)
.SUFFIXES: .o .hs
.hs.o:
$(HC) -c --make -o $(@) -isrc/main/haskell -isrc/test/haskell $(HCFLAGS) $(<)