summaryrefslogtreecommitdiff
path: root/gnome-doc-utils.make
diff options
context:
space:
mode:
authorShaun McCance <shaunm@src.gnome.org>2005-04-09 18:43:31 +0000
committerShaun McCance <shaunm@src.gnome.org>2005-04-09 18:43:31 +0000
commit86510c54d5dd91dc3f8496ff0ffd5ec77fa5749a (patch)
tree680e1dee56c7139fb934f5bfa971d87c494b3625 /gnome-doc-utils.make
parentccf17f7a32a518d220ff30c2812bbbdb5c685239 (diff)
downloadgnome-doc-utils-86510c54d5dd91dc3f8496ff0ffd5ec77fa5749a.tar.gz
- More builddir != srcdir fixes
* Makefile.am: * autogen.sh: * bootstrap.make: * gnome-doc-utils.m4: * gnome-doc-utils.make: * doc/xslt/Makefile.am: - More builddir != srcdir fixes
Diffstat (limited to 'gnome-doc-utils.make')
-rw-r--r--gnome-doc-utils.make85
1 files changed, 57 insertions, 28 deletions
diff --git a/gnome-doc-utils.make b/gnome-doc-utils.make
index 8be75b9..0f4cbd8 100644
--- a/gnome-doc-utils.make
+++ b/gnome-doc-utils.make
@@ -32,26 +32,32 @@ DOC_H_FILE ?=
DOC_H_DOCS ?=
$(DOC_H_FILE): $(DOC_H_DOCS);
- @rm -f $@; touch $@;
- echo 'const gchar* documentation_credits[] = {' >> $@
+ @rm -f $@.tmp; touch $@.tmp;
+ echo 'const gchar* documentation_credits[] = {' >> $@.tmp
for doc in $(DOC_H_DOCS); do \
- xsltproc $(_credits) $$doc; \
+ xmlpath="`echo $$doc | sed -e 's/^\(.*\/\).*\|.*/\1/'`:$(srcdir)/`echo $$doc | sed -e 's/^\(.*\/\).*\|.*/\1/'`"; \
+ if ! test -f "$$doc"; then doc="$(srcdir)/$$doc"; fi; \
+ xsltproc --path "$$xmlpath" $(_credits) $$doc; \
done | sort | uniq \
| awk 'BEGIN{s=""}{n=split($$0,w,"<");if(s!=""&&s!=substr(w[1],1,length(w[1])-1)){print s};if(n>1){print $$0;s=""}else{s=$$0}};END{if(s!=""){print s}}' \
- | sed -e 's/\\/\\\\/' -e 's/"/\\"/' -e 's/\(.*\)/\t"\1",/' >> $@
- echo ' NULL' >> $@
- echo '};' >> $@
- echo >> $@
+ | sed -e 's/\\/\\\\/' -e 's/"/\\"/' -e 's/\(.*\)/\t"\1",/' >> $@.tmp
+ echo ' NULL' >> $@.tmp
+ echo '};' >> $@.tmp
+ echo >> $@.tmp
for doc in $(DOC_H_DOCS); do \
- docid=`echo $$doc | sed -e 's/.*\/\([^/]*\)\.xml/\1/' \
+ xmlpath="`echo $$doc | sed -e 's/^\(.*\/\).*\|.*/\1/'`:$(srcdir)/`echo $$doc | sed -e 's/^\(.*\/\).*\|.*/\1/'`"; \
+ if ! test -f "$$doc"; then doc="$(srcdir)/$$doc"; fi; \
+ docid=`echo "$$doc" | sed -e 's/.*\/\([^/]*\)\.xml/\1/' \
| sed -e 's/[^a-zA-Z_]/_/g' | tr 'a-z' 'A-Z'`; \
- ids=`xsltproc --xinclude $(_ids) $$doc`; \
+ echo $$xmlpath; \
+ ids=`xsltproc --xinclude --path "$$xmlpath" $(_ids) $$doc`; \
for id in $$ids; do \
echo '#define HELP_'`echo $$docid`'_'`echo $$id \
- | sed -e 's/[^a-zA-Z_]/_/g' | tr 'a-z' 'A-Z'`' "'$$id'"' >> $@; \
+ | sed -e 's/[^a-zA-Z_]/_/g' | tr 'a-z' 'A-Z'`' "'$$id'"' >> $@.tmp; \
done; \
- echo >> $@; \
+ echo >> $@.tmp; \
done;
+ cp $@.tmp $@ && rm -f $@.tmp
.PHONY: dist-header
dist-doc-header: $(DOC_H_FILE)
@@ -134,17 +140,18 @@ rngdoc_args = \
## @ _RNGDOC_RNGS
## The actual RNG files for which to generate documentation with rngdoc
-_RNGDOC_RNGS = $(foreach dir,$(RNGDOC_DIRS), \
- $(wildcard $(dir)/*.rng))
+_RNGDOC_RNGS = $(sort $(foreach dir,$(RNGDOC_DIRS), \
+ $(wildcard $(dir)/*.rng) $(wildcard $(srcdir)/$(dir)/*.rng)))
## @ _RNGDOC_C_DOCS
## The generated rngdoc documentation in the C locale
-_RNGDOC_C_DOCS = $(foreach rng,$(_RNGDOC_RNGS), \
- C/$(basename $(notdir $(rng))).xml)
+_RNGDOC_C_DOCS = $(foreach rng,$(_RNGDOC_RNGS), C/$(basename $(notdir $(rng))).xml)
# FIXME: Fix the dependancies
$(_RNGDOC_C_DOCS) : $(_RNGDOC_RNGS)
- xsltproc -o $@ $(call rngdoc_args,$@,$<)
+ if ! test -d $(dir $@); then mkdir $(dir $@); fi;
+ xsltproc $(call rngdoc_args,$@,$<) | xmllint --c14n - > $@.tmp && \
+ cp $@.tmp $@ && rm -f $@.tmp
.PHONY: rngdoc
rngdoc: $(_RNGDOC_C_DOCS)
@@ -160,17 +167,18 @@ xsldoc_args = \
## @ _XSLDOC_XSLS
## The actual XSLT files for which to generate documentation with xsldoc
-_XSLDOC_XSLS = $(foreach dir,$(XSLDOC_DIRS), \
- $(wildcard $(dir)/*.xsl))
+_XSLDOC_XSLS = $(sort $(foreach dir,$(XSLDOC_DIRS), \
+ $(wildcard $(dir)/*.xsl) $(wildcard $(srcdir)/$(dir)/*.xsl)))
## @ _XSLDOC_C_DOCS
## The generated xsldoc documentation in the C locale
-_XSLDOC_C_DOCS = $(foreach xsl,$(_XSLDOC_XSLS), \
- C/$(basename $(notdir $(xsl))).xml)
+_XSLDOC_C_DOCS = $(foreach xsl,$(_XSLDOC_XSLS), C/$(basename $(notdir $(xsl))).xml)
# FIXME: Fix the dependancies
$(_XSLDOC_C_DOCS) : $(_XSLDOC_XSLS)
- xsltproc $(call xsldoc_args,$@,$<) | xmllint --c14n - > $@
+ if ! test -d $(dir $@); then mkdir $(dir $@); fi;
+ xsltproc $(call xsldoc_args,$@,$<) | xmllint --c14n - > $@.tmp && \
+ cp $@.tmp $@ && rm -f $@.tmp
.PHONY: xsldoc
xsldoc: $(_XSLDOC_C_DOCS)
@@ -418,13 +426,34 @@ _DOC_LC_FIGURES = $(foreach lc,$(DOC_LINGUAS), \
$(patsubst $(srcdir)/%,%,$(wildcard $(srcdir)/$(lc)/figures/*.png)) ))
$(_DOC_POFILES): $(_DOC_C_DOCS)
- if ! test -d $(srcdir)/$(dir $@); then mkdir $(srcdir)/$(dir $@); fi
- if ! test -f $(srcdir)/$@; then \
- (cd $(srcdir)/$(dir $@) && \
- $(_xml2po) -e $(_DOC_C_DOCS_NOENT:%=../%) > $(notdir $@)); \
+ @if ! test -d $(dir $@); then \
+ echo "mkdir $(dir $@)"; \
+ mkdir "$(dir $@)"; \
+ fi
+ @if test ! -f $@ -a -f $(srcdir)$@; then \
+ echo "cp $(srcdir)/$@ $@"; \
+ cp "$(srcdir)/$@" "$@"; \
+ fi;
+ @docs=; \
+ for doc in $(_DOC_C_DOCS_NOENT) ; do \
+ if test -f $$doc; then \
+ docs="$$docs ../$$doc"; \
+ else \
+ docs="$$docs ../$(srcdir)/$$doc"; \
+ fi; \
+ done; \
+ if ! test -f $@; then \
+ echo "(cd $(dir $@) && \
+ $(_xml2po) -e $$docs > $(notdir $@).tmp && \
+ cp $(notdir $@).tmp $(notdir $@) && rm -f $(notdir $@).tmp)"; \
+ (cd $(dir $@) && \
+ $(_xml2po) -e $$docs > $(notdir $@).tmp && \
+ cp $(notdir $@).tmp $(notdir $@) && rm -f $(notdir $@).tmp); \
else \
- (cd $(srcdir)/$(dir $@) && \
- $(_xml2po) -e -u $(basename $(notdir $@)) $(_DOC_C_DOCS_NOENT:%=../%)); \
+ echo "(cd $(dir $@) && \
+ $(_xml2po) -e -u $(basename $(notdir $@)) $$docs)"; \
+ (cd $(dir $@) && \
+ $(_xml2po) -e -u $(basename $(notdir $@)) $$docs); \
fi
# FIXME: fix the dependancy
@@ -432,7 +461,7 @@ $(_DOC_POFILES): $(_DOC_C_DOCS)
$(_DOC_LC_DOCS) : $(_DOC_POFILES)
$(_DOC_LC_DOCS) : $(_DOC_C_DOCS)
if ! test -d $(dir $@); then mkdir $(dir $@); fi
- if test -f "$(_DOC_C_MODULE)"; then d="../"; else d="../$(srcdir)/"; fi; \
+ if test -f "C/$(notdir $@)"; then d="../"; else d="../$(srcdir)/"; fi; \
(cd $(dir $@) && \
$(_xml2po) -e -p \
$${d}$(dir $@)$(patsubst %/$(notdir $@),%,$@).po \