[cfe-dev] [llvm-dev] clang dependency generation (-Mxx) with -emit-llvm

Richard Smith via cfe-dev cfe-dev at lists.llvm.org
Tue May 17 19:03:56 PDT 2016


On Tue, May 17, 2016 at 9:06 AM, Dustyn Blasig via llvm-dev <
llvm-dev at lists.llvm.org> wrote:

> Hi All,
>
> I'm attempting to use the above-mentioned flags together but I cannot
> figure out a combination of flags that will get clang to emit the
> dependency file if the emit-llvm flag is also on. I've seen examples in the
> forums of people doing this, so it seems like it should work, but there
> must be some small mistake I'm making.
>
> clang++ -O2 -o build/network.ll network.cxx -std=c++11 -S -emit-llvm
> -target my_target -I /depot/include -I build -v -MMD -MP -MF build/
> network.ll.dep.mk -MT build/network.ll
>

That works for me:

$ touch network.cxx
$ mkdir build
$ clang++ -O2 -o build/network.ll network.cxx -std=c++11 -S -emit-llvm
-target x86_64 -I /depot/include -I build -v -MMD -MP -MF build/
network.ll.dep.mk -MT build/network.ll
$ ls build
network.ll  network.ll.dep.mk
$ cat build/network.ll.dep.mk
build/network.ll: network.cxx

Can you try running clang under strace and see whether it tries to open
your .dep.mk file?

I've tried a number of variations on the compiler -M flags to no avail. We
> do have a custom target my_target that really only adds a few additional
> defines into the environment. Do we need to specify something in our target
> to allow dependency generation?
>

Do you see a dependency file being generated if you use a different target?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20160517/7b2f1070/attachment.html>


More information about the cfe-dev mailing list