mirror of
git://projects.qi-hardware.com/openwrt-xburst.git
synced 2024-11-19 03:51:32 +02:00
rules.mk: provide a macro "file_copy" which removes any symlink in the destination dir that would be overwritten
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@34437 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
parent
b937cbf1ae
commit
6d0c73d11b
18
rules.mk
18
rules.mk
@ -287,6 +287,24 @@ define locked
|
||||
-c '$(subst ','\'',$(1))'
|
||||
endef
|
||||
|
||||
# Recursively copy paths into another directory, purge dangling
|
||||
# symlinks before.
|
||||
# $(1) => File glob expression
|
||||
# $(2) => Destination directory
|
||||
define file_copy
|
||||
for src_dir in $(sort $(foreach d,$(wildcard $(1)),$(dir $(d)))); do \
|
||||
( cd $$src_dir; find -type f -or -type d ) | \
|
||||
( cd $(2); while :; do \
|
||||
read FILE; \
|
||||
[ -z "$$FILE" ] && break; \
|
||||
[ -L "$$FILE" ] || continue; \
|
||||
echo "Removing symlink $(2)/$$FILE"; \
|
||||
rm -f "$$FILE"; \
|
||||
done; ); \
|
||||
done; \
|
||||
$(CP) $(1) $(realpath $(2)/)/
|
||||
endef
|
||||
|
||||
# file extension
|
||||
ext=$(word $(words $(subst ., ,$(1))),$(subst ., ,$(1)))
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user