makefile filter &&filter-out


    Sources: = foo.c Bar.c baz.s abc.h
    foo: $ (Sources)
            GCC $ (% filter .s .c%, $ (Sources)) -o foo

(Pic) that foo The depends of foo.c, bar .c, baz.s and ugh.h but only foo.c , bar.c and baz.s should be specified in the command to the compiler.
filter out .c and .s participate in the compilation.

    Objects: = main1.o foo.o main2.o bar.o
    MAINS: = main1.o main2.o

The following. Generates A The Object List Files Which Not All the contains in 'MAINS':

$ ($ filter-OUT (MAINS) , $ (objects))
to achieve the removal of the variable "objects" in the "mains" defined string (file name) function. Its return value "foo.o bar.o".

Guess you like

Origin www.cnblogs.com/yuguangyuan/p/10929967.html