1
I want to be able to have multiple lists in make, all the same size, one of which contains filenames and the others containing info related to those files, in the same respective order. I want to be able to pass specific info for a file to a program that builds that file. For example, if X is a list of filenames (say matching % in the rule below) and Y and Z are info about those files, I'd like to be able to have a rule like this:
%.a: %.b:
myprogram $(Y[$(*)]) $(Z[$(*)]) $< $@
where $(*) is the make variable equal to the part of the filename matched by %. Of course, variables in make can't be indexed with [].
Thanks for sharing. However, it does not work 100% correct.
$(warning test $(call IDX,aaa bbb ccc ddd,eee))
and$(warning test $(call IDX,aaa bbb ccc ddd,ddd))
both return 4. I can provide a slightly better version that returns 5 (out of index) when the word is not fond:IDX = $(words $(subst $(XX),$(SPACE),$(firstword $(subst $(XX)$(2)$(XX),$(SPACE)$(2)$(SPACE),$(XX)IDX***DUMMY$(XX)$(subst $(SPACE),$(XX),$(1))$(XX)))))
– kuga – 2018-08-22T16:04:44.910