• 第4月第1天 makefile automake


    1.

    gnu make的函数调用是$,比如 $(subst ee,EE,feet on the street)

    规则中“TARGETS”可以是空格分开的多个文件名

    a all:
    echo $(subst ee,EE,feet on the street)

     Phony-Targets

    SUBDIRS = foo bar baz
    
    .PHONY: subdirs $(SUBDIRS)
    
    subdirs: $(SUBDIRS)
    
    $(SUBDIRS):
            $(MAKE) -C $@
    
    foo: baz

    Pattern Rules

    Makefile里的.c.o等价于 %.o : %.c

    .c.o:
        $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
        $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
    gcc -DLOCALEDIR="/usr/local/share/locale" -DLIBDIR="/usr/local/lib" -DINCLUDEDIR="/usr/local/include" -DHAVE_CONFIG_H -I.  -I./glob    -g -O2 -MT ar.o -MD -MP -MF .deps/ar.Tpo -c -o ar.o ar.c
    mv -f .deps/ar.Tpo .deps/ar.Po
    ...

    gcc  -g -O2   -o make ar.o arscan.o commands.o default.o dir.o expand.o file.o function.o getopt.o getopt1.o implicit.o job.o main.o misc.o read.o remake.o remote-stub.o rule.o signame.o strcache.o variable.o version.o vpath.o hash.o glob/libglob.a

     
    下载3.8.2源码编译,./configure && make

    http://www.gnu.org/software/make/manual/make.html#Text-Functions

    http://ftp.gnu.org/gnu/make/

    2.

     automake生成的Makefile

    all: config.h
        $(MAKE) $(AM_MAKEFLAGS) all-recursive
    ...

    RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive
    html-recursive info-recursive install-data-recursive
    install-dvi-recursive install-exec-recursive
    install-html-recursive install-info-recursive
    install-pdf-recursive install-ps-recursive install-recursive
    installcheck-recursive installdirs-recursive pdf-recursive
    ps-recursive uninstall-recursive

    ...
    
    $(RECURSIVE_TARGETS):
        @fail= failcom='exit 1'; 
        for f in x $$MAKEFLAGS; do 
          case $$f in 
            *=* | --[!k]*);; 
            *k*) failcom='fail=yes';; 
          esac; 
        done; 
        dot_seen=no; 
        target=`echo $@ | sed s/-recursive//`; 
        list='$(SUBDIRS)'; for subdir in $$list; do 
          echo "Making $$target in $$subdir"; 
          if test "$$subdir" = "."; then 
            dot_seen=yes; 
            local_target="$$target-am"; 
          else 
            local_target="$$target"; 
          fi; 
          ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) 
          || eval $$failcom; 
        done; 
        if test "$$dot_seen" = "no"; then 
          $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; 
        fi; test -z "$$fail"
    ...
    all-am: Makefile $(PROGRAMS) $(MANS) $(HEADERS) config.h
    
    ...
    make$(EXEEXT): $(make_OBJECTS) $(make_DEPENDENCIES) 
        @rm -f make$(EXEEXT)
        $(LINK) $(make_OBJECTS) $(make_LDADD) $(LIBS)
    
    ...
    
    am_make_OBJECTS = ar.$(OBJEXT) arscan.$(OBJEXT) commands.$(OBJEXT) 
        default.$(OBJEXT) dir.$(OBJEXT) expand.$(OBJEXT) 
        file.$(OBJEXT) function.$(OBJEXT) getopt.$(OBJEXT) 
        getopt1.$(OBJEXT) implicit.$(OBJEXT) job.$(OBJEXT) 
        main.$(OBJEXT) misc.$(OBJEXT) read.$(OBJEXT) remake.$(OBJEXT) 
        $(am__objects_1) rule.$(OBJEXT) signame.$(OBJEXT) 
        strcache.$(OBJEXT) variable.$(OBJEXT) version.$(OBJEXT) 
        vpath.$(OBJEXT) hash.$(OBJEXT)
    make_OBJECTS = $(am_make_OBJECTS)
    
    ...
    
    .c.o:
        $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
        $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po

    http://www.laruence.com/2009/11/18/1154.html

    http://blog.csdn.net/lights_joy/article/details/2846691

  • 相关阅读:
    CF1438C Engineer Artem
    Python小程序:向SecureCRT发送命令
    PyInstaller,可将py脚本转换为exe
    在Virtual Box上安装linux系统,启动SSH服务
    Python介绍
    Git使用入门
    字符编码介绍
    适配器模式Adapter、外观模式Facade-- 学习HeadFirst设计模式记录
    复合模式Compound -- 学习HeadFirst设计模式记录
    代理模式Proxy-- 学习HeadFirst设计模式记录
  • 原文地址:https://www.cnblogs.com/javastart/p/6241150.html
Copyright © 2020-2023  润新知