-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
38 lines (26 loc) · 702 Bytes
/
Copy pathMakefile
File metadata and controls
38 lines (26 loc) · 702 Bytes
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
CC=gcc
CFLAGS=-g -std=c11 -D_DEFAULT_SOURCE
TOKENIZE_OBJS=$(patsubst %.c,%.o,$(filter-out shell.c,$(wildcard *.c)))
SHELL_OBJS=$(patsubst %.c,%.o,$(filter-out tokenize.c,$(wildcard *.c)))
ifeq ($(shell uname), Darwin)
LEAKTEST ?= leaks --atExit --
else
LEAKTEST ?= valgrind --leak-test=full
endif
.PHONY: all valgrind clean test
all: shell tokenize
valgrind: shell tokenize
$(LEAKTEST) ./tokenize
$(LEAKTEST) ./shell
tokenize-tests shell-tests : %-tests: %
bash tests/$@
test: tokenize-tests shell-tests
clean:
rm -rf *.o
rm -f shell tokenize
shell: $(SHELL_OBJS)
$(CC) $(CFLAGS) -o $@ $^
tokenize: $(TOKENIZE_OBJS)
$(CC) $(CFLAGS) -o $@ $^
%.o: %.c
$(CC) $(CFLAGS) -c -o $@ $^