Chinaunix首页 | 论坛 | 博客
  • 博客访问: 698164
  • 博文数量: 79
  • 博客积分: 10
  • 博客等级: 民兵
  • 技术积分: 1338
  • 用 户 组: 普通用户
  • 注册时间: 2012-06-12 08:51
个人简介

XMU->九天揽月->五湖抓鳖->DSP->driver->kernel/OpenWRT->ISP/RTOS

文章分类

全部博文(79)

文章存档

2020年(2)

2018年(3)

2016年(7)

2015年(42)

2014年(25)

分类: LINUX

2014-08-22 09:14:43

原始:

hello: $(SRCS) 
        @echo compile hello
        $(CC) $(CC_FLAG) -c $(SRCS)
        $(CC) $(CC_FLAG) $(OBJS) -o $(OUT) $(LD_FLAG)

.PHONY: clean

clean:
        @rm -rf $(OBJS) hello

编译结果:

[pole@polar_region hello]$ make clean
[pole@polar_region hello]$
[pole@polar_region hello]$ make hello
compile hello
gcc -g -O0 -c ./hello.c ./test.c
gcc -g -O0 ./hello.o ./test.o -o hello -lrt
[pole@polar_region hello]$
[pole@polar_region hello]$ make hello
make: `hello' is up to date.
[pole@polar_region hello]$


修改:

hello: $(SRCS)  FORCE
        @echo compile hello
        $(CC) $(CC_FLAG) -c $(SRCS)
        $(CC) $(CC_FLAG) $(OBJS) -o $(OUT) $(LD_FLAG)

.PHONY: clean FORCE

clean:
        @rm -rf $(OBJS) hello

编译结果:

[pole@polar_region hello]$ make clean

[pole@polar_region hello]$ make hello
compile hello
gcc -g -O0 -c ./hello.c ./test.c
gcc -g -O0 ./hello.o ./test.o -o hello -lrt
[pole@polar_region hello]$ make hello
compile hello
gcc -g -O0 -c ./hello.c ./test.c
gcc -g -O0 ./hello.o ./test.o -o hello -lrt
[pole@polar_region hello]$

可见FORCE就是不管目标是否存在,和依赖是否更新,都重新生成目标,以及依赖中隐含的目标

阅读(4996) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~