Skip to content

Latest commit

 

History

History
24 lines (18 loc) · 537 Bytes

File metadata and controls

24 lines (18 loc) · 537 Bytes

gcc&&make杂记

gcc

gcc -c编译成.o文件,不链接
gcc -g加入调试信息
gcc -o指定输出文件名

make

Makefile的写法,下面是一个简单的例子(hello.c):

CC=gcc    
all:hello
hello.o:hello.c
	$(CC) -o hello.o hello.c
hello:hello.o
	$(CC) -o hello hello.o
clean:
	rm -f *.o hello

make+target会执行某个target指定的功能,如make clean会删除文件。不加参数执行make的时候它会查找第一个target,在此处是all。