chapel-lang/chapel — pull request #1072 by thomasvandoren (2014-12-23 22:31:21+00:00)
Title: Fix makefile race when compiling driver.cpp.

The LICENSE, COPYRIGHT, and driver.o recipe did not state their dependencies,
so previously they could all run simultaneously. Note that driver.cpp #include
the LICENSE and COPYRIGHT files from compiler/main/. In most cases this worked
as expected, but on some systems (probably those with slow file systems) the
driver.cpp compilation could start before LICENSE or COPYRIGHT rules were
finished. This resulted in a #include error (could not find file) for the
driver.cpp.

Update object rule, `$(OBJ_SUBDIR)/%.o` to have an optional dependency
specified by `$(OBJ_PREREQS)`. Then update compiler/main/Makefile to declare
OBJ_PREREQS as LICENSE and COPYRIGHT. This ensures the LICENSE and COPYRIGHT
will be processed before any of the object files are built. (It is a big
hammer, but it was the simplest solution I could think of.)

To verify this works, I ran the following on the system that was exhibiting the issue:

```bash
for i in $(seq 0 200) ; do
echo $i && \
git clean -dxf main/gen/ main/LICENSE main/COPYRIGHT ifa/ && \
make -j8 DEBUG=0 WARNINGS=1 OPTIMIZE=1 || \
break
done
```