zoukankan      html  css  js  c++  java
  • makefile中函数的使用

    override var += -g                                      #通过命令行传递的参数,不能覆盖var的值
    sources = f1.c f2.c
    define hello
            @echo "test define"
            @echo "test define hello"
    endef
    
    test:foo
            $(call hello)                                   #调用define定义的hello语句块。 
            @echo "test"
    foo:
            @echo "foo" 
            @echo $(var)                                    #make var=-v ==> -g -v
    #函数使用
            @echo $(findstring a,a b c)                     # a $(findstring <find>,<in>) 
            @echo $(patsubst %/,%,test/foo/)                #test/foo
            @echo $(subst lh,LH, lhxlhx)                    #LHxLHx
            @echo $(strip  a b c   )                        #a b c 返回被去掉空格的字符串值
            @echo $(filter %.c %.s,f1.c f2.o f3.s)          #f1.c f3.s
            @echo $(filter-out %.c %.s,f1.c f2.o f3.s)       #f2.o
            @echo $(sort c1 a2 b3)                          #a2 b3 c1
            @echo $(word 2, lhx ai yll)                     #ai
            @echo $(wordlist 2, 3, lhx ai yll)              #ai yll
            @echo $(words lhx ai yll)                       #3
            @echo $(firstword lhx ai yll)                   #lhx
            @echo $(dir src/foo.c hacks)                    #src/ ./
            @echo $(notdir src/foo.c hacks)                 #foo.c hacks
            @echo $(suffix src/foo.c src-1.0/bar.c hacks)   #.c .c
            @echo $(basename src/foo.c src-1.0/bar.c hacks) #src/foo src-1.0/bar hacks
            @echo $(addsuffix .c,foo bar)                   #foo.c bar.c
            @echo $(addprefix src/,foo bar)                 #src/foo src/bar
            @echo $(join aaa bbb , 111 222 333)             #aaa111 bbb222 333
            @echo $(foreach n,a b c,$(n).o)                 #a.o b.o c.o
            @echo $(shell echo "hello")                     #hello
    ###@echo $(error error is test)                 #Makefile:34: *** error is test.  Stop.
            @echo $(sources:.c=.d)                          #f1.d f2.d  
    
  • 相关阅读:
    自然常数e怎么得来的?
    一元线性回归模型
    最小二乘法
    Box-Cox转换
    需要的数学技能
    偏导数
    FineReport 表格分类
    FineReport 普通报表
    FineReport 单元格
    FineReport创建普通报表的流程
  • 原文地址:https://www.cnblogs.com/DXGG-Bond/p/14340137.html
Copyright © 2011-2022 走看看