register_prerequisite_file( $myFile ); //or cli option to generate dependency list

From: Date: Sun, 12 Jan 2003 07:13:04 +0000
Subject: register_prerequisite_file( $myFile ); //or cli option to generate dependency list
Groups: php.dev 
Request: Send a blank email to php-dev+get-93361@lists.php.net to get a copy of this message
I use php a lot to process php files in a makefile driven build environment I have written: xmake.org I think it would be nice to have an option to sapi/cli to generate a list of dependencies, like gcc -M get_included_files() is useful, but not sufficient since it only reports included or required files - any other dependencies are not detected, such as files opened by other means such as file(), file_exists(), .... I use the following macro in my makefile to generate a rule for the input source file $(1). # Command to generate a list of dependencies from a source file (including the source file) # $(1) - source file define XMakeExt_php.cli_dependCmd $(shell /usr/local/bin/php -r 'ob_start(); include "$(1)";ob_end_clean() ; $$files = get_included_files(); foreach($$files as $$file) echo "$$file ";') endef I'd like to know what others think might be a good solution. I see two options: 1. give sapi/cli an option to auto-detect dependencies 2. Add a simple a function you could call to register a prerequisite file such as: <?php register_prerequisite_file( $myFile ); // code follows which uses the file for something... $array=($myFile); ?> I think PHP is a great tool for command line scripting but without dependency-detection, applications are limited. - Greg Keraunen http://www.xmake.org http://www.xmlmake.com

« previous php.dev (#93361) next »