Of course you are right, as usual.  I just felt like that was a lot of
hoop-jumping.  People already chide me for my affinity for baroque
Makefiles...

On Sat, Jan 26, 2019 at 11:01 AM Ian Lance Taylor <i...@golang.org> wrote:
>
> On Fri, Jan 25, 2019 at 7:55 PM Tim Hockin <thoc...@google.com> wrote:
> >
> > Fair point, of course.
> >
> > I care because Kubernetes and it's family of projects have Makefiles to 
> > encapsulate trickier aspects of building, including code generation.  
> > Compiling kubernetes takes a LONG time.  It would be nice to avoid 
> > re-triggering secondary actions when the primary artifacts have not changed.
> >
> > Could I checksum?  Sure, but then I am writing a custom builder, so I might 
> > as well use Bazel (which has other issues).
> >
> > It's not a huge deal, today, but I really wanted to understand it.  It just 
> > seemed broken.
>
> While understanding that the approach is second best, Makefiles are
> fully able to handle files that have the same contents but updated
> timestamps.  You separate the file you create and the file you use.
> Then you write a Makefile target like
>
> progtouse: stmp-progtouse; @true  # Yes, the "; @true" is important.
> stmp-progtouse: dependencies to build progtobuild
>         # commands to build progtobuild
>         $(SHELL) mvifdiff.sh progtobuild progtouse
>         echo >$@
>
> The shell script mvifdiff.sh is simply
>
> if cmp -s "$1" "$2" ; then
>   rm -f -- "$1"
> else
>   mv -f -- "$1" "$2"
> fi
>
> Then everything else depends on, and uses, progtouse.
>
> Remember to remove stmp-progtouse in your clean targets.
>
> Ian

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to