makefile编写

1.程序文件

#include <stdio.h>
int main()
{
    printf("Test\n");
    return 0;
}

2.gcc

$ gcc -o test test.c

在改语句之后能在目录下看到test文件执行文件 ./test即可;

3.修改程序

/*test.h*/

#include <stdio.h>

/*end file*/

/*test.c*/

#include "test.h"
int main()
{
    printf("Test\n");
    return 0;
}

/*end file*/

# makefile

ouput : test.o
    cc -o output test.c
test.o : test.c test.h
    cc -c test.c

clean:
    rm test.o output

4.操作

编译和清除文件:

image

单片机,嵌入式LINUX技术交流群:142282597
原文地址:https://www.cnblogs.com/qiujiahong/p/3132202.html