Patch to build only one file

From: Date: Sat, 10 Jan 2004 17:15:21 +0000
Subject: Patch to build only one file
Groups: php.doc 
Request: Send a blank email to phpdoc+get-969358068@lists.php.net to get a copy of this message
Hi! I make two php scripts and a modification on Makefile.in, and with this you can build the html for one function or a chapter, by example: make file=./en/reference/mysql/functions/mysq-query.xml Build the html only for this function and make file=./en/reference/mysql/reference.xml Build all mysql functions. This is for who write/translate the docs as you can see your changes without build the entire manual, which can take one hour or more, by example, with this i generate all mysql functions in 3 minutes. I need a help with it, in process I generate a .tmp file and I want to delete it after use, but I´m good with makefiles, so I need this: if file != "manual.xml" then delete file. Instructions: 1. Apply the patch on Makefile.in and place the scripts on /scripts 2. ./configure 3. php ./scripts/geraentidades.php This creates a file with all entities(.ent files) that i include later on .tmp files. You need run this this only after configure or when a .ent file changes. 4. Use make as show above. Note that if you don´t use file=./.... it don´t change anything on build process. Patch to Makefile.in Index: Makefile.in =================================================================== RCS file: /repository/phpdoc/Makefile.in,v retrieving revision 1.146 diff -u -r1.146 Makefile.in --- Makefile.in 3 Jan 2004 12:32:15 -0000 1.146 +++ Makefile.in 10 Jan 2004 17:08:38 -0000 @@ -21,6 +21,12 @@ all: html +ifdef file +ext=.tmp +else +file=manual.xml +endif + # {{{ variables VPATH=@srcdir@ @@ -167,7 +173,8 @@ html/index.html: manual.xml $(HTML_DEPS) @test -d html || mkdir html $(PHP) -q $(scriptdir)/rtlpatch/hackmanuallang.php $(LANGDIR) - $(JADE) $(CATALOG) -d $(HTML_STYLESHEET) -V use-output-dir -t sgml $(XMLDCL) manual.xml + $(PHP) -q $(scriptdir)/compila.php $(file) + $(JADE) $(CATALOG) -d $(HTML_STYLESHEET) -V use-output-dir -t sgml $(XMLDCL) $(file)$(ext) $(PHP) -q $(scriptdir)/html_syntax.php html html/ $(PHP) -q $(scriptdir)/rtlpatch/hackmanuallang.php en $(HACK_RTL_LANGS_PAGES) **************************** geraentidades.php.in <?php /** ** by Fernando Correa da Conceição <fernandoc at php.net> **/ $saida="<!DOCTYPE book PUBLIC \"-//OASIS//DTD DocBook XML V4.1.2//EN\" \"./dtds/dbxml-4.1.2/docbookx.dtd\" ["; $lista=array("./entities/global.ent","./entities/file-entities.ent","./entities/version.ent", "./@LANG@/language-defs.ent","./@LANG@/language-snippets.ent", "./en/language-defs.ent","./en/language-snippets.ent"); foreach($lista as $filename) { if (!$handle = fopen($filename, 'r')) { echo "Error, can´t open ($filename)"; exit; } $arquivo=file_get_contents($filename); $saida.=$arquivo."\n"; } $saida.="\n]>"; $filename="./entidades.ent"; if (!$handle = fopen($filename, 'w')) { echo "Error, can´t open ($filename)"; exit; } if (!fwrite($handle, $saida)) { print "Error, can´t write ($filename)"; exit; } ?> ***************************************** compila.php <? /** ** by Fernando Correa da Conceição <fernandoc at php.net> **/ $arquivo=$argv[1]; if($arquivo == "manual.xml") exit; $linhas=file($arquivo); $entidades=file_get_contents("entidades.ent"); $linhas[1].=$entidades."\n<book>\n<article>"; $saida=join("",$linhas); $saida.="\n</article>\n</book>"; $filename=$argv[1].".tmp"; if (!$handle = fopen($filename, 'w')) { echo "Error, can´t open ($filename)"; exit; } if (!fwrite($handle, $saida)) { print "Error, can´t write ($filename)"; exit; } ?> Fernando Correa da Conceição ICQ 168518047 http://manualphp.sourceforge.net Participe da Tradução do Manual do PHP

« previous php.doc (#969358068) next »