blob: 9e1472ff273b0a6d00b0006dee8d881c75be6bf4 (
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
CC := clang
CFLAGS := -Wall \
-Wextra \
-Wpedantic \
-Wconversion \
-Wsign-conversion \
-Wshadow \
-Wstrict-prototypes \
-Wmissing-prototypes \
-g \
-fno-omit-frame-pointer \
-fsanitize=address,undefined \
-std=c17 \
-Isrc
LDFLAGS := -fsanitize=address,undefined \
-lz
CPPCHECKFLAGS := --project=compile_commands.json \
--enable=warning,style,performance,portability \
--error-exitcode=1
TARGET := bin/jafm
SRC := $(shell find src -name '*.c')
OBJ := $(SRC:src/%.c=bin/%.o)
all: $(TARGET)
$(TARGET): $(OBJ)
@mkdir -p $(@D)
$(CC) $^ -o $@ $(LDFLAGS)
bin/%.o: src/%.c
@mkdir -p $(@D)
$(CC) $(CFLAGS) -c $< -o $@
check:
bear -- make clean all
cppcheck $(CPPCHECKFLAGS)
clean:
rm -rf bin
.PHONY: all check clean
|