|
有两个问题,请教大家。
×××××第一个问题
我的makefile是这样写的:
CFLAGS=-O2
main: abfun.c
gcc -std=c99 -o $@ abfun.c
clean:
rm main
但是生成的main居然和gcc -std=c99 abfun.c 一摸一样。。也就是说makefile里的CFLAGS没起作用,请高手指教啊,为什么?
××××第二个问题
另外在archlinux上:
[laptop tmp]$ gcc -std=c99 abfun.c
[laptop tmp]$ time ./a.out >/dev/null
real 0m12.877s
user 0m12.389s
sys 0m0.277s
[laptop tmp]$ gcc -std=c99 -O2 abfun.c
[laptop tmp]$ time ./a.out >/dev/null
real 0m9.826s
user 0m9.346s
sys 0m0.270s
但是在gentoo上:
Laptop tmp # gcc -std=c99 abfun.c
Laptop tmp # time ./a.out >/dev/null
real 0m12.482s
user 0m12.039s
sys 0m0.300s
Laptop tmp # gcc -std=c99 -O2 abfun.c
Laptop tmp # time ./a.out >/dev/null
real 0m16.375s
user 0m15.849s
sys 0m0.303s
为什么在gentoo上gcc加上O2生成的代码反而变慢了呢 |
|