[jhalfs] 01/06: Use make conditionals for BLFS and CUSTOM tools

"Git Owner" ([email protected] via alfs-discuss Mailing List) <[email protected]> Sat, 20 Dec 2025 22:23:18 +0000
Newsgroups gmane.linux.lfs.automated
Message-ID <[email protected]>
This is a multi-part message in MIME format...

------------=_1766269410-11311-51249
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit

This is an automated email from the git hooks/post-receive script.

git pushed a commit to branch trunk
in repository jhalfs.

commit 45a420579224277941517cc71b3cb347bf7ba374
Author: Pierre Labastie <[email protected]>
AuthorDate: Sat Dec 20 17:13:49 2025 +0100

    Use make conditionals for BLFS and CUSTOM tools
    
    Right now, we use a shell conditional on "ADD_BLFS_TOOLS" inside
    the target mk_BLFS_TOOL, so that even if the BLFS_TOOLS are not
    wanted, the target timestamp is still created. This prevents
    running jhalfs again with BLFS tools enabled without erasing
    this target timestamp (or the totality of what we just have built).
    There is a similar problem with mk_CUSTOM_TOOL.
    To fix this, we need to move the conditional to the Makefile
    itself, so that the targets don't even exist if the corresponding
    ADD_ variables are not "y", so that of course the timestamp files
    are not created.
    Bug reported by Zhang Wen on alfs-discuss
---
 LFS/master.sh | 32 +++++++++++++++++++++-----------
 1 file changed, 21 insertions(+), 11 deletions(-)

diff --git a/LFS/master.sh b/LFS/master.sh
index a836524..ce598c1 100644
--- a/LFS/master.sh
+++ b/LFS/master.sh
@@ -302,7 +302,14 @@ EOF
 
 .NOTPARALLEL:
 
-all:	ck_UID ck_terminal ck_mountpoint mk_SETUP mk_LUSER mk_SUDO mk_CHROOT mk_BOOT create-sbu_du-report mk_BLFS_TOOL mk_CUSTOM_TOOLS
+all:	ck_UID ck_terminal ck_mountpoint mk_SETUP mk_LUSER mk_SUDO mk_CHROOT mk_BOOT create-sbu_du-report
+ifeq ( \$(ADD_BLFS_TOOLS), y )
+  all:    mk_BLFS_TOOL
+endif
+ifeq ( \$(ADD_CUSTOM_TOOLS), y )
+  all:    mk_CUSTOM_TOOLS
+endif
+all:
 	@sudo env LFS=\$(MOUNT_PT) kernfs-scripts/teardown.sh
 EOF
 ) >> $MKFILE
@@ -387,20 +394,23 @@ mk_BOOT: mk_CHROOT | devices
 	@( sudo \$(CHROOT1) -c "cd \$(SCRIPT_ROOT) && make BREAKPOINT=\$(BREAKPOINT) BOOT")
 	@touch \$@
 
+ifeq ( \$(ADD_BLFS_TOOLS), y )
 mk_BLFS_TOOL: create-sbu_du-report | devices
-	@if [ "\$(ADD_BLFS_TOOLS)" = "y" ]; then \\
-	  \$(call sh_echo_PHASE,Building BLFS_TOOL); \\
-	  (sudo \$(CHROOT1) -c "make -C $BLFS_ROOT/work"); \\
-	fi;
+	@\$(call sh_echo_PHASE,Building BLFS_TOOL)
+	@sudo \$(CHROOT1) -c "make -C $BLFS_ROOT/work"
 	@touch \$@
-
+endif
+ifeq ( \$(ADD_CUSTOM_TOOLS), y )
+ifeq ( \$(ADD_BLFS_TOOLS), y )
 mk_CUSTOM_TOOLS: mk_BLFS_TOOL | devices
-	@if [ "\$(ADD_CUSTOM_TOOLS)" = "y" ]; then \\
-	  \$(call sh_echo_PHASE,Building CUSTOM_TOOLS); \\
-	  sudo mkdir -p ${BUILDDIR}${TRACKING_DIR}; \\
-	  (sudo \$(CHROOT1) -c "cd \$(SCRIPT_ROOT) && make BREAKPOINT=\$(BREAKPOINT) CUSTOM_TOOLS"); \\
-	fi;
+else
+mk_CUSTOM_TOOLS: create-sbu_du-report | devices
+endif
+	@\$(call sh_echo_PHASE,Building CUSTOM_TOOLS)
+	@sudo mkdir -p ${BUILDDIR}${TRACKING_DIR}
+	@sudo \$(CHROOT1) -c "cd \$(SCRIPT_ROOT) && make BREAKPOINT=\$(BREAKPOINT) CUSTOM_TOOLS"
 	@touch \$@
+endif
 
 devices: ck_UID
 	sudo env LFS=\$(MOUNT_PT) kernfs-scripts/devices.sh

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.

------------=_1766269410-11311-51249
Content-Type: text/plain; charset="UTF-8"
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
MIME-Version: 1.0

-- 
http://lists.linuxfromscratch.org/sympa/info/alfs-discuss
Unsubscribe: See the above information page
------------=_1766269410-11311-51249--