Simplest way to reverse the order of strings in a make variable

后端 未结 5 1857
鱼传尺愫
鱼传尺愫 2021-02-19 11:19

Let\'s say you have a variable in a makefile fragment like the following:

MY_LIST=a b c d

How do I then reverse the order of that list? I need

5条回答
  •  南笙
    南笙 (楼主)
    2021-02-19 11:28

    You can also define search groups with ld:

    ld -r foo.o -( a.a b.a c.a -)
    

    Will iterate through a.a, b.a, and c.a until no new unresolved symbols can be satisfied by any object in the group.

    If you're using gnu ld, you can also do:

    ld -r -o foo.o --whole-archive bar.a
    

    Which is slightly stronger, in that it will include every object from bar.a regardless of whether it satisfies an unresolved symbol from foo.o.

提交回复
热议问题