[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
How to adding pathes to dependencies in rules of `.d` files
From: |
ljh |
Subject: |
How to adding pathes to dependencies in rules of `.d` files |
Date: |
Sat, 4 Mar 2023 21:49:41 +0800 |
Hi community,
I managed to do out-of-source build.
I use `CPPFLAGS += -MMD -MP` to generate `.d` files.
The `.d` files and the source files are not in the same directory now.
`make` addes path the the target `.o` part,
but not the prerequisites parts `.c`, `.h`.
So, the rules in `.d` files will not take effect.
Now, If I `touch` my `.h` files, it will not re-build the source files.
Is there a way to inform `make` to add path to the prerequisites too?
Thanks
$ cat build/build/foo/foo.d
/home/ljh/Documents/make/src/build/build/foo/foo.o: foo.c foo.h
foo.h:
$
$ tree --charset C
.
|-- build
| `-- build
| |-- foo
| | |-- foo
| | |-- foo.d
| | |-- foo.o
| | `-- libfoo.so
| `-- main
| |-- main
| |-- main.d
| `-- main.o
|-- foo
| |-- foo.c
| |-- foo.h
| `-- Makefile
|-- main
| |-- main.c
| `-- Makefile
`-- Makefile
$
- How to adding pathes to dependencies in rules of `.d` files,
ljh <=