Statistics
| Branch: | Tag: | Revision:

root / Makefile @ 050b0c38

History | View | Annotate | Download (1.4 kB)

1
HPROGS = hbal hn1 hscan
2
HSRCS := $(wildcard Ganeti/HTools/*.hs)
3
HDDIR = apidoc
4

    
5
DOCS = README.html NEWS.html
6

    
7
# Haskell rules
8

    
9
all: $(HPROGS)
10

    
11
$(HPROGS): %: %.hs Ganeti/HTools/Version.hs $(HSRCS) Makefile
12
	ghc --make -O2 -W $@
13

    
14
$(DOCS) : %.html : %
15
	rst2html $< $@
16

    
17
doc: $(DOCS)
18
	rm -rf $(HDDIR)
19
	mkdir -p $(HDDIR)/Ganeti/HTools
20
	cp hscolour.css $(HDDIR)/Ganeti/HTools
21
	for file in $(HSRCS); do \
22
		HsColour -css -anchor \
23
		$$file > $(HDDIR)/Ganeti/HTools/`basename $$file .hs`.html ; \
24
	done
25
	haddock --odir $(HDDIR) --html --ignore-all-exports \
26
		-t htools -p haddock-prologue \
27
		--source-module="%{MODULE/.//}.html" \
28
		--source-entity="%{MODULE/.//}.html#%{NAME}" \
29
		$(HSRCS)
30

    
31
clean:
32
	rm -f $(HPROGS)
33
	rm -f *.o *.prof *.ps *.stat *.aux *.hi
34
	cd Ganeti/HTools && rm -f *.o *.prof *.ps *.stat *.aux *.hi
35
	rm -f $(DOCS) TAGS Ganeti/HTools/Version.hs
36
	git describe >/dev/null 2>&1 && rm -f version || true
37

    
38
version:
39
	git describe > $@
40

    
41
Ganeti/HTools/Version.hs: Ganeti/HTools/Version.hs.in version
42
	sed -e "s/%ver%/$$(cat version)/" < $< > $@
43

    
44
dist: version doc
45
	VN=$$(cat version|sed 's/^v//') ; \
46
	ANAME="htools-$$VN.tar" ; \
47
	rm -f $$ANAME $$ANAME.gz ; \
48
	git archive --format=tar --prefix=htools-$$VN/ HEAD > $$ANAME ; \
49
	tar -r -f $$ANAME --owner root --group root \
50
	    --transform="s,^,htools-$$VN/," version apidoc $(DOCS) ; \
51
	gzip -v9 $$ANAME ; \
52
	tar tzvf $$ANAME.gz
53

    
54
.PHONY : all doc clean dist