aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorMartin Roth <gaumless@gmail.com>2024-06-18 14:50:23 -0600
committerFelix Held <felix-coreboot@felixheld.de>2024-07-01 16:51:53 +0000
commitebf6b3c187684afbdb018fe7b07925679ce0aa07 (patch)
treebb0fa87dec22ec802f140d6f6169d3eb1fa4fa2c /Makefile
parentf7f9fc9271e53526300195f6fbd83a7b3e68d8d2 (diff)
Makefile: update clean-symlink target
This almost completely replaces the original clean-symlink target to remove links from site-local into the coreboot tree. Changes include: - Symbolic links removed are based on the EXTERNAL_SYMLINKS value of symlink.txt files under site-local. - Verify that there are site-local symlink.txt files to work on before doing anything. - Verify that the symlink.txt files reference links inside the coreboot directory. - Print out whether or not there are remaining symbolic links in the tree. Signed-off-by: Martin Roth <gaumless@gmail.com> Change-Id: Ife0e7cf1b856b7394cd5e1de9b35856bd984663c Reviewed-on: https://review.coreboot.org/c/coreboot/+/83124 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Eric Lai <ericllai@google.com> Reviewed-by: Elyes Haouas <ehaouas@noos.fr>
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile34
1 files changed, 29 insertions, 5 deletions
diff --git a/Makefile b/Makefile
index 60570a0571..2dddaabc89 100644
--- a/Makefile
+++ b/Makefile
@@ -519,11 +519,35 @@ symlink:
done
clean-symlink:
- @echo "Deleting symbolic link";\
- EXISTING_SYMLINKS=`find -L ./src -xtype l | grep -v 3rdparty`; \
- for link in $$EXISTING_SYMLINKS; do \
- echo -e "\tUNLINK $$link"; \
- rm "$$link"; \
+ if [ -z "$(SYMLINK_LIST)" ]; then \
+ echo "No site-local symbolic links to clean."; \
+ exit 0; \
+ fi; \
+ echo "Removing site-local symbolic links from tree.."; \
+ for link in $(SYMLINK_LIST); do \
+ SYMLINK="$(top)/$$(head -n 1 "$${link}")"; \
+ if [ "$${SYMLINK}" = "$$(echo "$${SYMLINK}" | sed "s|^$(top)||")" ]; then \
+ echo " FAILED: $${SYMLINK} is outside of current directory." >&2; \
+ continue; \
+ elif [ ! -L "$${SYMLINK}" ]; then \
+ echo " $${SYMLINK} does not exist - skipping"; \
+ continue; \
+ fi; \
+ if [ -L "$${SYMLINK}" ]; then \
+ REALDIR="$$(realpath "$${link}")"; \
+ echo " UNLINK $${link} (linked from $${REALDIR})"; \
+ rm "$${SYMLINK}"; \
+ fi; \
+ done; \
+ EXISTING_SYMLINKS="$$(find $(top) -type l | grep -v "3rdparty\|crossgcc" )"; \
+ if [ -z "$${EXISTING_SYMLINKS}" ]; then \
+ echo " No remaining symbolic links found in tree."; \
+ else \
+ echo " Remaining symbolic links found:"; \
+ for link in $${EXISTING_SYMLINKS}; do \
+ echo " $${link}"; \
+ done; \
+ fi
cleanall-symlink:
echo "Deleting all symbolic links in the coreboot tree (excluding 3rdparty & crossgcc)"; \