makefile
作用:将多个源文件编译生成一个可执行文件。
环境:Vmware Workstation;CentOS-6.4-x86_64
说明:a.c,a.h,main.c,makefile在同一个文件夹中。
1、创建并编辑a.h,a.h的代码如下:
void test();
2、创建并编辑a.c,a.c的代码如下:
#include "a.h"
void test()
{
printf("a.test func\n");
}
3、创建并编辑main.c,main.c的代码如下:
#include <stdio.h>
#include "a.h"
int main(int argc, char *args[])
{
test();
return 0;
}
4、创建并编辑makefile,makefile的代码如下:
.SUFFIXES:.c .o
CC=gcc
SR