gcc 是 GUN Compiler Collection的缩写。
预处理(pre-processing),E:插入头文件,替换宏,展开宏
链接 (Linking):链接到库中,变成可执行文件
---------------------------------①-start-------------------------------------------------------------
mytool:main.o tool1.o tool2.o
gcc main.o tool1.o tool2.o -o mytool
gcc main.c -c -Wall -g -o main.o
gcc tool1.c -c -Wall -g -o tool1.o
gcc tool2.c -c -Wall -g -o tool2.o
---------------------------------①-end-------------------------------------------------------------
---------------------------------②-start-------------------------------------------------------------
OBJS=main.o tool1.o tool2.o
CFLAGS+=-c -Wall -g -pthread -D_FILE_OFFSET_BITS=64 -D_GUN_SOURCE
$(CC) main.c $(CFLAGS) $(LDFLAGS) -o main.o
$(CC) tool1.c $(CFLAGS) $(LDFLAGS) -o tool1.o
$(CC) tool2.c $(CFLAGS) $(LDFLAGS) -o tool2.o
---------------------------------②-end-------------------------------------------------------------
---------------------------------③-start-------------------------------------------------------------
OBJS=main.o tool1.o tool2.o
CFLAGS+=-c -Wall -g -pthread -D_FILE_OFFSET_BITS=64 -D_GUN_SOURCE
$(CC) $^ $(CFLAGS) $(LDFLAGS) -o $@
$(CC) $^ $(CFLAGS) $(LDFLAGS) -o $@
$(CC) $^ $(CFLAGS) $(LDFLAGS) -o $@
---------------------------------③-end-------------------------------------------------------------
---------------------------------④-start-------------------------------------------------------------
OBJS=main.o tool1.o tool2.o
CFLAGS+=-c -Wall -g -pthread -D_FILE_OFFSET_BITS=64 -D_GUN_SOURCE
$(CC) $^ $(CFLAGS) $(LDFLAGS) -o $@
---------------------------------④-end-------------------------------------------------------------