[cfe-users] Writing gcc-style dependency files with clang-cl

Reid Kleckner via cfe-users cfe-users at lists.llvm.org
Mon Mar 12 14:33:56 PDT 2018


-Xclang escapes through to the -cc1 command line, which you can see by
adding -### to see what subcommands clang or clang-cl are running. It looks
like -MD and -MF map to '-dependency-file foo.dep' at the -cc1 level, so
'clang-cl -Xclang -dependency-file -Xclang foo.dep' should write makefile
dependencies into foo.dep.

We should probably add a real flag for this, though. The GCC spelling
unfortunately conflicts directly with the very frequently used VC flag /MD
(also accepted as -MD).

On Mon, Mar 12, 2018 at 8:15 AM David Blaikie <dblaikie at gmail.com> wrote:

> +Reid for clang-cl info
>
> On Tue, Mar 6, 2018 at 6:49 AM Ted Mielczarek via cfe-users <
> cfe-users at lists.llvm.org> wrote:
>
>> Hi there,
>>
>> We're continuing to work on making Firefox build with clang-cl in more
>> configurations, and one of my colleagues recently wondered[1] if we could
>> generate Makefile dependencies with clang-cl the same way we would with
>> clang or gcc (-MP -MD etc) instead of using the wrapper script[2] that we
>> use with MSVC that parses the output of -showIncludes. Passing these
>> options to clang-cl with `-Xclang` doesn't seem to work, however:
>>
>> $ clang-cl -Fohello.obj -c hello.cpp -Xclang -MP -Xclang -MD -Xclang -MF
>> -Xclang bar
>> error: unknown argument: '-MD'
>> error: unknown argument: '-MF'
>>
>> Is this something we could make work?
>>
>> Regards,
>> -Ted
>>
>> 1. https://bugzilla.mozilla.org/show_bug.cgi?id=1340588
>> 2.
>> https://dxr.mozilla.org/mozilla-central/source/python/mozbuild/mozbuild/action/cl.py
>> _______________________________________________
>> cfe-users mailing list
>> cfe-users at lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-users
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-users/attachments/20180312/f9f1ac8d/attachment.html>


More information about the cfe-users mailing list