Remove item from a Makefile variable?

Solution 1:

You could use the filter-out text function if you're using GNU Make.

OTHERVAR := $(filter-out SomethingElse,$(VAR))

Solution 2:

On top of the correct answer above:

VAR = bla1 bla2 bla3 bla4 bla5

TMPVAR := $(VAR)
VAR = $(filter-out bla3, $(TMPVAR))

all:
    @echo "VAR is: $(VAR)"

Output:
VAR is: bla1 bla2 bla4 bla5

Note that this breaks all "recursivity" when filter-out is executed, but that might not matter in your case.