Re: tool to find .h dependencies in C++



Hi, Ray


$(CPP) $(INC_DIR) -MM -MF "$(DEPDIR)/$*.dep" -c $<

g++ -I./includes -I./headers -MM -MF myclass.dep -c myclass.cpp

It's really easy to make target in Makefile to produce dependecies
files for each *.cpp
As example

..PHONY : dep
DEPS=$(SRCS:.cpp=.dep)

dep: $(DEPS)

%.dep : %.cpp
$(CPP) $(INC_DIR) -MM -MF "$(DEPDIR)/$*.dep" -c $<

And include your depences files into Makefile

sinclude $(DEPDIR)/*.dep

Good Day
--
Alexander Pazdnikov

.



Relevant Pages

  • Re: Function of make dep : newbie :-?
    ... David Z Maze wrote in message ... which the function of make dep? ... > It depends on how the makefile is set up (search for a line that says ... ...and if you wonder what it does in a kernel recompile ...
    (Debian-User)
  • Re: How to write a Makefile for this requirement?
    ... > I have the following Makefile which works if I have only one main*.cc ... generating ONE target. ... .PHONY: all clean ... Here's the auto-generated header .dep: ...
    (comp.unix.programmer)
  • Re: How to specify the dependence between hearder files?
    ... Do you mean that I have to run "make .dep" before I run "make"? ... I write makefile in a way such that I can simply type "make"? ... .PHONY: all clean ... CXXFLAGS:= $-I$ ...
    (comp.unix.programmer)
  • Re: Compiling Linux Kernel for ML405
    ... I don't understand either but the Makefile was clearly at fault. ... tree before running make menuconfig, make dep, etc... ... # Linux file to EXPORT_SYMBOL all of the Xilinx entries. ... I had to modify the calls in arch/ppc/boot/simple/embed_config.c to include this extra parameter which I specified as XIIC_STOP. ...
    (comp.arch.fpga)
  • [patch] Makefile: cancel implicit rules on included and top makefiles.
    ... Do not let make to do so, by canceling implicit rules on this files. ... +# We need some generic definitions from another makefile. ... # Declare the contents of the .PHONY variable as phony. ...
    (Linux-Kernel)