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*", ); + 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 = ()[-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