Voici mon Makefile et la sortie, comment imprimer la gamme comme [1-5, 7, 9-10]
?Comment calculer la plage dans Makefile
$ ls /tmp/foo
foo10.txt foo1.txt foo2.txt foo3.txt foo4.txt foo5.txt foo7.txt foo9.txt
$ cat Makefile
DIR1 := /tmp/foo/
COMMA :=,
EMPTY :=
SPACE := $(EMPTY) $(EMPTY)
VERSIONS := $(subst $(SPACE),$(COMMA),$(patsubst foo%,%,$(basename $(notdir $(wildcard $(DIR1)/foo*.txt)))))
all:
$(info versions is [${VERSIONS}])
$ make
versions is [10,1,2,3,4,5,7,9]
Je peux appeler des commandes shell, si cela va aider. – rodee
Êtes-vous seulement à la recherche d'une solution Makefile ou acceptez-vous aussi un script bash? – anubhava
Bash est bien aussi, je peux appeler une commande shell à partir de mon Makefile. – rodee