help-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

how to write foreach in makefile?


From: Vsyache Puz
Subject: how to write foreach in makefile?
Date: Sun, 26 Jun 2016 08:52:09 +0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.1.0

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.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]