help-make
[Top][All Lists]
Advanced

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

Is it possible to break from a GMAKE foreach loop and then exit from mak


From: Pierre Rouleau
Subject: Is it possible to break from a GMAKE foreach loop and then exit from make?
Date: Fri, 27 May 2022 09:35:09 -0400

Hi all,

I have a makefile tha patches the kernel but does not check if the patch
succeeded.
The rule is shown below.  It uses a foreach loop to apply a set of patches
identified by
a list of patches.

Is it possible to use the `|| exit 1' construct inside the text portion of
the foreach loop to detect
failing patches and stop make execution?

ie, Is it possible to transform the following:

$(OUTPUT_ROOT_DIR)/.kernel_patched: $(OUTPUT_ROOT_DIR)/.kernel_original
        @echo -e "Applying only specific patch to kernel"
        (cd $(OUTPUT_ROOT_DIR)/$(CFG_GLOBAL_LINUX_VERSION); $(foreach
thepatch,$(KERNEL_PATCH_ONE),echo patching $(thepatch); patch
--ignore-whitespace -p1 < $(thepatch);))


into this and is it the best way or are there better alternatives?

$(OUTPUT_ROOT_DIR)/.kernel_patched: $(OUTPUT_ROOT_DIR)/.kernel_original
        @echo -e "Applying only specific patch to kernel"
        (cd $(OUTPUT_ROOT_DIR)/$(CFG_GLOBAL_LINUX_VERSION); $(foreach
thepatch,$(KERNEL_PATCH_ONE),echo patching $(thepatch); patch
--ignore-whitespace -p1 < $(thepatch) || exit 1;))


Thanks


-- 
/Pierre


reply via email to

[Prev in Thread] Current Thread [Next in Thread]