On Mar-21, Leopold Toetsch wrote:
> Nicholas Clark wrote:
>
> >I think that this would make life easier for everyone. (because it also
> >saves
> >the 3 or 4 people on the list having to read tedious e-mail messages from
> >people about the subject)
>
> I'm currently not sure, if there are 4 people around, that compile imcc
> on native windows :-) Anyway, the current problem is not that bison/flex
> got invoked (which isn't that problem either - every project has some
> prerequesits) but is somewhere else. If there is a better solution for
> solving the generated files problem (which AFAIK currently is not on the
> air) I'll all ok with it.
I implemented a fix for this that people seemed to like a few months
back, but never got around to finishing it off and committing it. It
replaces timestamps with checksums for determining the dependencies.
Sorry about that -- I'll try to polish it off and commit it in the
next day or three, when I find the time.
I'll attach the preliminary patch I made back then, just in case
someone else feels motivated to finish it off.
Index: config/gen/makefiles/imcc.in
===================================================================
RCS file: /cvs/public/parrot/config/gen/makefiles/imcc.in,v
retrieving revision 1.4
diff -a -u -r1.4 imcc.in
--- config/gen/makefiles/imcc.in 25 Sep 2002 22:50:53 -0000 1.4
+++ config/gen/makefiles/imcc.in 6 Nov 2002 04:48:31 -0000
@@ -44,10 +44,10 @@
../../$(PARROTLIB): ../../parrot$(EXE)
cd ../.. && $(MAKE) $(PARROTLIB)
-imcparser.c : imcc.y $(H_FILES)
- $(YACC) -d -o imcparser.c imcc.y
+.PHONY: FORCE
+imcparser.h imcparser.c : imcc.y FORCE
+ $(PERL) runyacc "$(YACC) imcc.y -d -o imcparser.c" imcc.y imcparser.h
imcparser.c
-imcparser.h : imcc.y
imclexer.c : imcc.l $(H_FILES)
$(LEX) imcc.l
Index: languages/imcc/runyacc
===================================================================
RCS file: languages/imcc/runyacc
diff -N languages/imcc/runyacc
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ languages/imcc/runyacc 6 Nov 2002 04:48:31 -0000
@@ -0,0 +1,54 @@
+use strict;
+
+my $Verbose = 0;
+if ($ARGV[0] eq '-v') {
+ shift;
+ $Verbose = 1;
+}
+
+my ($command, $input, @outputs) = @ARGV;
+my $checksum;
+{
+ local $/;
+ open(INPUT, $input) or die "open $input: $!";
+ $checksum = unpack("%32C*", <INPUT>);
+ close INPUT;
+}
+
+my $up_to_date = 1;
+foreach my $output (@outputs) {
+ if (! open(OUTPUT, $output)) {
+ print "$output does not exist; remaking\n" if $Verbose;
+ $up_to_date = 0;
+ last;
+ }
+ my $checksum_line = (<OUTPUT>)[-1];
+ close OUTPUT;
+ if ($checksum_line !~ m!^/\* CHECKSUM: ([-\d+]+) \*/$!) {
+ print "$output does not have a checksum line; remaking\n" if $Verbose;
+ $up_to_date = 0;
+ last;
+ }
+ if ($1 != $checksum) {
+ print "$output was built from different version of $input; remaking\n"
+ if $Verbose;
+ $up_to_date = 0;
+ last;
+ }
+ print "$output is up to date with respect to $input\n" if $Verbose;
+}
+
+exit 0 if $up_to_date;
+
+print "$command\n";
+my $status = system($command);
+exit 1 if (! defined $status);
+exit($status >> 8) if $status != 0;
+
+foreach my $output (@outputs) {
+ open(OUTPUT, ">>$output") or die "open $output for append: $!";
+ print OUTPUT "/* CHECKSUM: $checksum */\n";
+ close OUTPUT;
+}
+
+exit 0;
Index: MANIFEST
===================================================================
RCS file: /cvs/public/parrot/MANIFEST,v
retrieving revision 1.246
diff -a -u -r1.246 MANIFEST
--- MANIFEST 4 Nov 2002 17:16:04 -0000 1.246
+++ MANIFEST 6 Nov 2002 04:48:38 -0000
@@ -1345,6 +1345,7 @@
languages/imcc/optimizer.h
languages/imcc/pbc.c
languages/imcc/pbc.h
+languages/imcc/runyacc
languages/imcc/sets.c
languages/imcc/sets.h
languages/imcc/stacks.c