Statistics
| Branch: | Tag: | Revision:

root / Makefile @ 425e3906

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 -rf $(HDDIR)
33
	rm -f $(HPROGS)
34
	rm -f *.o *.prof *.ps *.stat *.aux *.hi
35
	cd Ganeti/HTools && rm -f *.o *.prof *.ps *.stat *.aux *.hi
36
	rm -f $(DOCS) TAGS Ganeti/HTools/Version.hs
37
	git describe >/dev/null 2>&1 && rm -f version || true
38

    
39
version:
40
	git describe > $@
41

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

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

    
55
.PHONY : all doc clean dist