canutils/lely-canopen: avoid patch reapply on repeated builds.

The patch step currently uses a phony target, so it is executed
again when the build is repeated in the same source tree. In that
case `patch -N` detects previously applied patches and returns 1,
which make treats as a failure.

Replace the phony patch target with a stamped `.patched` file so
the patch step is not re-run unnecessarily.

Fixes #3188

Signed-off-by: Shunchao Hu <ankohuu@gmail.com>
This commit is contained in:
Shunchao Hu 2026-04-02 15:27:57 +08:00 committed by Mateusz Szafoni
parent 5c867b21e6
commit 231ac397a7

View file

@ -179,7 +179,7 @@ $(LELYCANOPEN_SRCNAME): $(LELYCANOPEN_TARBALL)
@echo "Unpacking: $(LELYCANOPEN_TARBALL) -> $(LELYCANOPEN_UNPACKNAME)"
$(Q) $(UNPACK) $(LELYCANOPEN_TARBALL)
patch_src: $(LELYCANOPEN_SRCNAME)
$(LELYCANOPEN_SRCNAME)/.patched : $(LELYCANOPEN_SRCNAME)
# Get the name of the directory created by the tar command
$(eval LELYCANOPEN_UNPACKNAME := $(shell ls -d lely-core-master*))
$(Q) mv $(LELYCANOPEN_UNPACKNAME) $(LELYCANOPEN_SRCNAME)
@ -188,9 +188,10 @@ patch_src: $(LELYCANOPEN_SRCNAME)
$(Q) cat 0003-src-co-nmt.c-fix-compilation.patch | patch -s -N -d $(LELYCANOPEN_SRCNAME) -p1
$(Q) cat 0004-tools-coctl.c-add-missing-mutex-init.patch | patch -s -N -d $(LELYCANOPEN_SRCNAME) -p1
$(Q) cat 0005-add-NuttX-support.patch | patch -s -N -d $(LELYCANOPEN_SRCNAME) -p1
$(Q) touch $@
$(Q) echo "Patching $(LELYCANOPEN_SRCNAME)"
context:: patch_src
context:: $(LELYCANOPEN_SRCNAME)/.patched
else
context:: $(LELYCANOPEN_SRCNAME)
endif