Statistics
| Branch: | Tag: | Revision:

root / Makefile @ 9b1e1cc9

History | View | Annotate | Download (1.8 kB)

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

    
6
DOCS = README.html NEWS.html
7

    
8
HFLAGS = -O2 -W -fwarn-monomorphism-restriction -fwarn-tabs
9
HEXTRA =
10

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

    
13
# Haskell rules
14

    
15
all: $(HPROGS)
16

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

    
20
test: HEXTRA=-fhpc
21

    
22
$(DOCS) : %.html : %
23
	rst2html $< $@
24

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

    
39
maintainer-clean:
40
	rm -rf $(HDDIR)
41
	rm -f $(DOCS) TAGS version Ganeti/HTools/Version.hs
42

    
43
clean:
44
	rm -f $(HALLPROGS)
45
	rm -f *.o *.prof *.ps *.stat *.aux *.hi
46
	cd Ganeti/HTools && rm -f *.o *.prof *.ps *.stat *.aux *.hi
47

    
48
version:
49
	git describe > $@
50

    
51
Ganeti/HTools/Version.hs: Ganeti/HTools/Version.hs.in version
52
	sed -e "s/%ver%/$$(cat version)/" < $< > $@
53

    
54
dist: Ganeti/HTools/Version.hs version doc
55
	VN=$$(cat version|sed 's/^v//') ; \
56
	PFX="ganeti-htools-$$VN" ; \
57
	ANAME="$$PFX.tar" ; \
58
	rm -f $$ANAME $$ANAME.gz ; \
59
	git archive --format=tar --prefix=$$PFX/ HEAD > $$ANAME ; \
60
	tar -r -f $$ANAME --owner root --group root \
61
	    --transform="s,^,$$PFX/," version apidoc $(DOCS) ; \
62
	gzip -v9 $$ANAME ; \
63
	tar tzvf $$ANAME.gz
64

    
65
check: test
66
	rm -f *.tix *.mix
67
	./test
68
ifeq ($(T),markup)
69
	mkdir -p coverage
70
	hpc markup --destdir=coverage test $(HPCEXCL)
71
else
72
	hpc report test $(HPCEXCL)
73
endif
74

    
75
.PHONY : all doc maintainer-clean clean dist check