Thanks Paul!

Correct some of my misunderstanding:


```
%.d: %.c
set -e; rm -f $@; \
$(CC) -M $(CPPFLAGS) $< &gt; $@.$$$$; \
sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ &gt; $@; \
rm -f $@.$$$$
```


the .d file depends on `.c` source file as stated in rule ` %.d: %.c `.


the sed command puts the `.d` file as the target of both `.c` and `.h` files.
this makes `.d` file depend on `.h` header file too.


it will regenerate the `.d` file even when the header file is changed.
```
main.o : main.c defs.h
main.o main.d : main.c defs.h
```

Reply via email to