Change everything in a file that maps to {module::name.filetype} to _modules/name/applicat

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

I'm getting this error:
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?

The error is

sed -i '' ...

an empty sed script.
And why -i ? Is it your intention to modify its input file (content.txt)?