hachem.wtf
aboutsummaryrefslogtreecommitdiff
path: root/Makefile
blob: b98c49f3a6da39d1736c5878c77b6ecb81bc5138 (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
CC := clang
SANITIZE ?= 1

CFLAGS := -g                   \
          -Wall                \
          -Wextra              \
          -Wshadow             \
          -Wpedantic           \
          -std=c17             \
          -Wconversion         \
          -Wstrict-prototypes  \
          -Wsign-conversion    \
          -Wmissing-prototypes \
          -fno-omit-frame-pointer

ifeq ($(SANITIZE),1)
CFLAGS += -fsanitize=address,undefined
LDFLAGS += -fsanitize=address,undefined
endif

TARGET := mkproj
SRC := mkproj.c

all: $(TARGET)

$(TARGET): $(SRC)
	$(CC) $(CFLAGS) $< -o $@ $(LDFLAGS)

check:
	bear -- make clean all
	cppcheck --enable=warning,style,performance,portability \
             --project=compile_commands.json                \
	         --error-exitcode=1

clean:
	rm -f $(TARGET)

.PHONY: all check clean