1 HPROGS = hbal hscan hail hspace
2 MANS = $(HPROGS:%=man/%.1)
3 MANHTML = $(HPROGS:%=man/%.html)
4 HALLPROGS = $(HPROGS) test
5 HSRCS := $(wildcard Ganeti/HTools/*.hs) $(wildcard Ganeti/*.hs)
9 DOCS = README.html NEWS.html
11 HFLAGS = -O2 -Wall -Werror -fwarn-monomorphism-restriction -fwarn-tabs
14 HPCEXCL = --exclude Main --exclude Ganeti.HTools.QC
20 man: $(MANS) $(MANHTML)
23 $(HALLPROGS): %: %.hs Ganeti/HTools/Version.hs $(HSRCS) Makefile
24 $(GHC) --make $(HFLAGS) $(HEXTRA) $@
26 test live-test: HEXTRA=-fhpc -Wwarn -fno-warn-missing-signatures \
27 -fno-warn-monomorphism-restriction -fno-warn-orphans \
28 -fno-warn-missing-methods -fno-warn-unused-imports
31 LANG=en_US.UTF-8 pandoc -f rst -t html -o $@ $<
34 LANG=en_US.UTF-8 pandoc -s -f rst -t man -o $@ $<
37 LANG=en_US.UTF-8 pandoc -s -f rst -t html -o $@ $<
39 doc: $(DOCS) Ganeti/HTools/Version.hs
41 mkdir -p $(HDDIR)/Ganeti/HTools
42 HsColour -print-css > $(HDDIR)/Ganeti/hscolour.css
43 ln -s ../hscolour.css $(HDDIR)/Ganeti/HTools/hscolour.css
44 for file in $(HSRCS); do \
45 hfile=`echo $$file|sed 's/\\.hs$$//'`.html; \
46 HsColour -css -anchor $$file > $(HDDIR)/$$hfile ; \
48 haddock --odir $(HDDIR) --html --ignore-all-exports \
49 -t ganeti-htools -p haddock-prologue \
50 --source-module="%{MODULE/.//}.html" \
51 --source-entity="%{MODULE/.//}.html#%{NAME}" \
52 $(filter-out Ganeti/HTools/ExtLoader.hs,$(HSRCS))
56 rm -f $(DOCS) TAGS version Ganeti/HTools/Version.hs
60 rm -f *.o *.prof *.ps *.stat *.aux *.hi
61 rm -f Ganeti/HTools/Version.hs
62 cd Ganeti && rm -f *.o *.prof *.ps *.stat *.aux *.hi
63 cd Ganeti/HTools && rm -f *.o *.prof *.ps *.stat *.aux *.hi
70 if test -d .git; then \
72 elif test ! -f $@ ; then \
73 echo "Cannot auto-generate $@ file"; exit 1; \
76 Ganeti/HTools/Version.hs: Ganeti/HTools/Version.hs.in version
77 sed -e "s/%ver%/$$(cat version)/" < $< > $@
79 dist: regen-version Ganeti/HTools/Version.hs doc
81 VN=$$(sed 's/^v//' < version) ; \
82 PFX="ganeti-htools-$$VN" ; \
84 rm -f $$ANAME $$ANAME.gz ; \
85 git archive --format=tar --prefix=$$PFX/ HEAD > $$ANAME ; \
86 tar -r -f $$ANAME --owner root --group root \
87 --transform="s,^,$$PFX/," version apidoc $(DOCS) $(MANS); \
89 TMPDIR=$$(mktemp -d) ; \
90 tar xzf $$ANAME.gz -C $$TMPDIR; \
91 $(MAKE) -C $$TMPDIR/$$PFX; \
92 $(MAKE) -C $$TMPDIR/$$PFX clean; \
93 $(MAKE) -C $$TMPDIR/$$PFX check; \
95 tar tzvf $$ANAME.gz ; \
96 sha1sum $$ANAME.gz ; \
97 echo "Archive $$ANAME.gz created."
104 hpc markup --destdir=coverage test $(HPCEXCL)
106 hpc report test $(HPCEXCL)
112 # combine the tix files
113 hpc sum --union $(HPCEXCL) $(addsuffix .tix,$(HPROGS)) \
114 --output=live-test.tix
117 hpc markup --destdir=coverage live-test $(HPCEXCL)
119 hpc report live-test $(HPCEXCL)
123 find -name '*.hs' | xargs hasktags -e
128 .PHONY : all doc maintainer-clean clean dist check tags regen-version man