[LLVMdev] fudging the top-level Makefile

Stuart Hastings stuart at apple.com
Thu Oct 8 16:52:18 PDT 2009


Currently, to get LLVM to build "Apple-style," it's necessary to copy  
two files (utils/buildit/GNUmakefile and utils/buildit/build_llvm)  
into the top-level directory.  This is generally a PITA inside of  
Apple.  (I'll spare you the gory details.  :-)

I'd like to fix this for Apple, and I want to avoid compromising  
anybody else's build system.  I've never used CMAKE, so I would be  
very grateful if a Windows/CMAKE developer would look this over.

I'm proposing to rename the top-level Makefile to "Makefile.standard",  
and add a new, trivial top-level "Makefile" that detects the Apple  
build environment.  Every Apple-style build happens in the presence of  
an environment variable named "$RC_ARCHS".  If the magic $RC_ARCHS is  
detected, the new Makefile arranges for an Apple-style build.  If the  
magic environment variable is absent, "Makefile.standard" is included,  
and everything proceeds as usual.

I've tested this by building LLVM on OS/X:
1) with a separate build directory, e.g. "cd llvm.obj ; ../llvm/ 
configure ; make"
2) building inside the LLVM source directory, e.g. "cd llvm ; ./ 
configure ; make"
3) Apple-style (too ugly and frightening to reproduce here :-)

I've also tested this by building LLVM on my home Linux system:
1) with a separate build directory, e.g. "cd llvm.obj ; ../llvm/ 
configure ; make"
2) building inside the LLVM source directory, e.g. "cd llvm ; ./ 
configure ; make"

Comments or suggestions (or better approaches) are greatly appreciated.

Here is the patch.  I was obliged to change autoconf/configure.ac; I  
have omitted the corresponding diffs from the top-level configure  
shellscript for brevity:

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: llvmCore.diffs.txt
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20091008/949d6680/attachment.txt>
-------------- next part --------------


Note that the existing top-level Makefile will be renamed to  
"Makefile.standard".  (This doesn't show up very well in a simple SVN  
diff.)  Here is the new top-level Makefile:

-------------- next part --------------
A non-text attachment was scrubbed...
Name: Makefile
Type: application/octet-stream
Size: 467 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20091008/949d6680/attachment.obj>
-------------- next part --------------


Thank you very much in advance!

stuart


More information about the llvm-dev mailing list