Subject: Re: [RFC PATCH v4 05/19] Makefile: use "generate-perl.sh" to massage Perl library

From: Patrick Steinhardt <[email-masked]>
Date: Mon, 11 Nov 2024 15:48:06 +0100

On Mon, Nov 11, 2024 at 09:18:35AM -0500, Paul Smith wrote:
> On Mon, 2024-11-11 at 15:13 +0100, Patrick Steinhardt wrote:
> > > case "$OUTPUT" in
> > > *.pm)
> > >   dir="$(dirname $OUTPUT)"
> > >   if ! test -d "$dir"
> > >   then
> > >   mkdir -p "$dir"
> > >   fi
> > >      ;;
> > > esac
> 
> This seems kind of complicated to me.  Why not just simply:
> 
>   case "$OUTPUT" in
>     (*.pm) mkdir -p "$(dirname $OUTPUT)" ;;
>   esac
> 
> There's no point in testing for existence of the directory before
> invoking mkdir -p IMO.
> 
> Maybe the git environment has some rules about this?

I won't use either of these. Our Makefile already knows to create the
parent directory anyway:

    perl/build/lib/%.pm: perl/%.pm generate-perl.sh GIT-BUILD-OPTIONS GIT-PERL-DEFINES
        $(call mkdir_p_parent_template)
        $(QUIET_GEN)$(SHELL_PATH) generate-perl.sh ./GIT-BUILD-OPTIONS $(GIT_VERSION) GIT-PERL-HEADER "$<" "$@"

The issue is rather that CMake didn't know to do the same, so I'm
solving this in CMake rather than in the script.

Patrick