]> granicus.if.org Git - docbook-dsssl/commitdiff
Reorganized to avoid recursive Makefiles
authorNorman Walsh <ndw@nwalsh.com>
Wed, 5 Apr 2006 19:48:28 +0000 (19:48 +0000)
committerNorman Walsh <ndw@nwalsh.com>
Wed, 5 Apr 2006 19:48:28 +0000 (19:48 +0000)
docbook/relaxng/simple/.cvsignore
docbook/relaxng/simple/Makefile
docbook/relaxng/simple/_footer.mak [new file with mode: 0644]
docbook/relaxng/simple/_header.mak [new file with mode: 0644]
docbook/relaxng/simple/build/.cvsignore [deleted file]
docbook/relaxng/simple/build/Makefile [deleted file]
docbook/relaxng/simple/sdocbook/Makefile [new file with mode: 0644]
docbook/relaxng/simple/sdocbook/sdocbook.rnc [moved from docbook/relaxng/simple/src/sdocbook.rnc with 100% similarity]

index ba8fd325e6dd79450484b984d2729642ffd91b6a..e1886232a877b0f8da55b9a272e7ebe7f8b2e8b5 100644 (file)
@@ -1,5 +1,7 @@
-sdocbook-dtd.xml
-sdocbook-rng.xml
-sdocbook.dtd
-sdocbook.rnc
-sdocbook.rng
+build
+semantic.cache
+*.dtd
+*.rnc
+*.rng
+*.sch
+*.xsd
index afd1030113297df38f94d1aecb1e65808e3c832c..0ecefff88ca51eedbafd3297004eb4d7bd0c16f1 100644 (file)
@@ -1,49 +1,71 @@
-VPATH=src
+# Inspired by "Recursive Make: Reloaded" in the July, 2005 issue
+# of Linux Magazine, I've reworked the Makfiles so that they're no
+# longer recursive.
 
-.SUFFIXES: .rnc .rng .rnx .dtx .dtd
-.PHONY: tests html
+# Fair warning, this is a bit more complex than is maybe ideal, but it
+# works and it isn't recursive. I still need to get the documentation
+# build into the new system.
+
+include ../../../cvstools/Makefile.incl
+
+XSLTPROC=xsltproc
+PERL=perl
+MV ?= mv
+
+CLASS=wd
+VERSION=5.0b4
+SPECNAME=$(CLASS)-docbook-docbook-$(VERSION)
 
-DOCBOOK=../docbook
 TOOLS=../tools
