makefile

makefile模版


cc=g++
exe=main
obj=main.o initializingSolution.o move.o
cflags=-Wall -g -O2
$(exe):$(obj)
[tab]$(cc) $(obj) -o $(exe)
main.o:main.cpp vertexInThelta.h
[tab]$(cc) $(cflags) -c main.cpp -o main.o
initializingSolution.o:initializingSolution.cpp initializingSolution.h vertexInThelta.h
[tab]$(cc) $(cflags) -c initializingSolution.cpp -o initializingSolution.o
move.o:move.cpp initializingSolution.h vertexInThelta.h
[tab]$(cc) $(cflags) -c move.cpp -o move.o
clean:
[tab]rm -rf *.o $(exe)


主要规则
A: B
(tab)<command>
(tab)<command>
A依赖B文件,B文件通过command产生A文件

你可能感兴趣的:(makefile)