Gnu make shell command replace \n with space in the result.
Trick - replace \n in the file with replacer and after loading subst revert \n befor eval.
define newline
endef
newline-stub = __NEWLINE_STUB__
# package-overlay -- load and eval makefile in place
#
# argument 1 directory packacge_overlay
# argument 2 relative path to the make fil
#
# example:
# $(eval $(call package-overlay,$(call qstrip,$(BR2_PACKAGE_OVERLAY_DIR)),RELATIVE_PATH_TO_THE_FILE))
define package-overlay
ifneq ("$(1)","")
ifneq ($$(wildcard $(1)/$(2)),)
$$(eval $$(subst $$(newline-stub),$$(newline),$$(shell perl -p -e 's/\n/$$(newline-stub)/' $(1)/$(2))))
endif
endif
endef
- perl read makefile and replace \n with newline-stub
- subst revert this operation preparing data for eval
Made for buildroot project - package overlay in the extern project, without patchiing base tree.