### ### To be included in your makefile; set the following variables: ### ### INPUT = name of the file to be input to xml2rfc ### ### XML2RFC_DIR = path to the version of xml2rfc you want to use ### ### TOHTML = xml2rfc | xslt ### selects which tool is used to produce the html version. ### ### The following variables are also substituted into the document if you ### set up the input document to use them. The full draft name is substituted ### into the rfc docName attribute if you set it to docName="DOCNAME" ### ### ### DRAFTNAME = the name of the document: draft-ietf-next-great-standard ### default: draft-$(shell whoami)-$(INPUT) ### ### VERSION = the version number to generate at the end of the name. ### Defaults to a '+' followed by the subversion revision, ### so that it can be left out when working on drafts, then just ### before you submit, run 'make VERSION=' to generate the ### versions to submit (these should probably be checked in). ### ### DAY = default to the current date, but may be overridden ### MONTH These are substituted into the date element of the front ### YEAR if it is set to '' ### ############################################################################### ifeq (,$(DRAFTNAME)) DRAFTNAME:=draft-$(shell whoami)-$(INPUT) endif ifeq (,$(VERSION)) SVN_VERSION:=$(shell svnversion . | sed s/:/_/ ) DOCNAME=$(DRAFTNAME)+$(SVN_VERSION) else DOCNAME=$(DRAFTNAME)-$(VERSION) endif ifeq ($(DOCNAME),$(INPUT)) DOCNAME=OUTPUT-$(OUTNAME) endif OUTPUTS = \ $(DOCNAME).txt \ $(DOCNAME).html # Not really a format I need any more # $(DOCNAME).nr all: $(OUTPUTS) MONTH?=$(shell date +%B) DAY?=$(shell date +%d) YEAR?=$(shell date +%Y) $(DOCNAME).xml: $(INPUT) .FORCE perl -p \ -e 'm/^ $(DOCNAME).new diff $(DOCNAME).new $(DOCNAME).xml > /dev/null 2>&1 \ && rm -f $(DOCNAME).new \ || mv $(DOCNAME).new $(DOCNAME).xml xmlcheck: $(DOCNAME).xml xsltproc --path $(XML2RFC_DIR)/rfc2629xslt rfc2629.xslt $< > /dev/null txt: $(DOCNAME).txt html: $(DOCNAME).html clean: rm -f $(OUTPUTS) $(DOCNAME).xml $(DOCNAME).txt: $(DOCNAME).xml $(XML2RFC_DIR)/xml2rfc.tcl $(DOCNAME).xml $@ $(DOCNAME).nr: $(DOCNAME).xml $(XML2RFC_DIR)/xml2rfc.tcl $(DOCNAME).xml $@ TOHTML?=xml2rfc $(DOCNAME).html: $(DOCNAME).xml ifeq ($(TOHTML),xml2rfc) $(XML2RFC_DIR)/xml2rfc.tcl $(DOCNAME).xml $@ else ifeq ($(TOHTML),xml2rfc) xsltproc --path $(XML2RFC_DIR)/rfc2629xslt rfc2629.xslt $< > /dev/null else @echo "Unknown TOHTML value '$(TOHTML)'; should be 'xml2rfc|xslt'" endif endif ## ## Escaping xml files ## xml_entity_escape=perl -pe 's/&/&/g; s//>/g; s/\"/"/g;' %.esc: %.xsd $(xml_entity_escape) < $< > $@ %.esc: %.xml $(xml_entity_escape) < $< > $@ PHONY: .FORCE .FORCE: