-
Notifications
You must be signed in to change notification settings - Fork 1
/
makefile
31 lines (22 loc) · 589 Bytes
/
makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
MAKEFLAGS += Rr
CXX := g++
CXXFLAGS := -Wall -Wextra -Wpedantic -Wshadow -std=c++11
CXXFLAGS_LEX := -Wno-switch -std=gnu++11
LEXOUTPUT := lex.yy.c parser.tab.c parser.tab.h
LEXOBJECTS := lex.yy.o parser.tab.o
.PHONY: all
all: compile
compile: main.o $(LEXOBJECTS)
$(CXX) $^ -o $@
%.o: %.cpp
$(CXX) $(CXXFLAGS) $< -c -o $@
lex.yy.o: $(LEXOUTPUT)
$(CXX) $(CXXFLAGS_LEX) lex.yy.c -c -o $@
parser.tab.o: $(LEXOUTPUT)
$(CXX) $(CXXFLAGS_LEX) parser.tab.c -c -o $@
lex.yy.c: lexer.l
flex $<
parser.tab.c: parser.y mne.h
bison -d $<
parser.tab.h: parser.tab.c
main.cpp: parser.tab.h