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
--
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, visit: http://www.php.net/unsub.php