Revision 7ddd8e4c Makefile.am

b/Makefile.am
14 14
space := $(empty) $(empty)
15 15
comma := ,
16 16

  
17
# Helper function to strip src/ and test/hs/ from a list
18
strip_hsroot = $(patsubst src/%,%,$(patsubst test/hs/%,%,$(1)))
19

  
17 20
# Use bash in order to be able to use pipefail
18 21
SHELL=/bin/bash
19 22

  
......
76 79
	test/hs/Test/Ganeti/HTools/Backend \
77 80
	test/hs/Test/Ganeti/Query
78 81

  
82
# Haskell directories without the roots (src, test/hs)
83
HS_DIRS_NOROOT = $(filter-out src,$(filter-out test/hs,$(HS_DIRS)))
84

  
79 85
DIRS = \
80 86
	$(HS_DIRS) \
81 87
	autotools \
......
114 120

  
115 121
ALL_APIDOC_HS_DIRS = \
116 122
	$(APIDOC_HS_DIR) \
117
	$(APIDOC_HS_DIR)/Ganeti \
118
	$(APIDOC_HS_DIR)/Ganeti/Block \
119
	$(APIDOC_HS_DIR)/Ganeti/Block/Drbd \
120
	$(APIDOC_HS_DIR)/Ganeti/Confd \
121
	$(APIDOC_HS_DIR)/Ganeti/DataCollectors \
122
	$(APIDOC_HS_DIR)/Ganeti/HTools \
123
	$(APIDOC_HS_DIR)/Ganeti/HTools/Backend \
124
	$(APIDOC_HS_DIR)/Ganeti/HTools/Program \
125
	$(APIDOC_HS_DIR)/Ganeti/Query
123
	$(patsubst %,$(APIDOC_HS_DIR)/%,$(call strip_hsroot,$(HS_DIRS_NOROOT)))
126 124

  
127 125
BUILDTIME_DIR_AUTOCREATE = \
128 126
	scripts \
......
590 588
	src/Ganeti/Version.hs
591 589
HS_BUILT_SRCS_IN = $(patsubst %,%.in,$(HS_BUILT_SRCS))
592 590

  
591
HS_LIBTESTBUILT_SRCS = $(HS_LIBTEST_SRCS) $(HS_BUILT_SRCS)
592

  
593 593
$(RUN_IN_TEMPDIR): | stamp-directories
594 594

  
595 595
doc/html/index.html: ENABLE_MANPAGES =
......
747 747
	done
748 748
endif
749 749

  
750
$(HS_ALL_PROGS): %: %.hs $(HS_LIBTEST_SRCS) $(HS_BUILT_SRCS) Makefile
750
$(HS_ALL_PROGS): %: %.hs $(HS_LIBTESTBUILT_SRCS) Makefile
751 751
	@if [ "$(notdir $@)" = "test" ] && [ "$(HS_NODEV)" ]; then \
752 752
	  echo "Error: cannot run unittests without the development" \
753 753
	       " libraries (see devnotes.rst)" 1>&2; \
......
1810 1810
	  --output $(CURDIR)/$(APIDOC_PY_DIR)
1811 1811

  
1812 1812
.PHONY: hs-apidoc
1813
hs-apidoc: $(HS_BUILT_SRCS)
1813
hs-apidoc: $(APIDOC_HS_DIR)/index.html
1814

  
1815
$(APIDOC_HS_DIR)/index.html: $(HS_LIBTESTBUILT_SRCS) Makefile
1814 1816
	@test -n "$(HSCOLOUR)" || \
1815 1817
	    { echo 'HsColour' not found during configure; exit 1; }
1816 1818
	@test -n "$(HADDOCK)" || \
......
1823 1825
	$(LN_S) ../hscolour.css $(APIDOC_HS_DIR)/Ganeti/HTools/hscolour.css
1824 1826
	$(LN_S) ../hscolour.css $(APIDOC_HS_DIR)/Ganeti/Confd/hscolour.css
1825 1827
	set -e ; \
1826
	cd src; \
1828
	export LC_ALL=en_US.UTF-8; \
1829
	OPTGHC="--optghc=-isrc --optghc=-itest/hs"; \
1827 1830
	if [ "$(HS_NOCURL)" ]; \
1828
	then OPTGHC="--optghc=$(HS_NOCURL)"; \
1829
	else OPTGHC=""; \
1831
	then OPTGHC="$$OPTGHC --optghc=$(HS_NOCURL)"; \
1830 1832
	fi; \
1831 1833
	if [ "$(HS_PARALLEL3)" ]; \
1832 1834
	then OPTGHC="$$OPTGHC --optghc=$(HS_PARALLEL3)"; \
......
1834 1836
	if [ "$(HS_REGEX_PCRE)" ]; \
1835 1837
	then OPTGHC="$$OPTGHC --optghc=$(HS_REGEX_PCRE)"; \
1836 1838
	fi; \
1837
	RELSRCS="$(HS_LIB_SRCS:src/%=%) $(patsubst src/%,%,$(filter src/%,$(HS_BUILT_SRCS)))"; \
1838
	for file in $$RELSRCS; do \
1839
	  hfile=`echo $$file|sed 's/\\.hs$$//'`.html; \
1840
	  $(HSCOLOUR) -css -anchor $$file > ../$(APIDOC_HS_DIR)/$$hfile ; \
1839
	for file in $(HS_LIBTESTBUILT_SRCS); do \
1840
	  f_nosrc=$${file##src/}; \
1841
	  f_notst=$${f_nosrc##test/hs/}; \
1842
	  f_html=$${f_notst%%.hs}.html; \
1843
	  $(HSCOLOUR) -css -anchor $$file > $(APIDOC_HS_DIR)/$$f_html ; \
1841 1844
	done ; \
1842
	$(HADDOCK) --odir ../$(APIDOC_HS_DIR) --html --ignore-all-exports -w \
1843
	  -t ganeti -p haddock-prologue \
1845
	$(HADDOCK) --odir $(APIDOC_HS_DIR) --html --ignore-all-exports -w \
1846
	  -t ganeti -p src/haddock-prologue \
1844 1847
	  --source-module="%{MODULE/.//}.html" \
1845 1848
	  --source-entity="%{MODULE/.//}.html#%{NAME}" \
1846 1849
	  $$OPTGHC \
1847
	  $(filter-out Ganeti/HTools/ExtLoader.hs,$(HS_LIB_SRCS:src/%=%))
1850
	  $(HS_LIBTESTBUILT_SRCS)
1848 1851

  
1849 1852
.PHONY: TAGS
1850 1853
TAGS: $(GENERATED_FILES)

Also available in: Unified diff