Skip to content

Commit 9568817

Browse files
committed
regen_perly: automatically touch perly.c
This forces 'perly.c' to be recompiled when you type 'make' after changing 'perly.y'. (This does not happen automatically because the changes to 'perly.y' land in 'perly.act', which 'perly.c' includes but 'make' knows nothing about. Thus, even if 'perly.act' has a newer mtime, 'make' won't update 'perly.o' if it already exists.)
1 parent 25cdb82 commit 9568817

File tree

4 files changed

+13
-3
lines changed

4 files changed

+13
-3
lines changed

perly.act

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

perly.h

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

perly.tab

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

regen_perly.pl

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,16 @@
169169
read_only_bottom_close_and_rename($_, ['regen_perly.pl', $y_file]);
170170
}
171171

172+
{
173+
(my $o_file = $y_file) =~ s/\.y$/.o/;
174+
(my $c_file = $y_file) =~ s/\.y$/.c/;
175+
if (-e $o_file) {
176+
my $now = time;
177+
utime $now, $now, $c_file
178+
or warn "Can't touch $c_file: $!";
179+
}
180+
}
181+
172182
exit 0;
173183

174184

0 commit comments

Comments
 (0)