-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathMakefile
More file actions
72 lines (50 loc) · 1.76 KB
/
Makefile
File metadata and controls
72 lines (50 loc) · 1.76 KB
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
61
62
63
64
65
66
67
68
69
70
71
# MIT License, Copyright (c) 2023-2026 Barnabás Zahorán, see LICENSE
#================================ Parameters ==================================
CC ?= cc
CSTD = c99
IFLAGS = -I/usr/lib/swipl/include -I/usr/lib/swi-prolog/include -I/usr/include/freetype2
WFLAGS = -Wall -Wextra -Wconversion -Wshadow -pedantic -pedantic-errors
OFLAGS = -O2
CFLAGS = -std=$(CSTD) $(IFLAGS) $(WFLAGS) $(OFLAGS) -fpic
LDFLAGS = -shared -lX11 -lXft -lXrandr
LIB_PATH = /usr/local/lib
BIN_DIR = bin
PLWM = $(BIN_DIR)/plwm
PLX_O = $(BIN_DIR)/plx.o
PLX_SO = $(BIN_DIR)/plx.so
SWIFLAGS = -p foreign=$(LIB_PATH) \
--goal=main --toplevel=halt --stand_alone=true -O -o $(PLWM) -c src/plwm.pl
#================================== Build =====================================
$(PLWM): src/*.pl $(PLX_SO)
swipl $(SWIFLAGS)
$(PLX_SO): $(PLX_O)
$(CC) $< $(LDFLAGS) -o $@
$(PLX_O): src/plx.c $(BIN_DIR)
$(CC) -c $(CFLAGS) $< -o $@
$(BIN_DIR):
mkdir $(BIN_DIR)
clean:
rm -f $(BIN_DIR)/*
rebuild: clean $(PLWM)
#============================== Static checks =================================
cppcheck:
cppcheck -q --enable=all --language=c --std=$(CSTD) \
--suppress=missingIncludeSystem --inline-suppr \
--check-level=exhaustive --inconclusive \
--error-exitcode=1 \
src/plx.c
clang-tidy:
clang-tidy --checks='clang-analyzer-*' --extra-arg="-std=$(CSTD)" \
--extra-arg="-I/usr/include/freetype2" \
--extra-arg="-I/usr/lib/swipl/include" \
--extra-arg="-I/usr/lib/swi-prolog/include" \
--warnings-as-errors='*' \
src/plx.c --
#=============================== Unit tests ===================================
test:
tests/run_unit_tests.sh
#============================ Install/uninstall ===============================
install:
tools/install.sh
uninstall:
tools/uninstall.sh