How to write foreach cycles in Makefile properly? I have read
https://www.gnu.org/software/make/manual/html_node/Foreach-Function.html#Foreach-Function https://www.gnu.org/software/make/manual/html_node/Eval-Function.html#Eval-Function https://www.gnu.org/software/make/manual/html_node/Value-Function.html#Value-Function Or what I do wrong here (it says "Makefile:16: *** missing separator. Stop."): DISTFILES := /dir2/dir3/dir4 /dir2 /dir1 /dir1/file1 /dir1/dir2/file2 /dir1/dir2/file3 /dir1/file4 .PHONY: default_target define DISTDIR_PROCESS_FILE_OR_DIRECTORY = current_path=${file_or_dir_name} ifeq ($${current_path},$${prev_path}) echo skip $${current_path} else echo mkdir -p $${current_path} endif prev_path:=$${current_path} endef default_target: $(foreach file_or_dir_name,$(sort ${DISTFILES}),$(info $(value DISTDIR_PROCESS_FILE_OR_DIRECTORY))) Thanks. _______________________________________________ Help-make mailing list Help-make@gnu.org https://lists.gnu.org/mailman/listinfo/help-make