Statistics
| Branch: | Tag: | Revision:

root / Makefile @ 9b1e1cc9

History | View | Annotate | Download (1.8 kB)

1 ef53b4b2 Iustin Pop
HPROGS = hbal hn1 hscan hail
2 ef53b4b2 Iustin Pop
HALLPROGS = $(HPROGS) test
3 968de7fc Iustin Pop
HSRCS := $(wildcard Ganeti/HTools/*.hs)
4 e4f08c46 Iustin Pop
HDDIR = apidoc
5 e4f08c46 Iustin Pop
6 968de7fc Iustin Pop
DOCS = README.html NEWS.html
7 968de7fc Iustin Pop
8 15f4c8ca Iustin Pop
HFLAGS = -O2 -W -fwarn-monomorphism-restriction -fwarn-tabs
9 15f4c8ca Iustin Pop
HEXTRA =
10 15f4c8ca Iustin Pop
11 15f4c8ca Iustin Pop
HPCEXCL = --exclude Main --exclude Ganeti.HTools.QC
12 15f4c8ca Iustin Pop
13 e4f08c46 Iustin Pop
# Haskell rules
14 e4f08c46 Iustin Pop
15 968de7fc Iustin Pop
all: $(HPROGS)
16 669d7e3d Iustin Pop
17 ef53b4b2 Iustin Pop
$(HALLPROGS): %: %.hs Ganeti/HTools/Version.hs $(HSRCS) Makefile
18 15f4c8ca Iustin Pop
	ghc --make $(HFLAGS) $(HEXTRA) $@
19 e4f08c46 Iustin Pop
20 ef53b4b2 Iustin Pop
test: HEXTRA=-fhpc
21 ef53b4b2 Iustin Pop
22 968de7fc Iustin Pop
$(DOCS) : %.html : %
23 e4f08c46 Iustin Pop
	rst2html $< $@
24 e4f08c46 Iustin Pop
25 9188aeef Iustin Pop
doc: $(DOCS) Ganeti/HTools/Version.hs
26 9188aeef Iustin Pop
	rm -rf $(HDDIR)/*
27 968de7fc Iustin Pop
	mkdir -p $(HDDIR)/Ganeti/HTools
28 968de7fc Iustin Pop
	cp hscolour.css $(HDDIR)/Ganeti/HTools
29 e4f08c46 Iustin Pop
	for file in $(HSRCS); do \
30 8b42a5db Iustin Pop
		HsColour -css -anchor \
31 968de7fc Iustin Pop
		$$file > $(HDDIR)/Ganeti/HTools/`basename $$file .hs`.html ; \
32 8b42a5db Iustin Pop
	done
33 e4f08c46 Iustin Pop
	haddock --odir $(HDDIR) --html --ignore-all-exports \
34 9b1e1cc9 Iustin Pop
		-t ganeti-htools -p haddock-prologue \
35 7ae514ba Iustin Pop
		--source-module="%{MODULE/.//}.html" \
36 7ae514ba Iustin Pop
		--source-entity="%{MODULE/.//}.html#%{NAME}" \
37 8b42a5db Iustin Pop
		$(HSRCS)
38 e4f08c46 Iustin Pop
39 cdd0a1dd Iustin Pop
maintainer-clean:
40 425e3906 Iustin Pop
	rm -rf $(HDDIR)
41 cdd0a1dd Iustin Pop
	rm -f $(DOCS) TAGS version Ganeti/HTools/Version.hs
42 cdd0a1dd Iustin Pop
43 cdd0a1dd Iustin Pop
clean:
44 ef53b4b2 Iustin Pop
	rm -f $(HALLPROGS)
45 968de7fc Iustin Pop
	rm -f *.o *.prof *.ps *.stat *.aux *.hi
46 968de7fc Iustin Pop
	cd Ganeti/HTools && rm -f *.o *.prof *.ps *.stat *.aux *.hi
47 e4f08c46 Iustin Pop
48 8b42a5db Iustin Pop
version:
49 8b42a5db Iustin Pop
	git describe > $@
50 8b42a5db Iustin Pop
51 669d7e3d Iustin Pop
Ganeti/HTools/Version.hs: Ganeti/HTools/Version.hs.in version
52 968de7fc Iustin Pop
	sed -e "s/%ver%/$$(cat version)/" < $< > $@
53 669d7e3d Iustin Pop
54 f438b9b3 Iustin Pop
dist: Ganeti/HTools/Version.hs version doc
55 8b42a5db Iustin Pop
	VN=$$(cat version|sed 's/^v//') ; \
56 9b1e1cc9 Iustin Pop
	PFX="ganeti-htools-$$VN" ; \
57 9b1e1cc9 Iustin Pop
	ANAME="$$PFX.tar" ; \
58 669d7e3d Iustin Pop
	rm -f $$ANAME $$ANAME.gz ; \
59 9b1e1cc9 Iustin Pop
	git archive --format=tar --prefix=$$PFX/ HEAD > $$ANAME ; \
60 669d7e3d Iustin Pop
	tar -r -f $$ANAME --owner root --group root \
61 9b1e1cc9 Iustin Pop
	    --transform="s,^,$$PFX/," version apidoc $(DOCS) ; \
62 669d7e3d Iustin Pop
	gzip -v9 $$ANAME ; \
63 669d7e3d Iustin Pop
	tar tzvf $$ANAME.gz
64 8b42a5db Iustin Pop
65 ef53b4b2 Iustin Pop
check: test
66 ef53b4b2 Iustin Pop
	rm -f *.tix *.mix
67 15f4c8ca Iustin Pop
	./test
68 15f4c8ca Iustin Pop
ifeq ($(T),markup)
69 15f4c8ca Iustin Pop
	mkdir -p coverage
70 15f4c8ca Iustin Pop
	hpc markup --destdir=coverage test $(HPCEXCL)
71 15f4c8ca Iustin Pop
else
72 15f4c8ca Iustin Pop
	hpc report test $(HPCEXCL)
73 15f4c8ca Iustin Pop
endif
74 15f4c8ca Iustin Pop
75 15f4c8ca Iustin Pop
.PHONY : all doc maintainer-clean clean dist check