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

posted on 2013-06-11 22:38  家乡的萝卜  阅读(155)  评论(0编辑  收藏  举报