summaryrefslogtreecommitdiff
path: root/buildlib
diff options
context:
space:
mode:
Diffstat (limited to 'buildlib')
-rw-r--r--buildlib/debiandoc.mak58
-rw-r--r--buildlib/defaults.mak12
-rw-r--r--buildlib/manpage.mak27
3 files changed, 94 insertions, 3 deletions
diff --git a/buildlib/debiandoc.mak b/buildlib/debiandoc.mak
new file mode 100644
index 000000000..5e08bda6c
--- /dev/null
+++ b/buildlib/debiandoc.mak
@@ -0,0 +1,58 @@
+# -*- make -*-
+
+# This processes debian-doc sgml to produce html and plain text output
+
+# Input
+# $(SOURCE) - The documents to use
+
+# All output is writtin to files in the build doc directory
+
+# See defaults.mak for information about LOCAL
+
+# Some local definitions
+LOCAL := debiandoc-$(firstword $(SOURCE))
+$(LOCAL)-HTML := $(addsuffix .html,$(addprefix $(DOC)/,$(basename $(SOURCE))))
+$(LOCAL)-TEXT := $(addsuffix .text,$(addprefix $(DOC)/,$(basename $(SOURCE))))
+
+#---------
+
+# Rules to build HTML documentations
+ifdef DEBIANDOC_HTML
+
+# Install generation hooks
+doc: $($(LOCAL)-HTML)
+veryclean: veryclean/html/$(LOCAL)
+
+vpath %.sgml $(SUBDIRS)
+$(DOC)/%.html: %.sgml
+ echo Creating html for $< to $@
+ -rm -rf $@
+ (HERE=`pwd`; cd $(@D) && debiandoc2html $$HERE/$<)
+
+# Clean rule
+.PHONY: veryclean/html/$(LOCAL)
+veryclean/html/$(LOCAL):
+ -rm -rf $($(@F)-HTML)
+
+endif
+
+#---------
+
+# Rules to build Text documentations
+ifdef DEBIANDOC_TEXT
+
+# Install generation hooks
+doc: $($(LOCAL)-TEXT)
+veryclean: veryclean/text/$(LOCAL)
+
+vpath %.sgml $(SUBDIRS)
+$(DOC)/%.text: %.sgml
+ echo Creating text for $< to $@
+ debiandoc2text -O $< > $@
+
+# Clean rule
+.PHONY: veryclean/text/$(LOCAL)
+veryclean/text/$(LOCAL):
+ -rm -rf $($(@F)-TEXT)
+
+endif
diff --git a/buildlib/defaults.mak b/buildlib/defaults.mak
index b268c4b9b..50f27de5a 100644
--- a/buildlib/defaults.mak
+++ b/buildlib/defaults.mak
@@ -37,9 +37,12 @@ BIN := $(BUILD)/bin
LIB := $(BIN)
OBJ := $(BUILD)/obj
DEP := $(OBJ)
+DOC := $(BUILD)/doc
# Module types
-LIBRARY_H=$(BASE)/buildlib/library.mak
+LIBRARY_H = $(BASE)/buildlib/library.mak
+DEBIANDOC_H = $(BASE)/buildlib/debiandoc.mak
+MANPAGE_H = $(BASE)/buildlib/manpage.mak
# Source location control
# SUBDIRS specifies sub components of the module that
@@ -61,12 +64,15 @@ CXXFLAGS+= -Wall -g -fno-implicit-templates -fno-exceptions
PICFLAGS+= -fPIC -DPIC
LFLAGS+=
INLINEDEPFLAG = -MD
+DEBIANDOC_HTML = yes
+DEBIANDOC_TEXT = yes
# Phony rules. Other things hook these by appending to the dependency
# list
-.PHONY: headers library clean veryclean all binary program
-all: binary
+.PHONY: headers library clean veryclean all binary program doc
+all: binary doc
binary: library program
+maintainer-clean dist-clean: veryclean
headers library clean veryclean program:
# Header file control. We want all published interface headers to go
diff --git a/buildlib/manpage.mak b/buildlib/manpage.mak
new file mode 100644
index 000000000..d6a4ba3a5
--- /dev/null
+++ b/buildlib/manpage.mak
@@ -0,0 +1,27 @@
+# -*- make -*-
+
+# This installs man pages into the doc directory
+
+# Input
+# $(SOURCE) - The documents to use
+
+# All output is writtin to files in the build doc directory
+
+# See defaults.mak for information about LOCAL
+
+# Some local definitions
+LOCAL := manpage-$(firstword $(SOURCE))
+$(LOCAL)-LIST := $(addprefix $(DOC)/,$(SOURCE))
+
+# Install generation hooks
+doc: $($(LOCAL)-LIST)
+veryclean: veryclean/$(LOCAL)
+
+$($(LOCAL)-LIST) : $(DOC)/% : %
+ echo Installing man page %< to $(@D)
+ cp $< $(@D)
+
+# Clean rule
+.PHONY: veryclean/$(LOCAL)
+veryclean/$(LOCAL):
+ -rm -rf $($(@F)-LIST)