Makefile: Add logging.

This should help catching bugs that are hard to reproduce.

Without the pipefail make only take into account the tee command
return code.

The 'SHELL := $(shell which bash)' is to use bash as dash for instance
doesn't have pipefail and we don't want to have to install new
utilities to handle that.

Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
Acked-by: Adrien 'neox' Bourmault <neox@gnu.org>
This commit is contained in:
Denis 'GNUtoo' Carikli 2023-12-10 15:41:40 +01:00 committed by Adrien 'neox' Bourmault
parent 2d11302693
commit d68b4f8930
Signed by: neox
GPG Key ID: 2974E1D5F25DFCC8
1 changed files with 41 additions and 16 deletions

View File

@ -25,29 +25,43 @@
install-dependencies-pureos-10 install-dependencies-arch \ install-dependencies-pureos-10 install-dependencies-arch \
install-dependencies-void install-dependencies-void
LOG = make-$(shell date '+%s').log
all: roms all: roms
download: download:
./download all echo 'Makefile: running $@ target' >> $(LOG)
./download all 2>&1 | tee -a $(LOG)
@echo "[ OK ] Makefile: $@ target. See $(LOG) for the log."
modules: modules:
./build module all echo 'Makefile: running $@ target' >> $(LOG)
./build module all 2>&1 | tee -a $(LOG)
@echo "[ OK ] Makefile: $@ target. See $(LOG) for the log."
ich9m-descriptors: ich9m-descriptors:
./build build descriptors echo 'Makefile: running $@ target' >> $(LOG)
./build build descriptors | tee -a $(LOG)
@echo "[ OK ] Makefile: $@ target. See $(LOG) for the log."
payloads: payloads:
./build payload all echo 'Makefile: running $@ target' >> $(LOG)
set -o pipefail ; ./build payload all | tee -a $(LOG)
@echo "[ OK ] Makefile: $@ target. See $(LOG) for the log."
roms: roms:
./build boot roms all echo 'Makefile: running $@ target' >> $(LOG)
set -o pipefail ; ./build boot roms all | tee -a $(LOG)
@echo "[ OK ] Makefile: $@ target. See $(LOG) for the log."
release: release:
./build release src echo 'Makefile: running $@ target' >> $(LOG)
./build release roms set -o pipefail ; ./build release src | tee -a $(LOG)
./build release website set -o pipefail ; ./build release roms | tee -a $(LOG)
./build release gnuboot-source set -o pipefail ; ./build release website | tee -a $(LOG)
./build test release set -o pipefail ; ./build release gnuboot-source | tee -a $(LOG)
set -o pipefail ; ./build test release | tee -a $(LOG)
@echo "[ OK ] Makefile: $@ target. See $(LOG) for the log."
clean: clean:
./build clean cbutils ./build clean cbutils
@ -66,16 +80,27 @@ distclean:
./build distclean all ./build distclean all
install-dependencies-ubuntu: install-dependencies-ubuntu:
./build dependencies trisquel-10 echo 'Makefile: running $@ target' >> $(LOG)
set -o pipefail ; ./build dependencies trisquel-10 | tee -a $(LOG)
@echo "[ OK ] Makefile: $@ target. See $(LOG) for the log."
install-dependencies-pureos-10: install-dependencies-pureos-10:
./build dependencies pureos-10 echo 'Makefile: running $@ target' >> $(LOG)
set -o pipefail ; ./build dependencies pureos-10 | tee -a $(LOG)
@echo "[ OK ] Makefile: $@ target. See $(LOG) for the log."
install-dependencies-arch: install-dependencies-arch:
./build dependencies arch echo 'Makefile: running $@ target' >> $(LOG)
set -o pipefail ; ./build dependencies arch | tee -a $(LOG)
@echo "[ OK ] Makefile: $@ target. See $(LOG) for the log."
install-dependencies-void: install-dependencies-void:
./build dependencies void echo 'Makefile: running $@ target' >> $(LOG)
set -o pipefail ; ./build dependencies void | tee -a $(LOG)
@echo "[ OK ] Makefile: $@ target. See $(LOG) for the log."
check: check:
./tests/lint echo 'Makefile: running $@ target' >> $(LOG)
./tests/distclean set -o pipefail ; ./tests/lint | tee -a $(LOG)
set -o pipefail ; ./tests/distclean | tee -a $(LOG)
@echo "[ OK ] Makefile: $@ target. See $(LOG) for the log."