[PATCH] Add new macros USELZO|USESNAPPY|USEZSTD|USEVALGRIND to improve crash build

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Currently, crash has multiple targets such as warn, Warn, nowarn,
lzo, snappy, zstd and valgrind in the top Makefile, and they will
always execute "make gdb_merge", if users use multiple targets to
build crash such as "make warn lzo zstd", it indicates that the
build process will run three times for "make gdb_merge", it was
not a problem in the past because the compilation process was not
concurrent.

But for now, crash has supported the "make -j jobs" option, the
compilation process is concurrent, if users still compile crash
as before with the "make -j jobs" option, it may fail with the
following errors, for example:

$ make -j24 warn lzo
...
mv: cannot stat 'Makefile.new': No such file or directory
Makefile: cannot create new Makefile
please copy Makefile.new to Makefile
make: *** [Makefile:321: lzo] Error 1
make: *** Waiting for unfinished jobs....
TARGET: X86_64
 CRASH: 8.0.0++
   GDB: 10.2
...

To avoid the current issue, need to do a minor improvement for
building crash, therefore, add several macros USELZO, USESANPPY,
USEZSTD and USEVALGRIND in the top Makefile. Also update the
documentation accordingly.

Signed-off-by: Lianbo Jiang <lijiang@xxxxxxxxxx>
Signed-off-by: Kazuhito Hagio <k-hagio-ab@xxxxxxx>
---
 Makefile | 35 +++++++++++++++++++----------------
 README   |  7 ++++---
 help.c   |  7 ++++---
 3 files changed, 27 insertions(+), 22 deletions(-)

diff --git a/Makefile b/Makefile
index ede87a1029c8..f578fd8366dd 100644
--- a/Makefile
+++ b/Makefile
@@ -223,6 +223,25 @@ ifneq ($(target),)
 CONF_TARGET_FLAG="-t$(target)"
 endif
 
+
+# To build crash with any or all of those libraries, need add these macroes
+# to the make commandline, for example:
+# make USELZO=on USESNAPPY=on USEZSTD=on
+# otherwise crash will lack support for these features
+# make
+ifeq ($(USELZO),on)
+CONF_TARGET_FLAG+=-x lzo
+endif
+ifeq ($(USESNAPPY),on)
+CONF_TARGET_FLAG+=-x snappy
+endif
+ifeq ($(USEZSTD),on)
+CONF_TARGET_FLAG+=-x zstd
+endif
+ifeq ($(USEVALGRIND),on)
+CONF_TARGET_FLAG+=-x valgrind
+endif
+
 # To build the extensions library by default, uncomment the third command
 # line below.  Otherwise they can be built by entering "make extensions".
 
@@ -317,22 +336,6 @@ nowarn: make_configure
 	@./configure ${CONF_TARGET_FLAG} -n -b
 	@$(MAKE) gdb_merge
 
-lzo: make_configure
-	@./configure -x lzo ${CONF_TARGET_FLAG} -w -b
-	@$(MAKE) gdb_merge
-
-snappy: make_configure
-	@./configure -x snappy ${CONF_TARGET_FLAG} -w -b
-	@$(MAKE) gdb_merge
-
-zstd: make_configure
-	@./configure -x zstd ${CONF_TARGET_FLAG} -w -b
-	@$(MAKE) gdb_merge
-
-valgrind: make_configure
-	@./configure -x valgrind ${CONF_TARGET_FLAG} -w -b
-	@$(MAKE) gdb_merge
-
 main.o: ${GENERIC_HFILES} main.c
 	${CC} -c ${CRASH_CFLAGS} main.c ${WARNING_OPTIONS} ${WARNING_ERROR} 
 
diff --git a/README b/README
index 02aef58fa28c..ddc1e7d20bd2 100644
--- a/README
+++ b/README
@@ -103,11 +103,12 @@
   the libz compression library is used, and by default the crash utility
   only supports libz.  Recently makedumpfile has been enhanced to optionally
   use the LZO, snappy or zstd compression libraries.  To build crash with any
-  or all of those libraries, type "make lzo", "make snappy" or "make zstd".
+  or all of those libraries, type "make USELZO=on", "make USESNAPPY=on" or
+  "make USEZSTD=on".
 
   crash supports valgrind Memcheck tool on the crash's custom memory allocator.
-  To build crash with this feature enabled, type "make valgrind" and then run
-  crash with valgrind as "valgrind crash vmlinux vmcore".
+  To build crash with this feature enabled, type "make USEVALGRIND=on" and
+  then run crash with valgrind as "valgrind crash vmlinux vmcore".
 
   All of the alternate build commands above are "sticky" in that the
   special "make" targets only have to be entered one time; all subsequent
diff --git a/help.c b/help.c
index e57ed72f51d9..b33f090b2f21 100644
--- a/help.c
+++ b/help.c
@@ -9441,11 +9441,12 @@ README_ENTER_DIRECTORY,
 "  the libz compression library is used, and by default the crash utility",
 "  only supports libz.  Recently makedumpfile has been enhanced to optionally",
 "  use the LZO, snappy or zstd compression libraries.  To build crash with any",
-"  or all of those libraries, type \"make lzo\", \"make snappy\" or \"make zstd\".",
+"  or all of those libraries, type \"make USELZO=on\", \"make USESNAPPY=on\" or",
+"  \"make USEZSTD=on\".",
 "",
 "  crash supports valgrind Memcheck tool on the crash's custom memory allocator.",
-"  To build crash with this feature enabled, type \"make valgrind\" and then run",
-"  crash with valgrind as \"valgrind crash vmlinux vmcore\".",
+"  To build crash with this feature enabled, type \"make USEVALGRIND=on\" and",
+"  then run, crash with valgrind as \"valgrind crash vmlinux vmcore\".",
 "",
 "  All of the alternate build commands above are \"sticky\" in that the",
 "  special \"make\" targets only have to be entered one time; all subsequent",
-- 
2.20.1

--
Crash-utility mailing list
Crash-utility@xxxxxxxxxx
https://listman.redhat.com/mailman/listinfo/crash-utility




[Index of Archives]     [Fedora Development]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [KDE Users]     [Fedora Tools]

 

Powered by Linux