Skip to content

Commit

Permalink
Support for multiple jobs to build crash
Browse files Browse the repository at this point in the history
This patch saves compilation time for crash build, which did the
following things:

[1] add --no-print-directory to MAKEFLAGS right in the beginning
    to avoid repeating it in all make calls.
[2] use "make -C" instead of "cd x; make"
[3] replace make by $(MAKE)

Link: https://listman.redhat.com/archives/crash-utility/2021-December/msg00049.html
Link: https://listman.redhat.com/archives/crash-utility/2021-December/msg00048.html
Link: https://listman.redhat.com/archives/crash-utility/2021-December/msg00047.html
Signed-off-by: Sven Schnelle <svens@linux.ibm.com>
Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
  • Loading branch information
svens-s390 authored and lian-bo committed Feb 16, 2022
1 parent 0a4434f commit 74ac929
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 32 deletions.
61 changes: 31 additions & 30 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
# GNU General Public License for more details.
#

MAKEFLAGS += --no-print-directory
PROGRAM=crash

#
Expand Down Expand Up @@ -227,20 +228,20 @@ endif

all: make_configure
@./configure ${CONF_TARGET_FLAG} -p "RPMPKG=${RPMPKG}" -b
@make --no-print-directory gdb_merge
# @make --no-print-directory extensions
@$(MAKE) gdb_merge
# @$(MAKE) extensions

gdb_merge: force
@if [ ! -f ${GDB}/README ]; then \
make --no-print-directory gdb_unzip; fi
$(MAKE) gdb_unzip; fi
@echo "${LDFLAGS} -lz -ldl -rdynamic" > ${GDB}/gdb/mergelibs
@echo "../../${PROGRAM} ../../${PROGRAM}lib.a" > ${GDB}/gdb/mergeobj
@rm -f ${PROGRAM}
@if [ ! -f ${GDB}/config.status ]; then \
(cd ${GDB}; ./configure ${GDB_CONF_FLAGS} --with-separate-debug-dir=/usr/lib/debug \
--with-bugurl="" --with-expat=no --with-python=no --disable-sim; \
make --no-print-directory CRASH_TARGET=${TARGET}; echo ${TARGET} > crash.target) \
else make --no-print-directory rebuild; fi
$(MAKE) CRASH_TARGET=${TARGET}; echo ${TARGET} > crash.target) \
else $(MAKE) rebuild; fi
@if [ ! -f ${PROGRAM} ]; then \
echo; echo "${PROGRAM} build failed"; \
echo; exit 1; fi
Expand All @@ -251,8 +252,8 @@ rebuild:
@if [ -f ${GDB}.patch ] && [ -s ${GDB}.patch ] && \
[ "`sum ${GDB}.patch`" != "`sum ${GDB}/${GDB}.patch`" ]; then \
(sh -x ${GDB}.patch ${TARGET}; patch -N -p0 -r- --fuzz=0 < ${GDB}.patch; cp ${GDB}.patch ${GDB}; cd ${GDB}; \
make --no-print-directory CRASH_TARGET=${TARGET}) \
else (cd ${GDB}/gdb; make --no-print-directory CRASH_TARGET=${TARGET}); fi
$(MAKE) CRASH_TARGET=${TARGET}) \
else (cd ${GDB}/gdb; $(MAKE) CRASH_TARGET=${TARGET}); fi

gdb_unzip:
@rm -f gdb.files
Expand All @@ -264,7 +265,7 @@ gdb_unzip:
[ ! -t 2 ] && WGET_OPTS="--progress=dot:mega"; \
wget $$WGET_OPTS http://ftp.gnu.org/gnu/gdb/${GDB}.tar.gz; fi
@tar --exclude-from gdb.files -xzmf ${GDB}.tar.gz
@make --no-print-directory gdb_patch
@$(MAKE) gdb_patch

gdb_patch:
if [ -f ${GDB}.patch ] && [ -s ${GDB}.patch ]; then \
Expand All @@ -275,7 +276,7 @@ library: make_build_data ${OBJECT_FILES}

