Statistics
| Branch: | Tag: | Revision:

root / Makefile @ 1901266d

History | View | Annotate | Download (2.2 kB)

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

    
6
DOCS = README.html NEWS.html
7

    
8
HFLAGS = -O2 -Wall -Werror -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 -Wwarn
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
		$(filter-out Ganeti/HTools/ExtLoader.hs,$(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
	rm -f Ganeti/HTools/Version.hs
47
	cd Ganeti && rm -f *.o *.prof *.ps *.stat *.aux *.hi
48
	cd Ganeti/HTools && rm -f *.o *.prof *.ps *.stat *.aux *.hi
49

    
50
regen-version:
51
	rm -f version
52
	$(MAKE) version
53

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

    
61
Ganeti/HTools/Version.hs: Ganeti/HTools/Version.hs.in version
62
	sed -e "s/%ver%/$$(cat version)/" < $< > $@
63

    
64
dist: regen-version Ganeti/HTools/Version.hs doc
65
	VN=$$(cat version|sed 's/^v//') ; \
66
	PFX="ganeti-htools-$$VN" ; \
67
	ANAME="$$PFX.tar" ; \
68
	rm -f $$ANAME $$ANAME.gz ; \
69
	git archive --format=tar --prefix=$$PFX/ HEAD > $$ANAME ; \
70
	tar -r -f $$ANAME --owner root --group root \
71
	    --transform="s,^,$$PFX/," version apidoc $(DOCS) ; \
72
	gzip -v9 $$ANAME ; \
73
	tar tzvf $$ANAME.gz
74

    
75
check: test
76
	rm -f *.tix *.mix
77
	./test
78
ifeq ($(T),markup)
79
	mkdir -p coverage
80
	hpc markup --destdir=coverage test $(HPCEXCL)
81
else
82
	hpc report test $(HPCEXCL)
83
endif
84

    
85
tags:
86
	find -name '*.hs' | xargs hasktags -e
87

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