Makefile是一种构建工具,自动化编译和链接源代码,并生成可执行文件或库文件
makefile:
-include ./Makefile.cfg
$(Target):$(Objs)
$(CC) $^ -o $@ $(LNKs)
%.o:%.c
$(CC) $< $(CFLAGs) $@
.PHONY:clean clean_elf clean_all
clean:
rm $(Objs)
clean_elf:
rm $(Target)
clean_all:
rm $(Objs) $(Target)
makefie.cfg:
Objs:=main.o dictser.o
Target:=dictser
LNKs=-lsqlite3 -pthread
CFLAGs:=-c -o
CC:=gcc