kbuild: add a flag to force absolute path for srctree
In old days, Kbuild always used an absolute path for $(srctree). Since commit890676c65d("kbuild: Use relative path when building in the source tree"), $(srctree) is '.' when O= was not passed from the command line. Yet, using absolute paths is useful in some cases even without O=, for instance, to create a cscope file with absolute path tags. 'O=.' was known to work as a workaround to force Kbuild to use absolute paths even when you are building in the source tree. Since commit25b146c5b8("kbuild: allow Kbuild to start from any directory"), Kbuild is too clever to be tricked. Even if you pass 'O=.' Kbuild notices you are building in the source tree, then use '.' for $(srctree). So, 'make O=. cscope' is no help to create absolute path tags. We cannot force one or the other according to commite93bc1a0ca("Revert "kbuild: specify absolute paths for cscope""). Both of relative path and absolute path have pros and cons. This commit adds a new flag KBUILD_ABS_SRCTREE to allow users to choose the absolute path for $(srctree). 'make KBUILD_ABS_SRCTREE=1 cscope' will work as a replacement of 'make O=. cscope'. Reported-by: Pawan Gupta <pawan.kumar.gupta@linux.intel.com> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
This commit is contained in:
+1
-2
@@ -17,8 +17,7 @@ ignore="$(echo "$RCS_FIND_IGNORE" | sed 's|\\||g' )"
|
||||
# tags and cscope files should also ignore MODVERSION *.mod.c files
|
||||
ignore="$ignore ( -name *.mod.c ) -prune -o"
|
||||
|
||||
# Do not use full path if we do not use O=.. builds
|
||||
# Use make O=. {tags|cscope}
|
||||
# Use make KBUILD_ABS_SRCTREE=1 {tags|cscope}
|
||||
# to force full paths for a non-O= build
|
||||
if [ "${srctree}" = "." -o -z "${srctree}" ]; then
|
||||
tree=
|
||||
|
||||
Reference in New Issue
Block a user