Statistics
| Branch: | Tag: | Revision:

root / Makefile @ 0d0503b2

History | View | Annotate | Download (2.4 kB)

1 266aea94 Iustin Pop
HPROGS = hbal hscan hail hspace
2 ef53b4b2 Iustin Pop
HALLPROGS = $(HPROGS) test
3 6583e677 Iustin Pop
HSRCS := $(wildcard Ganeti/HTools/*.hs) $(wildcard Ganeti/*.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 fbb95f28 Iustin Pop
HFLAGS = -O2 -Wall -Werror -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 fbb95f28 Iustin Pop
test: HEXTRA=-fhpc -Wwarn
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 cf924b6d Iustin Pop
		$(filter-out Ganeti/HTools/ExtLoader.hs,$(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 1901266d Iustin Pop
	rm -f Ganeti/HTools/Version.hs
47 6583e677 Iustin Pop
	cd Ganeti && rm -f *.o *.prof *.ps *.stat *.aux *.hi
48 968de7fc Iustin Pop
	cd Ganeti/HTools && rm -f *.o *.prof *.ps *.stat *.aux *.hi
49 e4f08c46 Iustin Pop
50 f6c68f9d Iustin Pop
regen-version:
51 f6c68f9d Iustin Pop
	rm -f version
52 f6c68f9d Iustin Pop
	$(MAKE) version
53 f6c68f9d Iustin Pop
54 8b42a5db Iustin Pop
version:
55 ca2843dc Guido Trotter
	if test -d .git; then \
56 f6c68f9d Iustin Pop
	  git describe > $@; \
57 ca2843dc Guido Trotter
	elif test ! -f $@ ; then \
58 ca2843dc Guido Trotter
	  echo "Cannot auto-generate $@ file"; exit 1; \
59 ca2843dc Guido Trotter
	fi
60 8b42a5db Iustin Pop
61 669d7e3d Iustin Pop
Ganeti/HTools/Version.hs: Ganeti/HTools/Version.hs.in version
62 968de7fc Iustin Pop
	sed -e "s/%ver%/$$(cat version)/" < $< > $@
63 669d7e3d Iustin Pop
64 f6c68f9d Iustin Pop
dist: regen-version Ganeti/HTools/Version.hs doc
65 0d0503b2 Iustin Pop
	set -e ; \
66 8b42a5db Iustin Pop
	VN=$$(cat version|sed 's/^v//') ; \
67 9b1e1cc9 Iustin Pop
	PFX="ganeti-htools-$$VN" ; \
68 9b1e1cc9 Iustin Pop
	ANAME="$$PFX.tar" ; \
69 669d7e3d Iustin Pop
	rm -f $$ANAME $$ANAME.gz ; \
70 9b1e1cc9 Iustin Pop
	git archive --format=tar --prefix=$$PFX/ HEAD > $$ANAME ; \
71 669d7e3d Iustin Pop
	tar -r -f $$ANAME --owner root --group root \
72 9b1e1cc9 Iustin Pop
	    --transform="s,^,$$PFX/," version apidoc $(DOCS) ; \
73 669d7e3d Iustin Pop
	gzip -v9 $$ANAME ; \
74 0d0503b2 Iustin Pop
	TMPDIR=$$(mktemp -d) ; \
75 0d0503b2 Iustin Pop
	tar xzf $$ANAME.gz -C $$TMPDIR; \
76 0d0503b2 Iustin Pop
	(cd $$TMPDIR/$$PFX; make; make clean; make check); \
77 0d0503b2 Iustin Pop
	rm -rf $$TMPDIR ; \
78 0d0503b2 Iustin Pop
	tar tzvf $$ANAME.gz ; \
79 0d0503b2 Iustin Pop
	sha1sum $$ANAME.gz ; \
80 0d0503b2 Iustin Pop
	echo "Archive $$ANAME.gz created."
81 8b42a5db Iustin Pop
82 ef53b4b2 Iustin Pop
check: test
83 ef53b4b2 Iustin Pop
	rm -f *.tix *.mix
84 15f4c8ca Iustin Pop
	./test
85 15f4c8ca Iustin Pop
ifeq ($(T),markup)
86 15f4c8ca Iustin Pop
	mkdir -p coverage
87 15f4c8ca Iustin Pop
	hpc markup --destdir=coverage test $(HPCEXCL)
88 15f4c8ca Iustin Pop
else
89 15f4c8ca Iustin Pop
	hpc report test $(HPCEXCL)
90 15f4c8ca Iustin Pop
endif
91 15f4c8ca Iustin Pop
92 9ea446d2 Iustin Pop
tags:
93 9ea446d2 Iustin Pop
	find -name '*.hs' | xargs hasktags -e
94 9ea446d2 Iustin Pop
95 f6c68f9d Iustin Pop
.PHONY : all doc maintainer-clean clean dist check tags regen-version