-HPROGS = hbal hn1
-HSRCS := $(filter-out $(HPROGS), $(wildcard src/*.hs))
+HPROGS = hbal hn1 hscan
+HSRCS := $(wildcard Ganeti/HTools/*.hs)
HDDIR = apidoc
+DOCS = README.html NEWS.html
+
# Haskell rules
-all: version
- $(MAKE) -C src
+all: $(HPROGS)
+
+$(HPROGS): %: %.hs Ganeti/HTools/Version.hs $(HSRCS) Makefile
+ ghc --make -O2 -W $@
-README.html: README
+$(DOCS) : %.html : %
rst2html $< $@
-doc: README.html
+doc: $(DOCS)
rm -rf $(HDDIR)
- mkdir -p $(HDDIR)/src
- cp hscolour.css $(HDDIR)/src
+ mkdir -p $(HDDIR)/Ganeti/HTools
+ cp hscolour.css $(HDDIR)/Ganeti/HTools
for file in $(HSRCS); do \
HsColour -css -anchor \
- $$file > $(HDDIR)/src/`basename $$file .hs`.html ; \
+ $$file > $(HDDIR)/Ganeti/HTools/`basename $$file .hs`.html ; \
done
haddock --odir $(HDDIR) --html --ignore-all-exports \
-t htools -p haddock-prologue \
- --source-module="src/%{MODULE/.//}.html" \
- --source-entity="src/%{MODULE/.//}.html#%{NAME}" \
+ --source-module="%{MODULE/.//}.html" \
+ --source-entity="%{MODULE/.//}.html#%{NAME}" \
$(HSRCS)
clean:
- rm -f *.o *.cmi *.cmo *.cmx *.old hn1 zn1 *.prof *.ps *.stat *.aux \
- gmon.out *.hi README.html TAGS version
+ 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 > $@
-dist: version
+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" ; \
- git archive --format=tar --prefix=htools-$$VN/ HEAD > $$ANAME ; \
- tar -r -f $$ANAME --transform="s,^,htools-$$VN/," version
-
-.PHONY : all doc clean hn1 dist
+ 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
+
+.PHONY : all doc clean dist