gdb: force
rm -f ${GDB_OFILES}
@make --no-print-directory all
@$(MAKE) all

force:

Expand All @@ -286,12 +287,12 @@ make_configure: force

clean: make_configure
@./configure ${CONF_TARGET_FLAG} -q -b
@make --no-print-directory do_clean
@$(MAKE) do_clean

do_clean:
rm -f ${OBJECT_FILES} ${DAEMON_OBJECT_FILES} ${PROGRAM} ${PROGRAM}lib.a ${GDB_OFILES}
@(cd extensions; make --no-print-directory -i clean)
@(cd memory_driver; make --no-print-directory -i clean)
@$(MAKE) -C extensions -i clean
@$(MAKE) -C memory_driver -i clean

make_build_data: force
${CC} -c ${CRASH_CFLAGS} build_data.c ${WARNING_OPTIONS} ${WARNING_ERROR}
Expand All @@ -306,31 +307,31 @@ unconfig: make_configure

warn: make_configure
@./configure ${CONF_TARGET_FLAG} -w -b
@make --no-print-directory gdb_merge
@$(MAKE) gdb_merge

Warn: make_configure
@./configure ${CONF_TARGET_FLAG} -W -b
@make --no-print-directory gdb_merge
@$(MAKE) gdb_merge

nowarn: make_configure
@./configure ${CONF_TARGET_FLAG} -n -b
@make --no-print-directory gdb_merge
@$(MAKE) gdb_merge

lzo: make_configure
@./configure -x lzo ${CONF_TARGET_FLAG} -w -b
@make --no-print-directory gdb_merge
@$(MAKE) gdb_merge

snappy: make_configure
@./configure -x snappy ${CONF_TARGET_FLAG} -w -b
@make --no-print-directory gdb_merge
@$(MAKE) gdb_merge

zstd: make_configure
@./configure -x zstd ${CONF_TARGET_FLAG} -w -b
@make --no-print-directory gdb_merge
@$(MAKE) gdb_merge

valgrind: make_configure
@./configure -x valgrind ${CONF_TARGET_FLAG} -w -b
@make --no-print-directory gdb_merge
@$(MAKE) gdb_merge

main.o: ${GENERIC_HFILES} main.c
${CC} -c ${CRASH_CFLAGS} main.c ${WARNING_OPTIONS} ${WARNING_ERROR}
Expand Down Expand Up @@ -536,7 +537,7 @@ bpf.o: ${GENERIC_HFILES} bpf.c
${CC} -c ${CRASH_CFLAGS} bpf.c ${WARNING_OPTIONS} ${WARNING_ERROR}

${PROGRAM}: force
@make --no-print-directory all
@$(MAKE) all

# Remote daemon functionality has been deprecated.
daemon_deprecated: force
Expand All @@ -545,15 +546,15 @@ daemon_deprecated: force

${PROGRAM}d: daemon_deprecated make_configure
@./configure -d
@make --no-print-directory make_build_data
@make --no-print-directory daemon
@$(MAKE) make_build_data
@$(MAKE) daemon

daemon: ${DAEMON_OBJECT_FILES}
${CC} ${LDFLAGS} -o ${PROGRAM}d ${DAEMON_OBJECT_FILES} build_data.o -lz

files: make_configure
@./configure -q -b
@make --no-print-directory show_files
@$(MAKE) show_files

gdb_files: make_configure
@./configure -q -b
Expand All @@ -570,7 +571,7 @@ ctags:

tar: make_configure
@./configure -q -b
@make --no-print-directory do_tar
@$(MAKE) do_tar

do_tar:
@if [ -f ${PROGRAM} ]; then \
Expand All @@ -585,15 +586,15 @@ release: make_configure
@if [ "`id --user`" != "0" ]; then \
echo "make release: must be super-user"; exit 1; fi
@./configure -P "RPMPKG=${RPMPKG}" -u -g
@make --no-print-directory release_configure
@$(MAKE) release_configure
@echo
@echo "cvs tag this release if necessary"

