From c14dc32f5dbd5a212c5d732d9c306a321168a48b Mon Sep 17 00:00:00 2001 From: Norman Walsh Date: Fri, 22 Apr 2005 15:43:48 +0000 Subject: [PATCH] Much simpler build mechanics --- docbook/relaxng/docbook/Makefile | 43 ++++++++++++++++------ docbook/relaxng/docbook/build/Makefile | 51 +++++++------------------- 2 files changed, 44 insertions(+), 50 deletions(-) diff --git a/docbook/relaxng/docbook/Makefile b/docbook/relaxng/docbook/Makefile index caa032ad5..b5ae9cabb 100644 --- a/docbook/relaxng/docbook/Makefile +++ b/docbook/relaxng/docbook/Makefile @@ -1,35 +1,54 @@ VPATH=src -.SUFFIXES: .rnc .rng .rnx +.SUFFIXES: .rnc .rng .rnx .dtx .dtd .PHONY: tests html -RNCFILES=$(subst $(VPATH)/,,$(wildcard $(VPATH)/*.rnc)) +RNCFILES=$(wildcard $(VPATH)/*.rnc) TOOLS=../tools all: docbook.rng docbook.dtd # ============================================================ - -tests: - mkdir -p tests tests/passed - cd tests && ../$(TOOLS)/runtests - -# ============================================================ +# +# 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. docbook.rng: $(RNCFILES) + +.rnc.rng: $(MAKE) -C build $@ + cp build/$@ . trang $@ docbook.rnc + sleep 2 + touch $@ -docbook-rng.xml: docbook.rng $(TOOLS)/rngdocxml.xsl +.rng.rnx: xsltproc -output $@ $(TOOLS)/rngdocxml.xsl $< -docbook-dtd.xml: docbook-rng.xml $(TOOLS)/doc2dtd.xsl +.rnx.dtx: xsltproc -output $@ $(TOOLS)/doc2dtd.xsl $< -docbook.dtd: docbook-dtd.xml $(TOOLS)/xml2dtd.xsl +.dtx.dtd: xsltproc -output $@ $(TOOLS)/xml2dtd.xsl $< # ============================================================ +tests: + mkdir -p tests tests/passed + cd tests && ../$(TOOLS)/runtests + +# ============================================================ + clean: - rm -f *-rng.xml *-dtd.xml \ No newline at end of file + rm -f docbook* + +# EOF diff --git a/docbook/relaxng/docbook/build/Makefile b/docbook/relaxng/docbook/build/Makefile index 583a7b4dc..b580d1ad1 100644 --- a/docbook/relaxng/docbook/build/Makefile +++ b/docbook/relaxng/docbook/build/Makefile @@ -1,53 +1,28 @@ -VPATH=../src ../tests/customizations +VPATH=../src RNCFILES=$(subst ../src/,,$(wildcard ../src/*.rnc)) -RNXFILES=$(subst .rnc,.rnx,$(RNCFILES)) -MODULES=$(filter-out docbook.rnx,$(filter-out sdocbook.rnx,$(filter-out slides-ng.rnx,$(filter-out website-ng.rnx,$(RNXFILES))))) -TMPDIR=/tmp/ -TMPFILE=$(TMPDIR)cleanup.rng TOOLS=../../tools AUGMENT=$(TOOLS)/augment.xsl INCLUDE=$(TOOLS)/include.xsl -EXPAND=$(TOOLS)/expand.xsl -GROUP=$(TOOLS)/group.xsl -FLATTEN=$(TOOLS)/flatten.xsl -CLASSIFY=$(TOOLS)/classify.xsl CLEANUP=$(TOOLS)/cleanup.pl -.SUFFIXES: .rnc .rng .rnx +.SUFFIXES: .rnc .rng -docbook.rng: docbook.rnx $(AUGMENT) $(INCLUDE) $(CLEANUP) +all: docbook.rng -docbook-dtd.rng: docbook-dtd.rnx $(AUGMENT) $(INCLUDE) $(CLEANUP) +# Make sure that docbook.rng depends on all the things that could influence +# it. That's *all* the RNC files, not just docbook.rnc, and the stylesheets +# and cleanup script(s). +# +docbook.rng: $(RNCFILES) $(AUGMENT) $(INCLUDE) $(CLEANUP) -docbook.rnx: $(MODULES) - -dbsmall.rng: dbsmall.rnx $(AUGMENT) $(INCLUDE) $(CLEANUP) - -dbsmall.rnx: $(MODULES) - -dbastro.rng: dbastro.rnx $(AUGMENT) $(INCLUDE) $(CLEANUP) - -sdocbook.rng: sdocbook.rnx $(AUGMENT) $(INCLUDE) $(CLEANUP) - -slides-ng.rng: slides-ng.rnx $(AUGMENT) $(INCLUDE) $(CLEANUP) - -website-ng.rng: website-ng.rnx $(AUGMENT) $(INCLUDE) $(CLEANUP) - -dbastro.rnx: $(MODULES) - -.rnx.rng: - saxon $< $(INCLUDE) ,$@ use.extensions=1 +.rnc.rng: + trang -O rng $< $@ + saxon $@ $(INCLUDE) ,$@ use.extensions=1 saxon ,$@ $(AUGMENT) $@ use.extensions=1 perl -i $(CLEANUP) $@ - cp $@ .. - -# rm -f ,$@ - -.rnc.rnx: - trang -O rng $< $@ + rm -f ,$@ clean: - rm -f *.rnx *.rng - + rm -f *.rng -- 2.40.0