make的简单用法
all: grammer main.cpp
g++ -std=c++11 -I./include -I./include/antlr -L./lib -o ./bin/hython main.cpp ./src/*.c ./src/*.cc -lantlr3c
debug: grammer main.cpp
g++ -DDEBUG -std=c++11 -I./include -I./include/antlr -L./lib -o ./bin/hython main.cpp ./src/*.c ./src/*.cc -lantlr3c
grammer: ./thirdpart/hython.g
java -jar ./thirdpart/antlr-3.4-complete.jar ./thirdpart/hython.g
mv ./hython.tokens ./thirdpart/
mv ./thirdpart/*.c src/
mv ./thirdpart/*.h include/
run:
./bin/hython ./testdata/input1
./bin/hython ./testdata/input2
./bin/hython ./testdata/input3
- 当运行
make/make all
时,会先make grammer
,检查main.cpp是否存在,最后执行下面的command - 其余同理 在make后加上不同的选项执行不同的代码块