[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: Dynamic target
From: |
Gary Oberbrunner |
Subject: |
RE: Dynamic target |
Date: |
Wed, 22 Nov 2000 13:53:55 -0500 (EST) |
>>>>> "AJ" == Alex Jacques <address@hidden> writes:
AJ> Could you send this patch to the cons-discuss mailing list? It sounds
AJ> like it might be useful in many situations.
It's so short and simple, why not. I made this patch against 1.8, but
people have reported it slips into recent versions easily.
--- cons-1.8-dev/cons-18dev Wed Feb 16 13:32:41 2000
+++ cons Thu May 11 13:47:36 2000
@@ -813,6 +813,14 @@
}
}
+sub AfterBuild {
+ my($env) = shift;
+ my($perl_eval_str) = pop(@_);
+ for $file (map($dir::cwd->lookup($_), @_)) {
+ $file->{after_build_func} = $perl_eval_str;
+ }
+}
+
sub Install {
my($env) = shift;
my($tgtdir) = $dir::cwd->lookupdir($env->_subst(shift));
@@ -2219,7 +2227,15 @@
# Build the file, if necessary.
sub build {
- $_[0]->{status} || &file::_build;
+ return $_[0]->{status} if $_[0]->{status};
+ my $status = &file::_build;
+ if ($_[0]->{after_build_func}) {
+ package script;
+ eval($_[0]->{after_build_func});
+ printf("Error running after_build_func for %s: address@hidden",
+ $_[0]->path) if ($@);
+ }
+ return $status;
}
sub _build {
@@ -4300,6 +4316,15 @@
allowing incremental updates to libraries or debug information files
which are updated rather than rebuilt anew each time. Cons will still
delete the files when the C<-r> flag is specified.
+
+=item B<The >B<AfterBuild>B< method>
+
+The C<AfterBuild> method eval's the given perl string (in the
+C<script> package) after building the given file (or finding that it
+is up to date). The eval will only happen once. C<AfterBuild> is
+called as follows:
+
+ AfterBuild $env 'foo.o', qq(print "foo.o is up to date!\n");
=item B<The >B<Command>B< method>
--
. . . . . . . . . . . . . . . . . . . . . . . . .
Gary Oberbrunner address@hidden
GenArts, Inc. Tel: 617-492-2888
8 Clinton Street Fax: 617-492-2852
Cambridge, MA 02139 USA http://web.genarts.com
- RE: Dynamic target: for the sake of clarity, (continued)
- RE: Dynamic target: for the sake of clarity, Zachary Deretsky, 2000/11/15
- RE: Dynamic target: for the sake of clarity, Steven Knight, 2000/11/16
- AfterBuild, Dynamic target/dynamic dependencies: How?, Zachary Deretsky, 2000/11/22
- RE: AfterBuild, ... Correction, Zachary Deretsky, 2000/11/22
- Re: AfterBuild, Dynamic target/dynamic dependencies: How?, Steven Knight, 2000/11/29
- Dynamic target: How to get a file from source irectory to the linked build directory?, Zachary Deretsky, 2000/11/15
- Re: Dynamic target: How to get a file from source irectory to the linked build directory?, Steven Knight, 2000/11/16
- Re: Dynamic target: How to get a file from source irectory to the linked build directory?, Frank Thomas, 2000/11/16
AfterBuild, Giovanni Pietrobon, 2000/11/16
RE: Dynamic target, Alex Jacques, 2000/11/20
- RE: Dynamic target,
Gary Oberbrunner <=