您的位置:首页 > 运维架构 > Linux

linux makefile 基础

2014-05-05 18:45 363 查看
linux makefile基础

gcc -c -o test.o test.c

gcc -o helloworld test.o

1.做成makefile如下所示:

helloworld:test.o

gcc -o helloworld test.o

test.o:test.c

gcc -c -o test.o test.c

执行:ke -f helloworld

2.其中$@代表目标文件,$^代表依赖文件

可以改写为:

helloworld:test.o

gcc -o $@ $^

test.o:test.c

gcc -c -o $@ $^

注:1.运行makefile文件的命令是:make -f  filename

        2 直接运行 gcc -c -o test  test.c 可直接生成 test可执行文件
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: