Make script run in (a)sh
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
#!/bin/bash
|
#!/bin/sh
|
||||||
|
|
||||||
# Copyright 2021 Johannes Marbach
|
# Copyright 2021 Johannes Marbach
|
||||||
#
|
#
|
||||||
@@ -18,15 +18,15 @@
|
|||||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
|
||||||
while read -r makefile; do
|
find "$1" -name "*.mk" | while IFS= read -r makefile; do
|
||||||
while read -r expr; do
|
grep "^CSRCS\s*+=" "$makefile" | sed "s|.*=\s*||g" | while read -r expr; do
|
||||||
# Ignore example code
|
# Ignore example code
|
||||||
if [[ $(dirname $makefile) =~ .*/examples ]]; then
|
if [[ $(dirname $makefile) =~ .*/examples ]]; then
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Handle full & relative paths
|
# Handle full & relative paths
|
||||||
if [[ $expr =~ .*\$\(LVGL_DIR ]]; then
|
if echo "$expr" | grep -q '$(LVGL_DIR'; then
|
||||||
expr=$(echo "$expr" \
|
expr=$(echo "$expr" \
|
||||||
| sed 's|$(LVGL_DIR)/||g' \
|
| sed 's|$(LVGL_DIR)/||g' \
|
||||||
| sed 's|$(LVGL_DIR_NAME)/|lvgl/|g' \
|
| sed 's|$(LVGL_DIR_NAME)/|lvgl/|g' \
|
||||||
@@ -39,7 +39,7 @@ while read -r makefile; do
|
|||||||
expr=$(echo "$expr" | sed 's|$(wildcard\s*\(.*\))|\1|g')
|
expr=$(echo "$expr" | sed 's|$(wildcard\s*\(.*\))|\1|g')
|
||||||
|
|
||||||
# Resolve $(shell ...)
|
# Resolve $(shell ...)
|
||||||
if [[ $expr =~ \$\(shell ]]; then
|
if echo "$expr" | grep -q '$(shell'; then
|
||||||
expr=$(echo "$expr" | sed 's|$(shell\s*\(.*\))|\1|g')
|
expr=$(echo "$expr" | sed 's|$(shell\s*\(.*\))|\1|g')
|
||||||
expr=$(eval "$expr")
|
expr=$(eval "$expr")
|
||||||
fi
|
fi
|
||||||
@@ -48,5 +48,5 @@ while read -r makefile; do
|
|||||||
for file in $expr; do
|
for file in $expr; do
|
||||||
echo $file
|
echo $file
|
||||||
done
|
done
|
||||||
done < <(grep "^CSRCS\s*+=" "$makefile" | sed "s|.*=\s*||g")
|
done
|
||||||
done < <(find "$1" -name "*.mk")
|
done
|
||||||
|
Reference in New Issue
Block a user