make dependencies

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
User avatar
Walling
Member
Member
Posts: 158
Joined: Mon Dec 04, 2006 6:06 am
Location: Berlin, Germany

make dependencies

Post by Walling »

Hi,

Does someone know if it is possible to make the 'make' tool "automagically" find header files dependencies (.h files), ie. when I include "xxx.h" in "xxx.cpp" and I edit "xxx.h" 'make' should recompile "xxx.cpp". It should somehow parse the .cpp/.c files and find all dependencies to .h files. The same applied to .asm files included in other .asm files.
User avatar
Solar
Member
Member
Posts: 7615
Joined: Thu Nov 16, 2006 12:01 pm
Location: Germany
Contact:

Post by Solar »

Note the trick I mentioned in that other posts depends on cpp (the preprocessor), not necessarily gcc (the C compiler). For example, if you use GNU as as assembler, and cpp as preprocessor (i.e., #include ...), it works just as well.

If your assembler of choice doesn't offer something like this, it might be an idea to tweak your toolchain so that you use cpp for handling the includes, instead of using your assembler's native include functionality.
Every good solution is obvious once you've found it.
User avatar
Walling
Member
Member
Posts: 158
Joined: Mon Dec 04, 2006 6:06 am
Location: Berlin, Germany

Post by Walling »

Thanks, I will try it. :)

I try to make my project build on both Linux (GCC) and Windows (DJGPP). There has been some challenges. To get the above code to work with DJGPP/Windows could be one as well, but I will look into it.

I'm currently using NASM. I like the syntax better. But maybe I could preprocess the .asm files with 'cpp'. On the other hand I'm not editing the .asm files as often as .cpp files, so it shouldn't be a problem.
Post Reply