release_configure: make_configure
@if [ "${GDB}" = "" ] ; then \
echo "make release: GDB not defined: append GDB=gdb-x.x to make command line"; echo; exit 1; fi
@./configure -r ${GDB}
@make --no-print-directory do_release
@$(MAKE) do_release

do_release:
@echo "CRASH VERSION: ${VERSION} GDB VERSION: ${GDB}"
Expand Down Expand Up @@ -635,7 +636,7 @@ do_release:
fi

ref:
make ctags cscope
$(MAKE) ctags cscope

cscope:
rm -f cscope.files cscope_out
Expand All @@ -657,10 +658,10 @@ dis:

extensions: make_configure
@./configure ${CONF_TARGET_FLAG} -q -b
@make --no-print-directory do_extensions
@$(MAKE) do_extensions

do_extensions:
@(cd extensions; make -i TARGET=$(TARGET) TARGET_CFLAGS="$(TARGET_CFLAGS)" GDB=$(GDB) GDB_FLAGS=$(GDB_FLAGS))
@$(MAKE) -C extensions -i TARGET=$(TARGET) TARGET_CFLAGS="$(TARGET_CFLAGS)" GDB=$(GDB) GDB_FLAGS=$(GDB_FLAGS)

memory_driver: make_configure
@(cd memory_driver; make --no-print-directory -i)
@$(MAKE) -C memory_driver -i
4 changes: 2 additions & 2 deletions extensions/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ link_defs:

$(CONTRIB_SO): %.so: %.c defs.h
@if [ -f $*.mk ]; then \
make -f $*.mk; \
$(MAKE) -f $*.mk; \
else \
grep '((constructor))' $*.c > .constructor; \
if [ -s .constructor ]; then \
Expand All @@ -51,5 +51,5 @@ $(CONTRIB_SO): %.so: %.c defs.h
clean:
rm -f $(CONTRIB_SO)
@for MAKEFILE in `grep -sl "^clean:" *.mk`; \
do make --no-print-directory -f $$MAKEFILE clean; \
do $(MAKE) -f $$MAKEFILE clean; \
done
16 changes: 16 additions & 0 deletions gdb-10.2.patch
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@
# shell script that can restore any gdb file to its original state prior
# to all subsequent patch applications.

tar xvzmf gdb-10.2.tar.gz \
gdb-10.2/gdb/Makefile.in

exit 0

--- gdb-10.2/Makefile.in.orig
+++ gdb-10.2/Makefile.in
@@ -340,6 +340,9 @@ AR_FOR_BUILD = @AR_FOR_BUILD@
Expand Down Expand Up @@ -1622,3 +1627,14 @@
{
if (user_name.back () == '>')
m_encoded_name
--- gdb-10.2/gdb/Makefile.in.orig
+++ gdb-10.2/gdb/Makefile.in
@@ -1865,7 +1865,7 @@ libgdb.a: $(LIBGDB_OBS)
# Removing the old gdb first works better if it is running, at least on SunOS.
gdb$(EXEEXT): gdb.o $(LIBGDB_OBS) $(CDEPS) $(TDEPLIBS)
$(SILENCE) rm -f gdb$(EXEEXT)
- @(cd ../..; make --no-print-directory GDB_FLAGS=-DGDB_10_2 library)
+ @$(MAKE) -C ../.. GDB_FLAGS=-DGDB_10_2 library
$(ECHO_CXXLD) $(CC_LD) $(INTERNAL_LDFLAGS) $(WIN32LDAPP) \
-o $(shell /bin/cat mergeobj) $(LIBGDB_OBS) \
$(TDEPLIBS) $(TUI_LIBRARY) $(CLIBS) $(LOADLIBES) $(shell /bin/cat mergelibs)

0 comments on commit 74ac929

Please sign in to comment.