On Wed, Sep 14, 2022 at 03:08:06PM +1200, Thomas Munro wrote:
> On Wed, Sep 14, 2022 at 10:23 AM Thomas Munro <thomas.munro@gmail.com> wrote:
> > Given the simplicity of this case, though, I suppose we could
> > have a little not-very-general shell/python/whatever wrapper script --
> > just compute a checksum of the input and keep the output files around.
>
> Something as dumb as this perhaps...
> if [ -z "$c_file" ] ; then
> c_file="(echo "$y_file" | sed 's/\.y/.tab.c/')"
> fi
This looks wrong. I guess you mean to use $() and missing "$" ?
It could be:
[ -z "$c_file" ] &&
c_file=${y_file%.y}.tab.c
> if [ -z "$SIMPLE_BISON_CACHE_PATH" ] ; then
> SIMPLE_BISON_CACHE_PATH="/tmp/simple-bison-cache"
> fi
Should this default to CCACHE_DIR? Then it would work under cirrusci...
> h_file="$(echo $c_file | sed 's/\.c/.h/')"
Could be ${c_file%.c}.h
> if [ ! -e "$cached_c_file" -o ! -e "$cached_h_file" ] ; then
You could write the easy case first (I forget whether it's considered to
be more portable to write && outside of []).
> if [ -e "$cached_c_file" ] && [ -e "$cached_h_file" ] ; then
I can't see what part of this would fail to handle filenames with spaces
(?)
--
Justin