-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
50 lines (34 loc) · 895 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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
.DEFAULT_GOAL := creol
.PHONY: creol debug release clean
CC = clang++
OUTPUT = creol
FLAGS = -std=c++17 -fPIC
DBG_FLAGS = $(FLAGS) -g -Wall
RLS_FLAGS = $(FLAGS) -O3 -finline-functions
OBJS = main.o ast.o cli.o parser.o scanner.o
SRCS = main.cpp \
src/creol/ast.cc \
src/creol/cli.cc \
parser.cc scanner.cc \
include/external/argparse.hpp
# The default build is debug.
# Change to release if wanted.
creol: debug
@echo "\n\nRun the compiler with:"
@echo "\n ./creol --help\n"
dbg-obj: $(SRCS)
@echo "~~ Debug build ~~"
$(CC) -c $(DBG_FLAGS) $^
debug: dbg-obj
$(CC) -o $(OUTPUT) $(DBG_FLAGS) $(OBJS)
rls-obj: $(SRCS)
@echo "~~ Release build ~~"
$(CC) -c $(RLS_FLAGS) $^
release: rls-obj
$(CC) -o $(OUTPUT) $(RLS_FLAGS) $(OBJS)
parser.cc parser.hh:
bison -dt rules/parser.y -o parser.cc
scanner.cc:
flex -o scanner.cc rules/scanner.l
clean:
rm *.o creol