Code:
path = content.txt
filename = application
directory = _modules
define create
$(eval from := $(shell echo $$1)) \
$(eval to := $(shell echo $$2)) \
sed -i '' 's/$(from)/$(to)/g' content.txt
endef
all:
clear
$(eval modules := $(shell egrep -o "{module[^ ]+\}" $(path)))
@for m in $(modules); do \
$(call create, $$m, \
$$m \
| sed 's/{module\([^ ]*\).*}/\1/' \
| sed 's/\./\/$(filename)\./g' \
| sed 's/\::/\$(directory)\//g' \
); \
done
sed: first RE may not be empty
I think the reason for it is because I can not use shell script inside of a for loop because $$1 is returning null.
Anyone have any idea how to solve this issue?