[chapel-lang/chapel] Build llvm before starting the compiler makefile

Branch: refs/heads/master
Revision: c508c90
Author: ronawho
Log Message:

Merge pull request #16274 from ronawho/build-llvm-before-compiler

Build llvm before starting the compiler makefile

[reviewed by @mppf]

When using llvm, our compiler needs llvm to be built first, which we
already do. However, we also build up link args in our llvm makefiles,
and those were getting set at various stages during the build including
before llvm is fully built. For cases where we change what link args we
specify based on llvm versions, we were getting things wrong because
llvm wasn’t built so we couldn’t determine versions by the time we
picked arguments.

When trying to upgrade to llvm 9 the specific issue we had was that
LLVM_LIBS in compiler/Makefile was getting set before we built llvm
and those flags differ between llvm 9 and earlier versions. Instead of
trying to futz with our makefiles to get those flags reset, just make
sure llvm is built before we start the compiler makefile.

Fixes “link args problem” for https://github.com/Cray/chapel-private/issues/630

Modified Files:
M Makefile
M compiler/Makefile

Compare: https://github.com/chapel-lang/chapel/compare/420a262feb9d...c508c9054d82