-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmakefile
44 lines (35 loc) · 881 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
CC = gcc
# Release flags
RELFLAGS = -Wall -I./include/
# Debug flags
DBGFLAGS = -Wall -I./include/ -O0 -g -DEPS_DBG
EXEC = epsilon
SRCMODULES = core/errors.c core/input.c core/memory.c \
core/ds/list.c core/ds/dict.c core/object.c\
lexer/lexer.c lexer/token.c \
parser/parser.c \
interpreter/interpret.c interpreter/enviroment.c \
interpreter/statements.c interpreter/expressions.c \
interpreter/runtime_errors.c
OBJMODULES = $(SRCMODULES:.c=.o)
.DEFAULT_GOAL := all
.PHONY: all clean build install debug
DEBUG ?= 0
ifeq ($(DEBUG), 1)
CFLAGS := $(DBGFLAGS)
else
CFLAGS := $(RELFLAGS)
endif
%.o: %.c %.h
$(CC) $(CFLAGS) -c $< -o ./bin/$@
build: epsilon.c $(OBJMODULES)
$(CC) $(CFLAGS) $^ -o ./bin/$(EXEC)
clean:
rm -f ./$(OBJMODULES)
install:
install ./bin/$(EXEC) /usr/local/bin
all:
mkdir -p bin
make build
make install
make clean