Statistics
| Branch: | Tag: | Revision:

root / Makefile @ 8ed71b67

History | View | Annotate | Download (2.2 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 6583e677 Iustin Pop
	cd Ganeti && rm -f *.o *.prof *.ps *.stat *.aux *.hi
47 968de7fc Iustin Pop
	cd Ganeti/HTools && rm -f *.o *.prof *.ps *.stat *.aux *.hi
48 e4f08c46 Iustin Pop
49 f6c68f9d Iustin Pop
regen-version:
50 f6c68f9d Iustin Pop
	rm -f version
51 f6c68f9d Iustin Pop
	$(MAKE) version
52 f6c68f9d Iustin Pop
53 8b42a5db Iustin Pop
version:
54 ca2843dc Guido Trotter
	if test -d .git; then \
55 f6c68f9d Iustin Pop
	  git describe > $@; \
56 ca2843dc Guido Trotter
	elif test ! -f $@ ; then \
57 ca2843dc Guido Trotter
	  echo "Cannot auto-generate $@ file"; exit 1; \
58 ca2843dc Guido Trotter
	fi
59 8b42a5db Iustin Pop
60 669d7e3d Iustin Pop
Ganeti/HTools/Version.hs: Ganeti/HTools/Version.hs.in version
61 968de7fc Iustin Pop
	sed -e "s/%ver%/$$(cat version)/" < $< > $@
62 669d7e3d Iustin Pop
63 f6c68f9d Iustin Pop
dist: regen-version Ganeti/HTools/Version.hs doc
64 8b42a5db Iustin Pop
	VN=$$(cat version|sed 's/^v//') ; \
65 9b1e1cc9 Iustin Pop
	PFX="ganeti-htools-$$VN" ; \
66 9b1e1cc9 Iustin Pop
	ANAME="$$PFX.tar" ; \
67 669d7e3d Iustin Pop
	rm -f $$ANAME $$ANAME.gz ; \
68 9b1e1cc9 Iustin Pop
	git archive --format=tar --prefix=$$PFX/ HEAD > $$ANAME ; \
69 669d7e3d Iustin Pop
	tar -r -f $$ANAME --owner root --group root \
70 9b1e1cc9 Iustin Pop
	    --transform="s,^,$$PFX/," version apidoc $(DOCS) ; \
71 669d7e3d Iustin Pop
	gzip -v9 $$ANAME ; \
72 669d7e3d Iustin Pop
	tar tzvf $$ANAME.gz
73 8b42a5db Iustin Pop
74 ef53b4b2 Iustin Pop
check: test
75 ef53b4b2 Iustin Pop
	rm -f *.tix *.mix
76 15f4c8ca Iustin Pop
	./test
77 15f4c8ca Iustin Pop
ifeq ($(T),markup)
78 15f4c8ca Iustin Pop
	mkdir -p coverage
79 15f4c8ca Iustin Pop
	hpc markup --destdir=coverage test $(HPCEXCL)
80 15f4c8ca Iustin Pop
else
81 15f4c8ca Iustin Pop
	hpc report test $(HPCEXCL)
82 15f4c8ca Iustin Pop
endif
83 15f4c8ca Iustin Pop
84 9ea446d2 Iustin Pop
tags:
85 9ea446d2 Iustin Pop
	find -name '*.hs' | xargs hasktags -e
86 9ea446d2 Iustin Pop
87 f6c68f9d Iustin Pop
.PHONY : all doc maintainer-clean clean dist check tags regen-version