ExtraSource Variable in Makefiles


I was reading (http://llvm.org/docs/Projects.html) which mentions the use of ExtraSource as a variable that can be set in project Makefiles to handle code that is generated. I couldn’t get this to work, and grepping through all the Makefile.*s in all the directories I couldn’t find any mention of “ExtraSource” except for in the Makefile.common (where it is in a comment):

4. Source - If specified, this sets the source code filenames. If this

is not set, it defaults to be all of the .cpp, .c, .y, and .l files

in the current directory. Also, if you want to build files in addition

to the local files, you can use the ExtraSource variable

Is this a bug or has the documentation simply not been updated? Is there a new way to do it?

On a slightly related note, I tend to like to put generated files in subdirectories (maybe this is a bad thing?) to keep them from cluttering the code that I’m working on. This breaks the default LLVM makefiles because it compiles foo/bar.c to Debug+Asserts/foo/bar.o and the foo directory doesn’t exist in Debug+Asserts.

I’m pretty bad with Makefiles, but the attached patch seems to fix both problems, though possibly not in the most elegant way.

Makefile.rules.patch (8.08 KB)