ocfs2: improve ocfs2 Makefile
authorLarry Chen <[email protected]>
Fri, 28 Dec 2018 08:32:46 +0000 (00:32 -0800)
committerLinus Torvalds <[email protected]>
Fri, 28 Dec 2018 20:11:45 +0000 (12:11 -0800)
Included file path was hard-wired in the ocfs2 makefile, which might
causes some confusion when compiling ocfs2 as an external module.

Say if we compile ocfs2 module as following.
cp -r /kernel/tree/fs/ocfs2 /other/dir/ocfs2
cd /other/dir/ocfs2
make -C /path/to/kernel_source M=`pwd` modules

Acutally, the compiler wil try to find included file in
/kernel/tree/fs/ocfs2, rather than the directory /other/dir/ocfs2.

To fix this little bug, we introduce the var $(src) provided by kbuild.
$(src) means the absolute path of the running kbuild file.

Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Larry Chen <[email protected]>
Reviewed-by: Andrew Morton <[email protected]>
Cc: Mark Fasheh <[email protected]>
Cc: Joel Becker <[email protected]>
Cc: Junxiao Bi <[email protected]>
Cc: Joseph Qi <[email protected]>
Cc: Changwei Ge <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
fs/ocfs2/Makefile
fs/ocfs2/dlm/Makefile
fs/ocfs2/dlmfs/Makefile

index 99ee093182cbe1e867e7a3b817cdb4b127734daf..cc9b32b9db7cf6da37fa8db7807490c00304b2cf 100644 (file)
@@ -1,5 +1,5 @@
 # SPDX-License-Identifier: GPL-2.0
-ccflags-y := -Ifs/ocfs2
+ccflags-y := -I$(src)
 
 obj-$(CONFIG_OCFS2_FS) +=      \
        ocfs2.o                 \
index bd1aab1f49a437ccf4e44b77ed7391c3c4d219d8..ef2854422a6e16f203ad3ba198b8b5316b20237f 100644 (file)
@@ -1,4 +1,4 @@
-ccflags-y := -Ifs/ocfs2
+ccflags-y := -I$(src)/..
 
 obj-$(CONFIG_OCFS2_FS_O2CB) += ocfs2_dlm.o
 
index eed3db8c5b49295a1f0fc1904b25a27acdf93274..33431a0296a32b4d98c09a224ccebe0001fba656 100644 (file)
@@ -1,4 +1,4 @@
-ccflags-y := -Ifs/ocfs2
+ccflags-y := -I$(src)/..
 
 obj-$(CONFIG_OCFS2_FS) += ocfs2_dlmfs.o