Makefile: Add targets to add and remove symlinks
When "make symlink" is run, it looks for symlink.txt files recursively under site-local directory, and make symbolic links accordingly. "make clean-symlink" removes the symbolic links made. One application is for development of support for new processors and/or new mainboards, where new directories are added, along with some common code changes. Change-Id: I3fa119675ecca1626d70375a61e8a71abec6a53b Signed-off-by: Christian Walter <christian.walter@9elements.com> Signed-off-by: Jonathan Zhang <jonzhang@meta.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/65093 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Martin L Roth <gaumless@gmail.com>
This commit is contained in:
parent
ccbb98880b
commit
a8c10c8298
30
Makefile
30
Makefile
|
@ -38,6 +38,11 @@ COREBOOT_EXPORTS += KCONFIG_DEPENDENCIES KCONFIG_SPLITCONFIG KCONFIG_TRISTATE
|
|||
COREBOOT_EXPORTS += KCONFIG_NEGATIVES KCONFIG_STRICT
|
||||
COREBOOT_EXPORTS += KCONFIG_AUTOADS KCONFIG_PACKAGE
|
||||
|
||||
# Make does not offer a recursive wildcard function, so here's one:
|
||||
rwildcard=$(wildcard $1$2) $(foreach d,$(wildcard $1*),$(call rwildcard,$d/,$2))
|
||||
SYMLINK_LIST = $(call rwildcard,site-local/,symlink.txt)
|
||||
|
||||
|
||||
# directory containing the toplevel Makefile.inc
|
||||
TOPLEVEL := .
|
||||
|
||||
|
@ -455,6 +460,29 @@ sphinx:
|
|||
sphinx-lint:
|
||||
$(MAKE) SPHINXOPTS=-W -C Documentation -f Makefile.sphinx html
|
||||
|
||||
symlink:
|
||||
@echo "Creating Symbolic Links.."; \
|
||||
for link in $(SYMLINK_LIST); do \
|
||||
SYMLINK=`cat $$link`; \
|
||||
REALPATH=`realpath $$link`; \
|
||||
if [ -L "$$SYMLINK" ]; then \
|
||||
continue; \
|
||||
elif [ ! -e "$$SYMLINK" ]; then \
|
||||
echo -e "\tLINK $$SYMLINK -> $$(dirname $$REALPATH)"; \
|
||||
ln -s $$(dirname $$REALPATH) $$SYMLINK; \
|
||||
else \
|
||||
echo -e "\tFAILED: $$SYMLINK exists"; \
|
||||
fi \
|
||||
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"; \
|
||||
done
|
||||
|
||||
clean-for-update:
|
||||
rm -rf $(obj) .xcompile
|
||||
|
||||
|
@ -482,4 +510,4 @@ distclean: clean clean-ctags clean-cscope distclean-payloads distclean-utils
|
|||
rm -f abuild*.xml junit.xml* util/lint/junit.xml
|
||||
|
||||
.PHONY: $(PHONY) clean clean-for-update clean-cscope cscope distclean sphinx sphinx-lint
|
||||
.PHONY: ctags-project cscope-project clean-ctags
|
||||
.PHONY: ctags-project cscope-project clean-ctags symlink clean-symlink
|
||||
|
|
Loading…
Reference in New Issue