Statistics
| Branch: | Tag: | Revision:

root / Makefile @ 0d0503b2

History | View | Annotate | Download (2.4 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
	set -e ; \
66
	VN=$$(cat version|sed 's/^v//') ; \
67
	PFX="ganeti-htools-$$VN" ; \
68
	ANAME="$$PFX.tar" ; \
69
	rm -f $$ANAME $$ANAME.gz ; \
70
	git archive --format=tar --prefix=$$PFX/ HEAD > $$ANAME ; \
71
	tar -r -f $$ANAME --owner root --group root \
72
	    --transform="s,^,$$PFX/," version apidoc $(DOCS) ; \
73
	gzip -v9 $$ANAME ; \
74
	TMPDIR=$$(mktemp -d) ; \
75
	tar xzf $$ANAME.gz -C $$TMPDIR; \
76
	(cd $$TMPDIR/$$PFX; make; make clean; make check); \
77
	rm -rf $$TMPDIR ; \
78
	tar tzvf $$ANAME.gz ; \
79
	sha1sum $$ANAME.gz ; \
80
	echo "Archive $$ANAME.gz created."
81

    
82
check: test
83
	rm -f *.tix *.mix
84
	./test
85
ifeq ($(T),markup)
86
	mkdir -p coverage
87
	hpc markup --destdir=coverage test $(HPCEXCL)
88
else
89
	hpc report test $(HPCEXCL)
90
endif
91

    
92
tags:
93
	find -name '*.hs' | xargs hasktags -e
94

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