Does the Visual Studio C compiler have an equivalent to GCC's -M?
c, dependencies, gcc, makefile, visual-studio
Solution
I had to deal with that exact problem. We wanted to add a script that replaces the -M option. Here's how I did it:
- find a source preprocessor ( and the include paths & defines you need )
- run it on the file you need, and it should produce a preprocessed version.
- most preprocessors have a switch that enables extra info ( such as the file where some code snippet came from )
- write a simple script to extract all the header names
- create a set out of them, so that you filter out duplicates.
It's how I've done it, and it worked. Good luck!
Problem
I would like to automatically generate a Makefile dependency list, but I am using Visual Studio 2005. If I were using GCC, I could pass -M (or one of the many variants) to create this dependency list. Looking through the command line options to `cl.exe`, I don't see anything obvious. I can handle tweaking the output with post-processing, but the closer the better.