rules: don't try to create missing include dirs
PATCH 1/1 rules: don't try to create missing include dirs
In
commit ba78db44f6532d66a1e704bd44613e841baa2fc5
Author: Daniel P. Berrange <[email protected]>
Date: Wed Jan 25 16:14:10 2017 +0000
make: move top level dir to end of include search path
The dir $(BUILD_DIR)/$(@D) was added to the include path. This would sometimes point to a non-existant directory, if the sub-dir in question did not contain any target-independant files (eg tcg/). To deal with this the rules.mak attempted to create the directory.
While this was succesful, it also caused accidental creation of files in the parent of the build dir. e.g. when building common source files into target specific output files.
Rather than trying to workaround this, just revert the code that attempted to mkdir the missing include directories. Instead just turn off the compiler warning in question as the missing dir is expected & harmless in general.
--- configure | 2 +- rules.mak | 1 - 2 files changed, 1 insertion(+), 2 deletions(-)
configure +1 -1
@@ -1474,7 +1474,7 @@ fi gcc_flags="-Wold-style-declaration -Wold-style-definition -Wtype-limits" gcc_flags="-Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers $gcc_flags" -gcc_flags="-Wmissing-include-dirs -Wempty-body -Wnested-externs $gcc_flags" +gcc_flags="-Wno-missing-include-dirs -Wempty-body -Wnested-externs $gcc_flags" gcc_flags="-Wendif-labels -Wno-shift-negative-value $gcc_flags" gcc_flags="-Wno-initializer-overrides $gcc_flags" gcc_flags="-Wno-string-plus-int $gcc_flags"
rules.mak +0 -1
@@ -374,7 +374,6 @@ define unnest-vars $(eval $(o:%.mo=%$(DSOSUF)): module-common.o $($o-objs)), $(error $o added in $v but $o-objs is not set))) $(shell mkdir -p ./ $(sort $(dir $($v)))) - $(shell cd $(BUILD_DIR) && mkdir -p ./ $(sort $(dir $($v)))) # Include all the .d files $(eval -include $(patsubst %.o,%.d,$(patsubst %.mo,%.d,$($v)))) $(eval $v := $(filter-out %/,$($v))))
Signature · 1 line
2.9.3
Quoted 6 lines · Daniel P. Berrange
Rather than trying to workaround this, just revert the code that attempted to mkdir the missing include directories. Instead just turn off the compiler warning in question as the missing dir is expected & harmless in general.
Signed-off-by Daniel P. Berrange <[email protected]>
Berto
Quoted 14 lines · Daniel P. Berrange
In
commit
ba78db44f6532d66a1e704bd44613e841baa2fc5
Author: Daniel P. Berrange <[email protected]>
Date: Wed Jan 25 16:14:10 2017 +0000make: move top level dir to end of include search path
The dir $(BUILD_DIR)/$(@D) was added to the include path. This would sometimes point to a non-existant directory, if the sub-dir in question did not contain any target-independant files (eg tcg/). To deal with this the rules.mak attempted to create the directory.
Quoted 4 lines
While this was succesful, it also caused accidental creation of files in the parent of the build dir. e.g. when building common source files into target specific output files.
Aha, that's where those directories came from!
Quoted 30 lines
Rather than trying to workaround this, just revert the code that attempted to mkdir the missing include directories. Instead just turn off the compiler warning in question as the missing dir is expected & harmless in general.
Signed-off-by Daniel P. Berrange <[email protected]>--- configure | 2 +- rules.mak | 1 - 2 files changed, 1 insertion(+), 2 deletions(-)configure +1
-1@@ -1474,7 +1474,7 @@ fi gcc_flags="-Wold-style-declaration -Wold-style-definition -Wtype-limits" gcc_flags="-Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers $gcc_flags" -gcc_flags="-Wmissing-include-dirs -Wempty-body -Wnested-externs $gcc_flags" +gcc_flags="-Wno-missing-include-dirs -Wempty-body -Wnested-externs $gcc_flags" gcc_flags="-Wendif-labels -Wno-shift-negative-value $gcc_flags" gcc_flags="-Wno-initializer-overrides $gcc_flags" gcc_flags="-Wno-string-plus-int $gcc_flags"rules.mak +0
-0
rules.mak define unnest-vars · line 377
Quoted 4 lines
rules.mak +0
-1@@ -374,7 +374,6 @@ define unnest-vars $(eval $(o:%.mo=%$(DSOSUF)): module-common.o $($o-objs)), $(error $o added in $v but $o-objs is not set))) $(shell mkdir -p ./ $(sort $(dir $($v)))) - $(shell cd $(BUILD_DIR) && mkdir -p ./ $(sort $(dir $($v))))
I know this is the same syntax as the existing line above and we're deleting it anyway, but what does it actually do? When does telling mkdir to create "./" make sense?
thanks
-- PMM
Quoted 52 lines · Peter Maydell
Quoted 14 lines · Daniel P. Berrange
In
commit
ba78db44f6532d66a1e704bd44613e841baa2fc5
Author: Daniel P. Berrange <[email protected]>
Date: Wed Jan 25 16:14:10 2017 +0000make: move top level dir to end of include search path
The dir $(BUILD_DIR)/$(@D) was added to the include path. This would sometimes point to a non-existant directory, if the sub-dir in question did not contain any target-independant files (eg tcg/). To deal with this the rules.mak attempted to create the directory.
Quoted 4 lines
While this was succesful, it also caused accidental creation of files in the parent of the build dir. e.g. when building common source files into target specific output files.
Aha, that's where those directories came from!
Quoted 30 lines
Rather than trying to workaround this, just revert the code that attempted to mkdir the missing include directories. Instead just turn off the compiler warning in question as the missing dir is expected & harmless in general.
Signed-off-by Daniel P. Berrange <[email protected]>--- configure | 2 +- rules.mak | 1 - 2 files changed, 1 insertion(+), 2 deletions(-)configure +1
-1@@ -1474,7 +1474,7 @@ fi gcc_flags="-Wold-style-declaration -Wold-style-definition -Wtype-limits" gcc_flags="-Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers $gcc_flags" -gcc_flags="-Wmissing-include-dirs -Wempty-body -Wnested-externs $gcc_flags" +gcc_flags="-Wno-missing-include-dirs -Wempty-body -Wnested-externs $gcc_flags" gcc_flags="-Wendif-labels -Wno-shift-negative-value $gcc_flags" gcc_flags="-Wno-initializer-overrides $gcc_flags" gcc_flags="-Wno-string-plus-int $gcc_flags"rules.mak +0
-0@@ -374,7 +374,6 @@ define unnest-vars
Quoted 8 lines
rules.mak define unnest-vars · line 377
Quoted 4 lines
rules.mak +0
-1$(eval $(o:%.mo=%$(DSOSUF)): module-common.o $($o-objs)), $(error $o added in $v but $o-objs is not set))) $(shell mkdir -p ./ $(sort $(dir $($v)))) - $(shell cd $(BUILD_DIR) && mkdir -p ./ $(sort $(dir $($v))))I know this is the same syntax as the existing line above and we're deleting it anyway, but what does it actually do? When does telling mkdir to create "./" make sense?
No idea why the ./ was there originally - it appears to serve no purpose. The useful bit is the stuff afterwards - the $($v) bit. It gets populated based on the variable being unnested. For example
block-obj-y = block.o blockjob.o block/ nbd/
will make $v contain "block nbd", hence cause creation of those dirs in the the build dir.
Regards,
Daniel
Signature · 3 lines
|: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://entangle-photo.org -o- http://search.cpan.org/~danberr/ :|
Quoted 5 lines · Daniel P. Berrange
Quoted 5 lines
Quoted 2 lines
$(shell mkdir -p ./ $(sort $(dir $($v))))- $(shell cd $(BUILD_DIR) && mkdir -p ./ $(sort $(dir $($v))))
I know this is the same syntax as the existing line above and we're deleting it anyway, but what does it actually do? When does telling mkdir to create "./" make sense?
Quoted 8 lines
No idea why the ./ was there originally - it appears to serve no purpose. The useful bit is the stuff afterwards - the $($v) bit. It gets populated based on the variable being unnested. For example
block-obj-y = block.o blockjob.o
block/nbd/will make $v contain "block nbd", hence cause creation of those dirs in the the build dir.
"mkdir -p" with no arguments gives an error, the "./" shuts it up.
Paolo
Quoted 12 lines · Paolo Bonzini
Quoted 9 lines · Daniel P. Berrange
Quoted 5 lines
Quoted 2 lines
$(shell mkdir -p ./ $(sort $(dir $($v))))- $(shell cd $(BUILD_DIR) && mkdir -p ./ $(sort $(dir $($v))))
I know this is the same syntax as the existing line above and we're deleting it anyway, but what does it actually do? When does telling mkdir to create "./" make sense?
No idea why the ./ was there originally - it appears to serve no purpose. The useful bit is the stuff afterwards - the $($v) bit. It gets populated based on the variable being unnested. For example
Quoted 6 lines
Quoted 4 lines
block-obj-y = block.o blockjob.o
block/nbd/will make $v contain "block nbd", hence cause creation of those dirs in the the build dir.
"mkdir -p" with no arguments gives an error, the "./" shuts it up.
Ah yes, clever. So that deals with case of unnesting a variable which does not contain any nested dirs.
Regards,
Daniel
Signature · 3 lines
|: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://entangle-photo.org -o- http://search.cpan.org/~danberr/ :|
Quoted 19 lines · Daniel P. Berrange
In
commit
ba78db44f6532d66a1e704bd44613e841baa2fc5
Author: Daniel P. Berrange <[email protected]>
Date: Wed Jan 25 16:14:10 2017 +0000make: move top level dir to end of include search path
The dir $(BUILD_DIR)/$(@D) was added to the include path. This would sometimes point to a non-existant directory, if the sub-dir in question did not contain any target-independant files (eg tcg/). To deal with this the rules.mak attempted to create the directory.
While this was succesful, it also caused accidental creation of files in the parent of the build dir. e.g. when building common source files into target specific output files.
Quoted 8 lines
Rather than trying to workaround this, just revert the code that attempted to mkdir the missing include directories. Instead just turn off the compiler warning in question as the missing dir is expected & harmless in general.
Signed-off-by Daniel P. Berrange <[email protected]>---
Thanks; planning to apply this to master as a buildfix with the following added to the commit message:
NB: you can clean up a build directory parent that has
been filled with empty directories by commit ba78db44f653 using this GNU find command in that parent directory:
find audio backends block chardev crypto disas fsdev hw io linux-user \
migration nbd net qapi qom replay slirp target ui util \
-type d -empty -delete
thanks
-- PMM
Quoted 25 lines · Daniel P. Berrange
In
commit
ba78db44f6532d66a1e704bd44613e841baa2fc5
Author: Daniel P. Berrange <[email protected]>
Date: Wed Jan 25 16:14:10 2017 +0000make: move top level dir to end of include search path
The dir $(BUILD_DIR)/$(@D) was added to the include path. This would sometimes point to a non-existant directory, if the sub-dir in question did not contain any target-independant files (eg tcg/). To deal with this the rules.mak attempted to create the directory.
While this was succesful, it also caused accidental creation of files in the parent of the build dir. e.g. when building common source files into target specific output files.
Rather than trying to workaround this, just revert the code that attempted to mkdir the missing include directories. Instead just turn off the compiler warning in question as the missing dir is expected & harmless in general.
Quoted 5 lines
Signed-off-by Daniel P. Berrange <[email protected]>--- configure | 2 +- rules.mak | 1 - 2 files changed, 1 insertion(+), 2 deletions(-)