aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean-Philippe Brucker <jean-philippe.brucker@arm.com>2018-07-06 12:22:54 +0100
committerWill Deacon <will.deacon@arm.com>2018-07-06 13:13:06 +0100
commit665f1b7228b421da420c4244d5374f5ebb14644a (patch)
treed6c6c39ef05dabde960b1c6fdf2e57c0f31e3379
parent41d773e2070aabd3c4ff20c059f45c3e9a0f9d20 (diff)
downloadkvmtool-665f1b7228b421da420c4244d5374f5ebb14644a.tar.gz
Fix subfolder dependency generation
When building an object "foo.o", kvmtool also creates a ".foo.o.d" file, using the dependency generation feature of CPP. This file describes in Makefile format all headers included by foo.c. When one header is modified, make rebuilds all objects that include it. Dependency files in subfolders are currently ignored by make, because the target doesn't contain the right prefix. For example virtio/.blk.o.d has target "blk.o" instead of "virtio/blk.o". As a result, rebuilding kvmtool without first issuing a make clean can introduce sneaky bugs, where different objects use mismatched headers. To write the right targets in dependency files, add a -MT argument to CPP. Signed-off-by: Jean-Philippe Brucker <jean-philippe.brucker@arm.com> Signed-off-by: Will Deacon <will.deacon@arm.com>
-rw-r--r--Makefile2
1 files changed, 1 insertions, 1 deletions
diff --git a/Makefile b/Makefile
index 93dc0673..dfa0b62d 100644
--- a/Makefile
+++ b/Makefile
@@ -364,7 +364,7 @@ all: $(PROGRAM) $(PROGRAM_ALIAS)
# CFLAGS used when building objects
# This is intentionally not assigned using :=
-c_flags = -Wp,-MD,$(depfile) $(CFLAGS)
+c_flags = -Wp,-MD,$(depfile) -Wp,-MT,$@ $(CFLAGS)
# When building -static all objects are built with appropriate flags, which
# may differ between static & dynamic .o. The objects are separated into