Fix race condition in build.mk