-HPROGS = hbal hn1
+HPROGS = hbal hn1 hscan hail test
HSRCS := $(wildcard Ganeti/HTools/*.hs)
HDDIR = apidoc
DOCS = README.html NEWS.html
+HFLAGS = -O2 -W -fwarn-monomorphism-restriction -fwarn-tabs
+HEXTRA =
+
+HPCEXCL = --exclude Main --exclude Ganeti.HTools.QC
+
# Haskell rules
all: $(HPROGS)
-hn1 hbal: Ganeti/HTools/Version.hs
- ghc --make -O2 -W $@
+$(HPROGS): %: %.hs Ganeti/HTools/Version.hs $(HSRCS) Makefile
+ ghc --make $(HFLAGS) $(HEXTRA) $@
$(DOCS) : %.html : %
rst2html $< $@
--source-entity="%{MODULE/.//}.html#%{NAME}" \
$(HSRCS)
+maintainer-clean:
+ rm -rf $(HDDIR)
+ rm -f $(DOCS) TAGS version Ganeti/HTools/Version.hs
+
clean:
- rm -f hbal hn1
+ rm -f $(HPROGS)
rm -f *.o *.prof *.ps *.stat *.aux *.hi
cd Ganeti/HTools && rm -f *.o *.prof *.ps *.stat *.aux *.hi
- rm -f $(DOCS) TAGS Ganeti/HTools/Version.hs
- git describe >/dev/null 2>&1 && rm -f version || true
version:
git describe > $@
Ganeti/HTools/Version.hs: Ganeti/HTools/Version.hs.in version
sed -e "s/%ver%/$$(cat version)/" < $< > $@
-dist: version doc
+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 ; \
+ --transform="s,^,htools-$$VN/," version apidoc $(DOCS) ; \
gzip -v9 $$ANAME ; \
tar tzvf $$ANAME.gz
-.PHONY : all doc clean dist
+check:
+ rm -f *.tix *.mix test
+ $(MAKE) HEXTRA=-fhpc test
+ ./test
+ifeq ($(T),markup)
+ mkdir -p coverage
+ hpc markup --destdir=coverage test $(HPCEXCL)
+else
+ hpc report test $(HPCEXCL)
+endif
+
+.PHONY : all doc maintainer-clean clean dist check