On Thu, Oct 28, 2021 at 09:45:14AM -0700, Junio C Hamano wrote: > Jeff King <peff@xxxxxxxx> writes: > > > There's an in-between, I'd think, where the many "foo/bar/baz/$@" > > targets have an order-dependency on "foo/bar/baz", and that single rule > > uses "mkdir -p" to create all of the directories. > > > > It doesn't buy us much simplification in this case, though, because > > various rules independently depend on .build/gitlink/lint-docs/howto, > > .built/gitlink/lint-docs, and .build/gitlink, etc. So we still end up > > with roughly the same number of rules, though the directory rules don't > > have to depend on one another. > > > > It also means that these "mkdir -p" may race with each other, though in > > general I'd hope that most "mkdir" implements could handle this. > > > > Something like this works, I think: > > Hmph, what I actually meant was to make sure that the recipe to > create the files to have "mkdir -p $(basename $@)" in front, instead > of having "we need to prepare the containing directory in order to > have a file there" in the makefile. Yeah, I agree that's simpler, and is what Ævar showed. But it is slower, because we run a bunch of redundant "mkdir -p" calls, one per file. -Peff