Remove item from a Makefile variable?

前端 未结 3 422
不知归路
不知归路 2020-12-24 00:04

I have a makefile, which includes several other makefiles, which in turn all add to a variable like this:

VAR := Something SomethingElse
VAR += SomeOtherThin         


        
3条回答
  •  孤独总比滥情好
    2020-12-24 00:29

    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.

提交回复
热议问题