Fix/enhance makefile rules after the rename
authorIustin Pop <iustin@google.com>
Fri, 20 Mar 2009 18:26:10 +0000 (19:26 +0100)
committerIustin Pop <iustin@google.com>
Fri, 20 Mar 2009 18:28:51 +0000 (19:28 +0100)
Makefile

index 9f1f383..cf7a064 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,43 +1,47 @@
 HPROGS = hbal hn1
-HSRCS := $(filter-out $(HPROGS), $(wildcard src/*.hs))
+HSRCS := $(wildcard Ganeti/HTools/*.hs)
 HDDIR = apidoc
 
+DOCS = README.html NEWS.html
+
 # Haskell rules
 
-all: hbal hn1
+all: $(HPROGS)
 
 hn1 hbal: Ganeti/HTools/Version.hs
        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="Ganeti/HTools/%{MODULE/.//}.html" \
+               --source-entity="Ganeti/HTools/%{MODULE/.//}.html#%{NAME}" \
                $(HSRCS)
 
 clean:
-       rm -f *.o hn1 zn1 *.prof *.ps *.stat *.aux \
-           gmon.out *.hi README.html TAGS Ganeti/HTools/Version.hs
-       git describe >/dev/null && rm -f version
+       rm -f hbal hn1
+       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)/" < $< > $@
+       sed -e "s/%ver%/$$(cat version)/" < $< > $@
 
-dist: version
+dist: version doc
        VN=$$(cat version|sed 's/^v//') ; \
        ANAME="htools-$$VN.tar" ; \
        rm -f $$ANAME $$ANAME.gz ; \
@@ -47,4 +51,4 @@ dist: version
        gzip -v9 $$ANAME ; \
        tar tzvf $$ANAME.gz
 
-.PHONY : all doc clean hn1 dist
+.PHONY : all doc clean dist