-RNGFILES=$(wildcard build/*.rng)
-
-all: sdocbook.rng sdocbook.dtd
-
-# ============================================================
-#
-# N.B. We need an explicit dependency on src/*.rnc for each *.rng
-#      file because the build process produces an *output* RNC file
-#      in the current directory and that's not the one we want to
-#      depend on.
-#
-#      That's also the reason for the curious sleep/touch pattern
-#      in the build rules. We want to make sure that the output RNC
-#      file is older than the output RNG file so that make doesn't
-#      always think it needs to rebuild the RNG file.
-#
-#      If we could take "." out of VPATH, we wouldn't need to do this.
-
-sdocbook.rng: src/sdocbook.rnc
-
-.rnc.rng:
-       $(MAKE) -C build $@
-       perl $(TOOLS)/trimgrammar.pl -o ,$@ build/$@
-       saxon ,$@ $(TOOLS)/trimgrammar.xsl $@ use.extensions=1
-       trang $@ `basename $<`
-       sleep 2
-       touch $@
-       rm -f ,$@
-
-.rng.rnx:
-       xsltproc -output $@ $(TOOLS)/rngdocxml.xsl $<
-
-.rnx.dtx:
-       xsltproc -output $@ $(TOOLS)/doc2dtd.xsl $<
-
-.dtx.dtd:
-       xsltproc -output $@ $(TOOLS)/xml2dtd.xsl $<
-
-# ============================================================
-
-clean:
-       rm -f sdocbook*
+AUGMENT=$(TOOLS)/augment.xsl
+INCLUDE=$(TOOLS)/include.xsl
+CLEANUP=$(TOOLS)/cleanup.pl
+
+.PHONY: all
+
+all::
+_OUTTOP ?= .
+_OUTTOP := $(_OUTTOP)/build
+
+DISTRIB=$(_OUTTOP)/docbook-$(VERSION)
+
+.PHONY: clean
+
+clean:: ; rm -rf $(_OUTTOP)
+
+.SUFFIXES:
+
+MODULES=sdocbook
+
+include $(addsuffix /Makefile,$(MODULES))
+
+.PHONY: tests
+
+distrib:
+       echo not working yet
+
+#distrib: docbook.dtd docbook.rng   docbook.rnc   docbook.sch \
+#                     docbookxi.rng docbookxi.rnc docbook.xsd
+#      $(MAKE) -C howto
+#      $(MAKE) -C spec
+#      rm -rf $(DISTRIB)
+#      mkdir -p $(DISTRIB)/{rng,dtd,xsd,sch,docs,tools}
+#      mkdir $(DISTRIB)/docs/images
+#      echo $(VERSION) > $(DISTRIB)/VERSION
+#      cp docbook.{rng,rnc} docbookxi.{rng,rnc} $(DISTRIB)/rng/
+#      cp docbook.dtd $(DISTRIB)/dtd/
+#      cp docbook.sch $(DISTRIB)/sch/
+#      trang docbook.dtd $(DISTRIB)/xsd/docbook.xsd
+#      grep -v "xs:import" $(DISTRIB)/xsd/xlink.xsd > $(DISTRIB)/xsd/,xlink.xsd
+#      mv $(DISTRIB)/xsd/,xlink.xsd $(DISTRIB)/xsd/xlink.xsd
+#      grep -v "xs:import" $(DISTRIB)/xsd/xml.xsd > $(DISTRIB)/xsd/,xml.xsd
+#      mv $(DISTRIB)/xsd/,xml.xsd $(DISTRIB)/xsd/xml.xsd
+#      cp howto/howto.xml howto/howto.html howto/howto.pdf $(DISTRIB)/docs/
+#      cp howto/images/*.png $(DISTRIB)/docs/images/
+#      cp spec/docbook.xml $(DISTRIB)/docs/$(SPECNAME).xml
+#      cp spec/docbook.html $(DISTRIB)/docs/$(SPECNAME).html
+#      cp spec/docbook.pdf $(DISTRIB)/docs/$(SPECNAME).pdf
+#      saxon -8b ../tools/catalog.xsl ../tools/catalog.xsl $(DISTRIB)/catalog.xml version=$(VERSION)
+#      cp ../tools/db4-upgrade.xsl $(DISTRIB)/tools/
+#      cp ../tools/db4-entities.pl $(DISTRIB)/tools/
+#      cp README $(DISTRIB)/
diff --git a/docbook/relaxng/simple/_footer.mak b/docbook/relaxng/simple/_footer.mak
new file mode 100644 (file)
index 0000000..1df2544
--- /dev/null
@@ -0,0 +1,42 @@
+# -*- Makefile -*-
+
+$(_MODULE)_OBJS := $(addsuffix .rng,$(addprefix $($(_MODULE)_OUTPUT)/,$(basename $(SRCS))))
+
+$(_MODULE)_BINARY := $($(_MODULE)_OUTPUT)/$(BINARY)
+
+.PRECIOUS: $($(_MODULE)_OBJS)
+
+$($(_MODULE)_OUTPUT)/%.rng: $(_MODULE)/%.rnc $($(_MODULE)_OUTPUT)/.f
+       $(RUNTRANG) $< $@
+
+$($(_MODULE)_OUTPUT)/%.rnx: $($(_MODULE)_OBJS) $($(_MODULE)_OUTPUT)/.f
+       $(XSLT) $< $(INCLUDE) $@, use.extensions=1
+       $(XSLT) $@, $(AUGMENT) $@ use.extensions=1
+       $(PERL) $(CLEANUP) $@ > $@,
+       $(MV) $@, $@
+
+#$($(_MODULE)_OUTPUT)/%.rng: $(_MODULE)/%.rnc $($(_MODULE)_OUTPUT)/.f
+#      $(RUNTRANG) $< $@
+#
+#$($(_MODULE)_OUTPUT)/%.rng: $($(_MODULE)_OBJS) $($(_MODULE)_OUTPUT)/.f
+#      @echo build $< $@
+#      $(XSLT) $< $(INCLUDE) $@, use.extensions=1
+#      $(XSLT) $@, $(AUGMENT) $@ use.extensions=1
+#      $(PERL) -i $(CLEANUP) $@
+#      $(RM) $@,
+
+#$($(_MODULE)_OUTPUT)/%.rnx: $($(_MODULE)_OUTPUT)/%.rne
+#      $(XSLT) $< $(INCLUDE) $@, use.extensions=1
+#      $(XSLT) $@, $(AUGMENT) $@ use.extensions=1
+#      $(PERL) -i $(CLEANUP) $@
+#      $(RM) $@,
+
+$($(_MODULE)_OUTPUT)/%.rnd: $($(_MODULE)_OUTPUT)/%.rnx
+       $(XSLTPROC) -output $@ $(TOOLS)/rngdocxml.xsl $<
+
+$($(_MODULE)_OUTPUT)/%.dtx: $($(_MODULE)_OUTPUT)/%.rnd
+       $(XSLTPROC) -output $@ $(TOOLS)/doc2dtd.xsl $<
+
+all:: $($(_MODULE)_BINARY)
+
+$(_MODULE): $($(_MODULE)_BINARY)
diff --git a/docbook/relaxng/simple/_header.mak b/docbook/relaxng/simple/_header.mak
new file mode 100644 (file)
index 0000000..9ec1b64
--- /dev/null
@@ -0,0 +1,12 @@
+# -*- Makefile -*-
+
+_MAKEFILES := $(filter-out _header.mak _footer.mak,$(MAKEFILE_LIST))
+
+_MODULE := $(patsubst %/,%,$(dir $(word $(words $(_MAKEFILES)),$(_MAKEFILES))))
+
+$(_MODULE)_OUTPUT := $(_OUTTOP)/$(_MODULE)
+
+$($(_MODULE)_OUTPUT)/.f:
+       @if !([ -e $@ ]); then \
+               ( mkdir -p $(patsubst %/.f,%,$@) ; \
+                 touch $@ ); fi
diff --git a/docbook/relaxng/simple/build/.cvsignore b/docbook/relaxng/simple/build/.cvsignore
deleted file mode 100644 (file)
index c386882..0000000
+++ /dev/null
@@ -1 +0,0 @@
-*.rng
diff --git a/docbook/relaxng/simple/build/Makefile b/docbook/relaxng/simple/build/Makefile
deleted file mode 100644 (file)
index a01a3a8..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-VPATH=../src
-
-TOOLS=../../tools
-
-AUGMENT=$(TOOLS)/augment.xsl
-INCLUDE=$(TOOLS)/include.xsl
-CLEANUP=$(TOOLS)/cleanup.pl
-
-.SUFFIXES: .rng .rnc
-
-all:
-       @echo Make what?
-
-.rnc.rng:
-       trang -O rng $< $@
-       saxon $@ $(INCLUDE) ,$@ use.extensions=1
-       saxon ,$@ $(AUGMENT) $@ use.extensions=1
-       perl -i $(CLEANUP) $@
-       rm -f ,$@
-
-clean:
-       rm -f *.rng
diff --git a/docbook/relaxng/simple/sdocbook/Makefile b/docbook/relaxng/simple/sdocbook/Makefile
new file mode 100644 (file)
index 0000000..df3c10a
--- /dev/null
@@ -0,0 +1,36 @@
+include _header.mak
+
+REMOVESCHEMATRON=0
+
+SRCS = sdocbook.rnc
+
+BINARY = sdocbook.rnd
+
+all:: sdocbook.rng sdocbook.rnc sdocbook.dtd sdocbook.sch sdocbook.xsd
+
+clean:: ; rm -f sdocbook.rng sdocbook.rnc sdocbook.dtd sdocbook.sch *.xsd
+
+$(_OUTTOP)/sdocbook/sdocbook.rng: sdocbook/sdocbook.rnc \
+                                  ../docbook/src/hier.rnc \
+                                  ../docbook/src/bibliography.rnc \
+                                  ../docbook/src/calstbl.rnc \
+                                  ../docbook/src/htmltbl.rnc \
+                                  ../docbook/src/pool.rnc
+
+include _footer.mak
+
+sdocbook.rng: $(basename $(sdocbook_BINARY)).rnx
+       $(XSLTPROC) --param remove-schematron $(REMOVESCHEMATRON) --output $@ $(TOOLS)/removedoc.xsl $<
+
+sdocbook.rnc: sdocbook.rng
+       $(RUNTRANG) $< $@
+
+sdocbook.dtd: $(basename $(sdocbook_BINARY)).dtx sdocbook.rnc
+       $(XSLTPROC) -output $@ $(TOOLS)/xml2dtd.xsl $<
+
+sdocbook.sch: $(basename $(sdocbook_BINARY)).rnx
+       $(XSLTPROC) --output $@ $(TOOLS)/schematron.xsl $<
+
+sdocbook.xsd: sdocbook.dtd
+       $(RUNTRANG) $< $@
+