-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
48 lines (34 loc) · 958 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
CC:=clang
FLEX:=flex
BISON:=bison
PREFIX:=/usr/local
DEPSPATH=deps
FLEXFLAGS+=
BISONFLAGS+=
CFLAGS+=-O2 -Wall -Wextra -Werror -Wpedantic -Winit-self -Wfloat-equal -Wformat=2 -Wno-unused-function -Wno-format-nonliteral -Wno-unused-parameter -Wno-missing-field-initializers -g -std=gnu11 -I$(DEPSPATH)
LDFLAGS+=-lm
DEPSSRC = $(wildcard deps/*/*.c)
DEPSOBJS = $(DEPSSRC:.c=.o)
TESTS=$(wildcard test/*.c)
all: clean zedc
%.o: %.c
$(CC) -c -o $@ $< $(CFLAGS)
%.c %.h: %.y
$(BISON) $(BISONFLAGS) --defines=$*.h --output=$@ $<
%.c: %.l
$(FLEX) $(FLEXFLAGS) -o $@ $<
zedc: $(DEPSOBJS) src/util.o src/ast.o src/codegen.o src/parser.o src/lexer.o src/main.o
$(CC) -o $@ $^ $(LDFLAGS)
install: zedc
install zed $(PREFIX)/bin/zed
.PHONY: test
test: $(TESTS)
@sh tests/runtests.sh
watch:
while true ; do \
make all; \
inotifywait -qre close_write .;\
done
.PHONY: clean
clean:
rm -f src/*.o src/lib/**/*.o src/parser.h src/{parser,lexer}.c zed