help-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to automatically update a automatically generated dependence fil


From: Peng Yu
Subject: Re: How to automatically update a automatically generated dependence file?
Date: Sat, 25 Oct 2008 09:24:59 -0500

> Here's a correct, *tested* makefile:
> --------
> .PHONY: all clean
>
> SRC = main.cpp
> COMPILE.cpp += -MMD -MP
>
> all: main.exe
>
> main.exe : main.o
>        $(LINK.cpp) $< $(LOADLIBES) $(LDLIBS) -o $@
>
> -include $(SRC:.cpp=.d)
>
> clean:
>        @$(RM) *.o *.exe *.d
> --------

This works. But I want to understand how this works. 'main.d' is the following.

-------------------------------------------------
main.o: main.cpp print.hpp nothing1.hpp nothing3.hpp

print.hpp:

nothing1.hpp:

nothing3.hpp:
---------------------------------------------

How do the last three rules come into play?

Suppose I nothing1.cpp so that it includes nothing2.hpp, and I rename
nothing3.hpp to nothing2.hpp. Why remake would be success?

Thanks,
Peng




reply via email to

[Prev in Thread] Current Thread [Next in Thread]