tools: fix dependency file generation
PATCH 1/1 tools: fix dependency file generation
There is a small set of places where files in subdirectories get compiled from the parent directory. Dependency file wise this is no problem as long as the files use names distinct without regard to the directories they sit in, and tools/console/ violates this (in having two main.c files). Hence we need to avoid losing the directory name, both to ensure the two compiler instances don't simultaneously write to the same file (happening of which is what triggered me looking into this) and to guarantee dependencies for all files will be seen by make on an incremental rebuild.
tools/Rules.mk +1 -1
@@ -62,7 +62,7 @@ SHLIB_libxenlight = -Wl,-rpath-link=$(X CFLAGS += -D__XEN_TOOLS__ # Get gcc to generate the dependencies for us. -CFLAGS += -MMD -MF .$(@F).d +CFLAGS += -MMD -MF .$(if $(filter-out .,$(@D)),$(subst /,@,$(@D))@)$(@F).d DEPS = .*.d ifneq ($(FILE_OFFSET_BITS),)
tools: fix dependency file generation
There is a small set of places where files in subdirectories get compiled from the parent directory. Dependency file wise this is no problem as long as the files use names distinct without regard to the directories they sit in, and tools/console/ violates this (in having two main.c files). Hence we need to avoid losing the directory name, both to ensure the two compiler instances don't simultaneously write to the same file (happening of which is what triggered me looking into this) and to guarantee dependencies for all files will be seen by make on an incremental rebuild.
tools/Rules.mk +1 -1
@@ -62,7 +62,7 @@ SHLIB_libxenlight = -Wl,-rpath-link=$(X CFLAGS += -D__XEN_TOOLS__ # Get gcc to generate the dependencies for us. -CFLAGS += -MMD -MF .$(@F).d +CFLAGS += -MMD -MF .$(if $(filter-out .,$(@D)),$(subst /,@,$(@D))@)$(@F).d DEPS = .*.d ifneq ($(FILE_OFFSET_BITS),)
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 11 lines · Jan Beulich
There is a small set of places where files in subdirectories get compiled from the parent directory. Dependency file wise this is no problem as long as the files use names distinct without regard to the directories they sit in, and
tools/console/violates this (in having twomain.cfiles). Hence we need to avoid losing the directory name, both to ensure the two compiler instances don't simultaneously write to the same file (happening of which is what triggered me looking into this) and to guarantee dependencies for all files will be seen by make on an incremental rebuild.Signed-off-by Jan Beulich <[email protected]>
Took me a while to grok the make functions (short answer foo/bar.o => [email protected]). Looks good:
Quoted 15 lines
tools/Rules.mk +1
-1@@ -62,7 +62,7 @@ SHLIB_libxenlight = -Wl,-rpath-link=$(X CFLAGS += -D__XEN_TOOLS__ # Get gcc to generate the dependencies for us. -CFLAGS += -MMD -MF .$(@F).d +CFLAGS += -MMD -MF .$(if $(filter-out .,$(@D)),$(subst /,@,$(@D))@)$(@F).d DEPS = .*.d ifneq ($(FILE_OFFSET_BITS),)