zoukankan      html  css  js  c++  java
  • makefile笔记


    http://stackoverflow.com/questions/3932895/makefile-aliases

    SRC=$(wildcard '*.c')

    test: $(SRC)
        gcc -o $@ $^ $(CFLAGS) $(LIBS)

        $@ is the target i.e. test
        $^ is the list of pre-requisites for the rule (which in this case is the expanded wild card list as specified in SRC=$(wildcard '*.c'))

        SRC=$(wildcard '*.c')    it's a file matching wildcard. https://www.gnu.org/software/make/manual/html_node/Wildcard-Function.html#Wildcard-Function
        
    All such variables are explained in the Automatic variables page of the GNU make manual.
    https://www.gnu.org/software/make/manual/html_node/Automatic-Variables.html#Automatic-Variables

    a makefile to compile all C source files in the directory and then link them together could be written as follows:

    objects := $(patsubst %.c,%.o,$(wildcard *.c))

    foo : $(objects)
            cc -o foo $(objects)

    $(patsubst %.c,%.o,$(wildcard *.c))    it can  change the list of C source files into a list of object files by replacing the ‘.c’ suffix with ‘.o’ in the result,

    $(wildcard *.c)    it can get a list of all the C source files in a directory       

  • 相关阅读:
    用require.js封装原生js轮播图
    最全状态码
    常用DOM结构方法总结
    CSS浮动、绝对、相对定位
    盒模型
    构造函数、原型和实例的关系
    Android测试网络是否连接
    Android第一天
    JQuery图片切换动画效果
    Hibernate增删查改语句
  • 原文地址:https://www.cnblogs.com/cutepig/p/4298631.html
Copyright © 2011-2022 走看看