- rm -f *.o *.cmi *.cmo *.cmx *.old hn1 zn1 *.prof *.ps *.stat *.aux \
- gmon.out *.hi README.html TAGS
+ rm -f $(HALLPROGS)
+ rm -f *.o *.prof *.ps *.stat *.aux *.hi
+ cd Ganeti/HTools && rm -f *.o *.prof *.ps *.stat *.aux *.hi
+
+version:
+ git describe > $@
+
+Ganeti/HTools/Version.hs: Ganeti/HTools/Version.hs.in version
+ sed -e "s/%ver%/$$(cat version)/" < $< > $@
+
+dist: Ganeti/HTools/Version.hs version doc
+ VN=$$(cat version|sed 's/^v//') ; \
+ ANAME="htools-$$VN.tar" ; \
+ rm -f $$ANAME $$ANAME.gz ; \
+ git archive --format=tar --prefix=htools-$$VN/ HEAD > $$ANAME ; \
+ tar -r -f $$ANAME --owner root --group root \
+ --transform="s,^,htools-$$VN/," version apidoc $(DOCS) ; \
+ gzip -v9 $$ANAME ; \
+ tar tzvf $$ANAME.gz
+
+check: test
+ rm -f *.tix *.mix
+ ./test
+ifeq ($(T),markup)
+ mkdir -p coverage
+ hpc markup --destdir=coverage test $(HPCEXCL)
+else
+ hpc report test $(HPCEXCL)
+endif