SOLARIS: Fix libafs $(KOBJ) parallel make race 44/13344/2
authorAndrew Deason <adeason@sinenomine.net>
Sat, 22 Sep 2018 06:58:17 +0000 (01:58 -0500)
committerBenjamin Kaduk <kaduk@mit.edu>
Fri, 28 Sep 2018 12:32:59 +0000 (08:32 -0400)
commit00aa9200be86b187c903503e56b2af55639ea2b8
tree604d06a29983aa616797b556a4ec4655d3f36d8b
parent68be8d7a1884fe678016b5ea20c16b3b124e8406
SOLARIS: Fix libafs $(KOBJ) parallel make race

Currently, our COMPDIRS make rule for SOLARIS libafs builds looks like
this:

    ${COMPDIRS} ${INSTDIRS} ${DESTDIRS}:
        for t in $(KOBJ) ; do
            # set some variables ; \
            cd $$t ; \
            $(MAKE) $@_libafs || exit $$? ; \
            cd ../ ;\
        done

And Makefile.common has this:

    all: setup $(COMPDIRS)

Where the 'setup' rule creates the $(KOBJ) dirs and sets up some
symlinks.

For parallel builds, this means that our commands in the ${COMPDIRS}
target can be running in parallel with the 'setup' target, and so our
$(KOBJ) dirs may not exist by the time we try to 'cd $$t'.

For single-KOBJ platforms this actually largely works, since the 'cd'
will fail, but then the subsequent 'make' will run (just in the wrong
dir), but this can cause us to wastefully re-compile the same source
files (and cause some possibly confusing error messages). For
platforms with multiple KOBJs, this causes obvious problems, since we
don't cd into each KOBJ dir.

To solve this, just have the ${COMPDIRS}/etc rule depend on setup, so
we know that 'setup' has finished running. Also change our way of
'cd'ing into each KOBJ dir to actually cause the rule to fail, to make
any errors here more obvious and consistent.

Change-Id: Id2e662f36ef47a6182716728167b2da4713893c6
Reviewed-on: https://gerrit.openafs.org/13344
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
src/libafs/MakefileProto.SOLARIS.in