aboutsummaryrefslogtreecommitdiff
path: root/Makefile
blob: d542721877def37e42cd16eae21e764b174f58fa (plain)
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
SOURCES = parse.c atom.c eval.c tokens.c env.c
OBJECTS = $(SOURCES:.c=.o)
TEST_OBJECTS = $(foreach obj,$(OBJECTS),test_$(obj))

CFLAGS = -Wall -Wextra -g
LDFLAGS =

CC = gcc
LD = gcc

all: test repl

test_%.o: %.c
	$(CC) $(CFLAGS) -c -o $@ $^

test: CFLAGS := $(CFLAGS) -DBUILD_TEST
test: $(TEST_OBJECTS) tst_main.o
	$(LD) $(LDFLAGS) -o $@ $^

repl: $(OBJECTS) repl.o linenoise.o
	$(LD) $(LDFLAGS) -o $@ $^

.PHONY: clean
clean:
	rm -f *.o
	rm -f test
	rm -f repl