I have already successfully created a loadable module to perform a
transformation pass that is used by LLVM's opt program.
However, now I would like to incorporate a specialized parser (built with
flex and bison) within that very same loadable module. This parser's
function is to parse a simple language that will be used to specify how and
where to perform the transformations.
What I have right now is a single cpp file (transform.cpp) and corresponding
Makefile in a "project" directory, and a "parser" subdirectory directly
under the "project" directory that contains all the parser source code (i.e.
lang.l, lang.y, etc.) and corresponding Makefile for creating the scanner
and parser object files. The Makefile under the "project" directory
(similar to what is in the LLVM documenation) was used successfully to a
perform transformation pass using LLVM's opt, but now I am having trouble
with incorporating the parser Makefile.
I would be very grateful if someone could tell me how to get these two
"user" makfiles to coordinate with each other to create one LLVM loadable
module using LLVM's makefile system. Some more specific questions are the
1) Which variables should I use in the Makefile under the "project"
directory to refer to the Makefile in the "parser" subdirectory? Is it
something like ( DIRS = parser )?
2) What should the Makefile under the "parser" subdirectory contain to allow
the objects created from there to be part of the loadable module specified
in project module? How does the default target of "all" fit in here?
Note that I am doing some tricks in the "parser" Makefile to create a C++
compatible parser, so I was hoping that I could keep it fairly intact and
just modify it somewhat to fit in with LLVM's makefile system.
If there is a better way, or if someone could point me to a relevant example
please let me know. I will gladly supply more specifics if it will help. I
understand the basics of Make but not its advanced features.
Thanks in advance for any response,
Senior Research Analyst
Communications and Embedded Systems Department
Southwest Research Institute