I have a target inside a makefile:
all: $(TARGETS)
I want a variant that differs from all only by the fact that it sets an environment variable. Something like:
all-abc: $(TARGETS)
ABC=123
but that doesn't work because the dependencies are processed before the variable is set. I've thought about having another dependency before the real ones that just sets the environment variable but I don't think the environment persists across targets. That is to say that
abc:
ABC=123
all-abc: abc $(TARGETS)
doesn't work. What I ultimately want to be able to do is
$ make all-abc
instead of
$ ABC=123 make
Is it possible to set an environment variable like this ?
(GNU Make 3.82)
make all ABC=123?123)