This repository has been archived by the owner on Jul 30, 2021. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Makefile: Remove 'clean' prerequisite from build targets
'clean' has been a prerequisite for: * conformance-%, since the target landed in 0520bdf (hack: add conformance tests for hack builds, 2016-05-26, #45). * release, since the target landed in 04848d1 (Add release build process, 2016-05-27, #47). clean-vm-% target has been a prerequisite for run-% since the target landed in 9e2e89e (run make target, 2016-09-23, #141). But there are two problems with including cleaners are prerequisites of build steps: * They are inefficient. Make is good at rebuilding only things that need rebuilding, provided you inform it of your dependencies. Cleaning before every build will often lead to unnecessary rebuilds of up-to-date content. * They are racy. For example, a parallel make invocation may process several prerequisites at once. The current 'clean' recipe will execute quickly, which is why it hasn't been much of a problem yet, but you can see the race by inserting a delay: clean: sleep 60 rm -rf _output and running: $ make -j8 release sleep 60 mkdir -p _output/bin/darwin/ GOOS=darwin GOARCH=amd64 go build ... ... mkdir -p _output/release/ tar czf _output/release/bootkube.tar.gz -C _output bin/linux/bootkube bin/darwin/bootkube bin/linux/checkpoint rm -rf _output with the other preqrequisites completing first, clean's rm ends up removing everything release generated. In this commit, I've removed the clean prerequisites from the build targets to resolve the above issues. I've also updated our recommended make invocations to add clean as an explicit earlier step. This ensures folks following our directions get the same behavior as they would have previously (since our recommendations are all implicitly -j1 and rm is fast anyway). I think the extra clean calls may be overkill in at least some cases, but I'll remove them one by one in follow-up commits.
- Loading branch information