This repository has been archived by the owner on Nov 10, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
62 lines (43 loc) · 1.44 KB
/
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
.PHONY: clean distclean
export SHELL := /bin/bash
ifeq ($(shell uname -s),Darwin)
export PATH := /usr/local/opt/llvm/bin:$(PATH)
endif
CXX=g++
CXXFLAGS=-Wall `llvm-config --cxxflags`
LDFLAGS=`llvm-config --ldflags --system-libs --libs all`
CC=gcc
CFLAGS=-Wall
default: pclcomp builtins.so pcl
pcl: pcltemp
chmod +x pcl
pcltemp: pcl.py
cp pcl.py pcl
builtins.so: builtins.ll
clang builtins.ll -c -o builtins.so
pclcomp: ast.o make_params.o code_gen.o parser.o lexer.o symbol.o error.o general.o
$(CXX) $(CXXFLAGS) -o pclcomp $^ $(LDFLAGS)
general.o: general.c general.h error.h
$(CXX) $(CXXFLAGS) general.c -c -o general.o
error.o: error.c general.h error.h
$(CXX) $(CXXFLAGS) error.c -c -o error.o
symbol.o: symbol.c general.h error.h ast_symbol.h
$(CXX) $(CXXFLAGS) symbol.c -c -o symbol.o
parser.hpp parser.cpp: parser.y
bison -dv parser.y -o parser.cpp
lexer.cpp: lexer.l
flex -s -o lexer.cpp lexer.l
lexer.o: lexer.cpp parser.hpp
$(CXX) $(CXXFLAGS) lexer.cpp -c -o lexer.o
parser.o: parser.cpp
$(CXX) $(CXXFLAGS) parser.cpp -c -o parser.o
ast.o: ast.c
$(CXX) $(CXXFLAGS) -c ast.c -o ast.o
make_params.o: make_params.cpp
$(CXX) $(CXXFLAGS) -c make_params.cpp -o make_params.o
code_gen.o: code_gen.cpp code_gen.hpp ast_symbol.h
$(CXX) $(CXXFLAGS) -c code_gen.cpp -o code_gen.o
clean:
$(RM) *.o *~* parser.hpp *#* parser.output parser.cpp lexer.cpp parser.c lexer.c parser.h a.ll a.s a.out builtins.so
distclean: clean
$(RM) pclcomp pcl