]> git.llucax.com Git - software/posixx.git/blobdiff - doc/Makefile
Add a commit-check rule to the Makefile
[software/posixx.git] / doc / Makefile
index 62de89f769e4d9dfd79f61cde7b959a2f48764ca..24f38798f986ee4cfa989cbf1d8453eaf588e365 100644 (file)
@@ -1,17 +1,34 @@
 
 
+# sources from where to build the sources
+DOC_SOURCES = $(shell find ../src -name '*.hpp')
 
 # prefix for installing the binaries and headers
 prefix=/usr/local
 
 
 
 # prefix for installing the binaries and headers
 prefix=/usr/local
 
 
+# install command
+INSTALL = install -p -m 0644 -D
+
+
+# install utility functions
+install_msg = echo "  INSTALL $(1)"
+
+install_group = @$(call install_msg,$(2)) && \
+       cd reference && \
+       for f in `find $(1) -type f`; do \
+               $(call install,$$f,$(2)/$$f); \
+       done && \
+       cd .. && \
+       touch $@
+
 ifneq ($(V), 1)
 NICE_DOXY = @echo "  DOXYGEN"; (cat Doxyfile; echo "QUIET=YES") | doxygen -
 NICE_CLEAN = @echo "  CLEAN"; $(RM)
 ifneq ($(V), 1)
 NICE_DOXY = @echo "  DOXYGEN"; (cat Doxyfile; echo "QUIET=YES") | doxygen -
 NICE_CLEAN = @echo "  CLEAN"; $(RM)
-NICE = @
+install = $(INSTALL) $(1) $(2)
 else
 NICE_DOXY = doxygen
 NICE_CLEAN = $(RM) -v
 else
 NICE_DOXY = doxygen
 NICE_CLEAN = $(RM) -v
-NICE =
+install = $(call install_msg,$(2)); $(INSTALL) $(1) $(2)
 endif
 
 
 endif
 
 
@@ -19,30 +36,30 @@ default: all
 
 all: doc
 
 
 all: doc
 
-doc: include
+doc: .doc-stamp
+
+.doc-stamp: include $(DOC_SOURCES) Doxyfile
        $(NICE_DOXY)
        $(NICE_DOXY)
+       @touch $@
 
 install: install-man install-html
 
 
 install: install-man install-html
 
-install-man: doc
-       $(NICE) for f in `find reference/man -type f | cut -b11-`; do \
-               echo "  INSTALL $(prefix)/share/$$f"; \
-               install -p -m 0644 -D reference/$$f $(prefix)/share/$$f; \
-       done
+install-man: .install-man-stamp
+
+.install-man-stamp: .doc-stamp
+       $(call install_group,man,$(prefix)/share/man)
 
 
-install-html: doc
-       $(NICE) for f in `find reference/html -type f | cut -b11-`; do \
-               echo "  INSTALL $(prefix)/share/doc/posixx/$$f"; \
-               install -p -m 0644 -D reference/$$f $(prefix)/share/doc/posixx/$$f; \
-       done
+install-html: .install-html-stamp
+
+.install-html-stamp: .doc-stamp
+       $(call install_group,html,$(prefix)/share/doc/posixx/html)
 
 include:
        @mkdir -p include
        @ln -fs ../../src include/posixx
 
 clean:
 
 include:
        @mkdir -p include
        @ln -fs ../../src include/posixx
 
 clean:
-       $(NICE_CLEAN) -r reference include
+       $(NICE_CLEAN) -r reference include .*-stamp
 
 .PHONY: default all doc install install-man install-doc clean
 
 
 .PHONY: default all doc install install-man install-doc clean
 
-