Answer the question
In order to leave comments, you need to log in
How to execute a command for each element in a Makefile array?
I can't find a pretty way to execute a command (which only allows one argument) for each folder in the THEMES
.
PREFIX ?= /usr
THEMES ?= ThemeOne ThemeTwo ThemeThree
all:
install:
mkdir -p $(DESTDIR)$(PREFIX)/share/icons
cp -R $(THEMES) $(DESTDIR)$(PREFIX)/share/icons
post-install:
-gtk-update-icon-cache -q $(DESTDIR)$(PREFIX)/share/icons/ThemeOne
-gtk-update-icon-cache -q $(DESTDIR)$(PREFIX)/share/icons/ThemeTwo
-gtk-update-icon-cache -q $(DESTDIR)$(PREFIX)/share/icons/ThemeThree
uninstall:
-rm -rf $(foreach theme,$(THEMES),$(DESTDIR)$(PREFIX)/share/icons/$(theme))
install
and uninstall
such a problem does not arise, but with post-install
this method it will not work, because.gtk-update-icon-cache -q $(foreach theme,$(THEMES),$(DESTDIR)$(PREFIX)/share/icons/$(theme))
$(DESTDIR)$(PREFIX)/share/icons/ThemeOne
. .PHONY: $(THEMES)
$(THEMES):
-gtk-update-icon-cache -q $(DESTDIR)$(PREFIX)/share/icons/[email protected]
post-install: $(THEMES)
Answer the question
In order to leave comments, you need to log in
Sergei E., Look at the eval example, it can be applied to your question:
https
://www.gnu.org/software/make/manual/html_node...
as in the example. Actually, eval itself can not be used. There is more here - an example of using foreach.
But if you need to execute a complex sequence, then you can wrap it in eval with the definition of your functions.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question