首页 > 其他 > 详细

Makefile

时间:2020-02-09 17:32:39      阅读:57      评论:0      收藏:0      [点我收藏+]

makefile工作原则

原则一

若想生成目标,检查规则中的依赖条件是否存在,如不存在,则去寻找是否有规则去生成依赖文件。如:

makefile

hello:hello.o
    gcc hello.o -o hello

hello.o:hello.c
    gcc -c hello.c -o hello.o

编译

$ make
gcc -c hello.c -o hello.o
gcc hello.o -o hello
原则二

命名: makefile Makefile

  • 一个规则
目标:依赖条件
    [tab]命令

e.g

$ tree
.
├── hello.c
└── makefile

编辑makefile:

hello:hello.c
    gcc hello.c -o hello

使用make编译

$ make
gcc hello.c -o hello
$ ls
hello  hello.c  makefile
  • 2个函数

Makefile

原文:https://www.cnblogs.com/zhuxiang1633/p/12287602.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!