8

Using GNU Make I want to remove values from a variable:

VAR := x.c y.c z.c
<snip>
VAR += x_x.c y_y.c

I now want to remove the "x.c" and "y.c" from the variable. I have tried using subst command but the x_x.c is removed as well.

Are there any ways of doing this?

The final variable should look like:

VAR = z.c x_x.c y_y.c
Ciro Santilli OurBigBook.com
  • 347,512
  • 102
  • 1,199
  • 985
user626201
  • 1,623
  • 3
  • 19
  • 36

1 Answers1

12

You want the filter-out function:

VAR := $(filter-out x.c y.c,$(VAR))
Chris Dodd
  • 119,907
  • 13
  • 134
  • 226