From: quzar <qu...@us...> - 2024-05-12 02:27:13
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via 1bd6f475dc9c9d3f6fac03357e1d1401513d3f51 (commit) from 71aa13a7edebe7c236c306f5e12abddb27f0a8f3 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 1bd6f475dc9c9d3f6fac03357e1d1401513d3f51 Author: Andy Barajas <and...@gm...> Date: Sat May 11 18:38:33 2024 -0700 examples/dreamcast/makefile rework (#538) * Continue building examples and give a list at the end of any failures ----------------------------------------------------------------------- Summary of changes: examples/dreamcast/Makefile | 62 ++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 58 insertions(+), 4 deletions(-) diff --git a/examples/dreamcast/Makefile b/examples/dreamcast/Makefile index 23e25f7b..1b36dc2f 100644 --- a/examples/dreamcast/Makefile +++ b/examples/dreamcast/Makefile @@ -1,7 +1,8 @@ # KallistiOS ##version## # # examples/dreamcast/Makefile -# Copyright (C)2003 Megan Potter +# Copyright (C) 2003 Megan Potter +# Copyright (C) 2024 Andy Barajas # DIRS = 2ndmix basic libdream kgl hello sound png network vmu conio pvr video \ @@ -12,11 +13,64 @@ ifdef KOS_CCPLUS DIRS += cpp tsunami endif +.PHONY: all + all: - for i in $(DIRS); do $(KOS_MAKE) -C $$i || exit -1; done + @for dir in $(DIRS); do \ + $(KOS_MAKE) check-dir DIR=$$dir; \ + done; + + @if [ -f errors.txt ]; then \ + echo "\n-------------------------------------------------"; \ + echo "$$(cat error_count.txt 2>/dev/null || echo 0) error(s) occurred during the build process:"; \ + cat errors.txt; \ + fi; + @rm -f errors.txt error_count.txt + +# ALGORITHM EXPLANATION: +# This script recursively checks each directory to determine if it should +# execute its Makefile based on the presence of Makefiles in its subdirectories. +# +# Steps: +# 1. For each directory, identify all direct subdirectories. +# 2. Check each subdirectory for the existence of a Makefile. +# 3. If any subdirectory contains a Makefile, recursively perform this check on +# that subdirectory and do not execute the Makefile in the current directory. +# 4. If no subdirectories contain a Makefile, execute the Makefile in the +# current directory. +# +# Purpose: +# - This approach ensures that Makefiles are only executed in the most specific +# (deepest) directories that do not contain further subdirectories with +# Makefiles. +# - This prevents redundant builds in parent directories and ensures errors are +# logged with specific directory paths, providing clear visibility into which +# particular build process failed without aggregating errors at a higher +# directory level. +check-dir: + @should_make="yes"; \ + for subdir in $(DIR)/*; do \ + if [ -e "$$subdir/Makefile" ]; then \ + should_make="no"; \ + $(KOS_MAKE) check-dir DIR=$$subdir; \ + fi; \ + done; \ + if [ "$$should_make" = "yes" ]; then \ + $(KOS_MAKE) -C $(DIR); \ + rv=$$?; \ + if [ "$$rv" -ne 0 ]; then \ + echo "$(DIR): Build failed with return code $$rv" >> errors.txt; \ + echo $$(($$(cat error_count.txt 2>/dev/null || echo 0) + 1)) > error_count.txt; \ + fi; \ + fi; clean: - for i in $(DIRS); do $(KOS_MAKE) -C $$i clean || exit -1; done + @for dir in $(DIRS); do \ + $(KOS_MAKE) -C $$dir clean; \ + done dist: - for i in $(DIRS); do $(KOS_MAKE) -C $$i dist || exit -1; done + @for dir in $(DIRS); do \ + $(KOS_MAKE) -C $$dir dist; \ + done + hooks/post-receive -- A pseudo Operating System for the Dreamcast. |