Statistics
| Branch: | Tag: | Revision:

root / Makefile @ d78ceb9e

History | View | Annotate | Download (2.9 kB)

1
HPROGS = hbal hscan hail hspace
2
HALLPROGS = $(HPROGS) test
3
HSRCS := $(wildcard Ganeti/HTools/*.hs) $(wildcard Ganeti/*.hs)
4
HDDIR = apidoc
5
GHC := ghc
6

    
7
DOCS = README.html NEWS.html
8

    
9
HFLAGS = -O2 -Wall -Werror -fwarn-monomorphism-restriction -fwarn-tabs
10
HEXTRA =
11

    
12
HPCEXCL = --exclude Main --exclude Ganeti.HTools.QC
13

    
14
# Haskell rules
15

    
16
all: $(HPROGS)
17

    
18
$(HALLPROGS): %: %.hs Ganeti/HTools/Version.hs $(HSRCS) Makefile
19
	$(GHC) --make $(HFLAGS) $(HEXTRA) $@
20

    
21
test live-test: HEXTRA=-fhpc -Wwarn -fno-warn-missing-signatures \
22
	-fno-warn-monomorphism-restriction -fno-warn-orphans \
23
	-fno-warn-missing-methods -fno-warn-unused-imports
24

    
25
$(DOCS) : %.html : %
26
	rst2html -v --strict $< $@
27

    
28
doc: $(DOCS) Ganeti/HTools/Version.hs
29
	rm -rf $(HDDIR)/*
30
	mkdir -p $(HDDIR)/Ganeti/HTools
31
	cp hscolour.css $(HDDIR)/Ganeti/HTools
32
	for file in $(HSRCS); do \
33
		HsColour -css -anchor \
34
		$$file > $(HDDIR)/Ganeti/HTools/`basename $$file .hs`.html ; \
35
	done
36
	haddock --odir $(HDDIR) --html --ignore-all-exports \
37
		-t ganeti-htools -p haddock-prologue \
38
		--source-module="%{MODULE/.//}.html" \
39
		--source-entity="%{MODULE/.//}.html#%{NAME}" \
40
		$(filter-out Ganeti/HTools/ExtLoader.hs,$(HSRCS))
41

    
42
maintainer-clean:
43
	rm -rf $(HDDIR)
44
	rm -f $(DOCS) TAGS version Ganeti/HTools/Version.hs
45

    
46
clean:
47
	rm -f $(HALLPROGS)
48
	rm -f *.o *.prof *.ps *.stat *.aux *.hi
49
	rm -f Ganeti/HTools/Version.hs
50
	cd Ganeti && rm -f *.o *.prof *.ps *.stat *.aux *.hi
51
	cd Ganeti/HTools && rm -f *.o *.prof *.ps *.stat *.aux *.hi
52

    
53
regen-version:
54
	rm -f version
55
	$(MAKE) version
56

    
57
version:
58
	if test -d .git; then \
59
	  git describe > $@; \
60
	elif test ! -f $@ ; then \
61
	  echo "Cannot auto-generate $@ file"; exit 1; \
62
	fi
63

    
64
Ganeti/HTools/Version.hs: Ganeti/HTools/Version.hs.in version
65
	sed -e "s/%ver%/$$(cat version)/" < $< > $@
66

    
67
dist: regen-version Ganeti/HTools/Version.hs doc
68
	set -e ; \
69
	VN=$$(sed 's/^v//' < version) ; \
70
	PFX="ganeti-htools-$$VN" ; \
71
	ANAME="$$PFX.tar" ; \
72
	rm -f $$ANAME $$ANAME.gz ; \
73
	git archive --format=tar --prefix=$$PFX/ HEAD > $$ANAME ; \
74
	tar -r -f $$ANAME --owner root --group root \
75
	    --transform="s,^,$$PFX/," version apidoc $(DOCS) ; \
76
	gzip -v9 $$ANAME ; \
77
	TMPDIR=$$(mktemp -d) ; \
78
	tar xzf $$ANAME.gz -C $$TMPDIR; \
79
	$(MAKE) -C $$TMPDIR/$$PFX; \
80
	$(MAKE) -C $$TMPDIR/$$PFX clean; \
81
	$(MAKE) -C $$TMPDIR/$$PFX check; \
82
	rm -rf $$TMPDIR ; \
83
	tar tzvf $$ANAME.gz ; \
84
	sha1sum $$ANAME.gz ; \
85
	echo "Archive $$ANAME.gz created."
86

    
87
check: test
88
	rm -f *.tix *.mix
89
	./test
90
ifeq ($(T),markup)
91
	mkdir -p coverage
92
	hpc markup --destdir=coverage test $(HPCEXCL)
93
else
94
	hpc report test $(HPCEXCL)
95
endif
96

    
97
live-test: all
98
	rm -f *.tix *.mix
99
	./live-test.sh
100
	# combine the tix files
101
	hpc sum --union $(HPCEXCL) $(addsuffix .tix,$(HPROGS)) \
102
	  --output=live-test.tix
103
ifeq ($(T),markup)
104
	mkdir -p coverage
105
	hpc markup --destdir=coverage live-test $(HPCEXCL)
106
else
107
	hpc report live-test $(HPCEXCL)
108
endif
109

    
110
tags:
111
	find -name '*.hs' | xargs hasktags -e
112

    
113
lint:
114
	hlint -r -u .
115

    
116
.PHONY : all doc maintainer-clean clean dist check tags regen-version