-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
60 lines (44 loc) · 1.54 KB
/
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
49
50
51
52
53
54
55
56
57
58
59
60
all: panpi
COMPILE_X11 ?= true
VERSION := $(shell git describe --tags --dirty --always)
override CFLAGS += -isystem third_party -I src -std=gnu2x \
-DVERSION=\"$(VERSION)\" -DCOMPILE_X11=$(COMPILE_X11) \
-Wall -Wextra \
-Wmissing-prototypes -Wmissing-declarations -Wswitch-default -Wswitch-enum \
-Wundef -Wunused-macros -Wshadow -Winline -Wpointer-arith -Winit-self \
-Wnull-dereference -Wvector-operation-performance -Wformat-signedness \
-Wwrite-strings -Wlogical-op -Wjump-misses-init -Wcast-align \
-Wconversion -Wsign-conversion \
-Wdouble-promotion -Wfloat-conversion -Wfloat-equal #\
# -fanalyzer
override LDFLAGS += -lm -lasound -lfftw3
SOURCES := $(wildcard src/*.c src/*/*.c)
ifdef DEBUG
override CFLAGS += -g -Og -pg -Wno-inline
else
override CFLAGS += -O3 -march=native -ffast-math -flto
endif
ifeq ($(COMPILE_X11), true)
override CFLAGS += -DUSE_X11
override LDFLAGS += -lX11
else
SOURCES := $(filter-out src/framebuffer/framebuffer_X11.c,$(SOURCES))
endif
panpi: $(SOURCES)
$(info $(COMPILE_X11))
gcc $(CFLAGS) $(LDFLAGS) -o panpi $^
clean:
rm -f panpi
run: panpi
./panpi
check:
@cppcheck -q --enable=all --inconclusive --suppress=missingInclude src
@clang-format -n --style=file src/*.c src/*.h
@echo "Check for files without copyright header"
@grep --color -L "(C) 2022 Ryan Suchocki" src/*.c src/*.h
@echo "Check for headers without #pragma once"
@grep --color -L "#pragma once" src/*.h
@echo "Check for files with TODOs"
@! grep --color -l "TODO" src/*.c src/*.h
format:
clang-format -i --style=file src/*.c src/*.h