Makefile: fix bug when running make install under tests/* directory
authorYang Xu <xuyang2018.jy@fujitsu.com>
Wed, 30 Jun 2021 01:52:05 +0000 (09:52 +0800)
committerEryu Guan <guaneryu@gmail.com>
Sun, 4 Jul 2021 11:05:53 +0000 (19:05 +0800)
The TESTS_DIR value is defined in TOPDIR makefile, it is empty here.
So running make install on ext4 directory will get the following info:

../../install-sh -o root -g root -m 755 -d /var/lib/xfstests//ext4

We can see they aren't installed under /var/lib/xfstests/tests/ext4 directory.
Fix this by moving TESTS_DIR definition to include/builddefs.in file.

Signed-off-by: Yang Xu <xuyang2018.jy@fujitsu.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
Makefile
include/builddefs.in

index 86a2d3996e5288f61e4be1f33b2b0d81d045940e..f6f91a4dde77294ceaebba257017fff48cd875d1 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -21,6 +21,8 @@ HAVE_BUILDDEFS = $(shell test -f $(TOPDIR)/include/builddefs && echo yes || echo
 
 ifeq ($(HAVE_BUILDDEFS), yes)
 include $(TOPDIR)/include/builddefs
 
 ifeq ($(HAVE_BUILDDEFS), yes)
 include $(TOPDIR)/include/builddefs
+else
+export TESTS_DIR = tests
 endif
 
 SRCTAR = $(PKG_NAME)-$(PKG_VERSION).tar.gz
 endif
 
 SRCTAR = $(PKG_NAME)-$(PKG_VERSION).tar.gz
@@ -40,7 +42,6 @@ endif
 LIB_SUBDIRS = include lib
 TOOL_SUBDIRS = ltp src m4 common
 
 LIB_SUBDIRS = include lib
 TOOL_SUBDIRS = ltp src m4 common
 
-export TESTS_DIR = tests
 SUBDIRS = $(LIB_SUBDIRS) $(TOOL_SUBDIRS) $(TESTS_DIR)
 
 default: include/builddefs
 SUBDIRS = $(LIB_SUBDIRS) $(TOOL_SUBDIRS) $(TESTS_DIR)
 
 default: include/builddefs
index f762a43319b7a412ec10170d4950e9bac096da15..6641209f81a1311c51d423a5fa29a95daa067de6 100644 (file)
@@ -35,7 +35,7 @@ PKG_VERSION     = @pkg_version@
 PKG_PLATFORM    = @pkg_platform@
 PKG_DISTRIBUTION= @pkg_distribution@
 PKG_LIB_DIR     = $(DESTDIR)@exec_prefix@/@pkg_name@
 PKG_PLATFORM    = @pkg_platform@
 PKG_DISTRIBUTION= @pkg_distribution@
 PKG_LIB_DIR     = $(DESTDIR)@exec_prefix@/@pkg_name@
-
+TESTS_DIR      = tests
 
 CC              = @cc@
 AWK             = @awk@
 
 CC              = @cc@
 AWK             = @awk@