0
点赞
收藏
分享

微信扫一扫

【Linux】项目自动化构建工具 - make/Makefile

像小强一样活着 2023-12-20 阅读 20
linux

背景

实例代码

C代码

#include <stdio.h>

int main()
{
    printf("hello Makefile!\n");
    return 0;
}

Makefile文件

hello:hello.o
    gcc -o hello hello.o
hello.o:hello.s
    gcc -c -o hello.o hello.s
hello.s:hello.i
    gcc -S -o hello.s hello.i
hello.i:hello.c
    gcc -E -o hello.i hello.c

.PHONY:clean
clean:
    rm -f hello.i hello.s hello.o hello

依赖关系

依赖方法

  •  gcc -option hello.* hello.* ,就是与之对应的依赖关系。

原理

make是如何工作的,在默认的方式下,也就是我们只输入make命令。那么:

项目清理


本文完

举报

相关推荐

0 条评论