gcc makefile

gcc hello.c
gcc hello.c -o hello-world
./a.out
./hello-world

gcc -S hello.c // 会得到汇编代码
as ld

gcc -O2 hello.c -o hello-world
gcc -O0
gcc -O3

objdump -S hello-world | less // 会得到汇编代码,less分页
hexdump -C bootsect // 查看十六进制源码
gcc -S hello.c // 会生成hello.s
as hello.s // 会生成a.out可执行文件
objcopy // 

Makefile

a.out: hello.c
    - gcc hello.c -o a.out

all: a.out

clean:
    - rm -f a.out

.PHONY=all

猜你喜欢

转载自blog.csdn.net/familyshizhouna/article/details/80611629