当前位置: 技术问答>linux和unix
makefile 里CFLAGS := -Wall -O2 怎样使用的;RM在哪里定义
来源: 互联网 发布时间:2016-05-29
本文导语: CFLAGS := -Wall -O2 PROGS = prpids ids getname system resusg1 resusg2 child execve waiter killer abort fkill block pending all: $(PROGS) prpids: prpids.c ids: ids.c getname: getname.c resusg1: resusg1.c resusg2: resusg2.c sy...
CFLAGS := -Wall -O2
PROGS =
prpids
ids
getname
system
resusg1
resusg2
child
execve
waiter
killer
abort
fkill
block
pending
all: $(PROGS)
prpids: prpids.c
ids: ids.c
getname: getname.c
resusg1: resusg1.c
resusg2: resusg2.c
system: system.c
child: child.c
execve: execve.c
waiter: waiter.c
killer: killer.c
abort: abort.c
fkill: fkill.c
block: block.c
pending: pending.c
.PHONY : clean dist
dist : clean
tar czf 02152c.tar.gz *.c Makefile
clean:
$(RM) $(PROGS) *.o core *.zip *.gz
PROGS =
prpids
ids
getname
system
resusg1
resusg2
child
execve
waiter
killer
abort
fkill
block
pending
all: $(PROGS)
prpids: prpids.c
ids: ids.c
getname: getname.c
resusg1: resusg1.c
resusg2: resusg2.c
system: system.c
child: child.c
execve: execve.c
waiter: waiter.c
killer: killer.c
abort: abort.c
fkill: fkill.c
block: block.c
pending: pending.c
.PHONY : clean dist
dist : clean
tar czf 02152c.tar.gz *.c Makefile
clean:
$(RM) $(PROGS) *.o core *.zip *.gz
|
如果你的文件中没有RM,那么你看一下环境变量;
-Wall是所有的警告信息都要提示,这样编译出来的程序很健壮;
-O2表示编译时使用2级优化
-Wall是所有的警告信息都要提示,这样编译出来的程序很健壮;
-O2表示编译时使用2级优化
|
$(CC) $(CFLAGS) ...
|
GCC优化时,如果使用了O2编译选项,gcc会将替换其中的某些函数以适应硬件平台,以下文章讲得很清楚:
http://www.ciselant.de/projects/gcc_printf/gcc_printf.html
http://www.ciselant.de/projects/gcc_printf/gcc_printf.html