35 lines
728 B
Makefile
35 lines
728 B
Makefile
CXX = g++
|
|
ARGS = -std=c++17
|
|
BISON = /opt/homebrew/opt/bison/bin/bison
|
|
FLEX = flex
|
|
|
|
TARGET = build/py2rb
|
|
|
|
$(TARGET): build/lexer.o build/parser.o build/ParserCtx.o
|
|
$(CXX) $^ -o $@
|
|
|
|
build/lexer.hpp build/lexer.cpp: src/lexer.l build/parser.hpp build
|
|
$(FLEX) --header-file=build/lexer.hpp -o build/lexer.cpp src/lexer.l
|
|
|
|
build/parser.hpp build/parser.cpp: src/parser.y build
|
|
$(BISON) -d -v -o build/parser.cpp src/parser.y
|
|
|
|
build/lexer.o: build/lexer.cpp build
|
|
$(CXX) -c $(ARGS) $< -o $@
|
|
|
|
build/parser.o: build/parser.cpp build
|
|
$(CXX) -c $(ARGS) $< -o $@
|
|
|
|
build/ParserCtx.o: src/ParserCtx.cpp build
|
|
$(CXX) -c $(ARGS) $< -o $@
|
|
|
|
build:
|
|
mkdir -p build
|
|
|
|
clean:
|
|
rm -rf build
|
|
|
|
run: $(TARGET)
|
|
$(TARGET)
|
|
|
|
.PHONY: clean run
|