makefile学习笔记
时间:2006-01-19 来源:ylzjl
编写Makefile的时候,最前面的空白必须使用TAB键,否则不通过。
下面的程序在RHEL4上调试通过,保存文件在同一目录,执行make即可
#########a.c#########################################
#include <stdio.h>
int
main(void)
{
printf( "in main().\n" );
called();
return 0;
}
#########b.c#########################################
#include <stdio.h>
void
called(void)
{
printf("In called.\n");
}
#########Makefile#########################################
#by ylzjl
#Begin Makefile
CC=gcc
OBJS=a.o b.o
all:test
test:a.o b.o
$(CC) $(OBJS) -o test
clean:
rm -f *.o core
clobber:clean
rm -f test
#End Makefile
下面的程序在RHEL4上调试通过,保存文件在同一目录,执行make即可
#########a.c#########################################
#include <stdio.h>
int
main(void)
{
printf( "in main().\n" );
called();
return 0;
}
#########b.c#########################################
#include <stdio.h>
void
called(void)
{
printf("In called.\n");
}
#########Makefile#########################################
#by ylzjl
#Begin Makefile
CC=gcc
OBJS=a.o b.o
all:test
test:a.o b.o
$(CC) $(OBJS) -o test
clean:
rm -f *.o core
clobber:clean
rm -f test
#End Makefile
相关阅读 更多 +
排行榜 更多 +