forked from ReimuNotMoe/ydotool
-
Notifications
You must be signed in to change notification settings - Fork 1
/
makefile
63 lines (51 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
61
62
63
# Compiler flags
WARN := -Wall -Wextra -Wpedantic -Wshadow -Wcast-align -Wconversion -Wduplicated-cond -Wduplicated-branches -Wlogical-op -Wnull-dereference -Wdouble-promotion
OPT += -pthread
# Auto-dependency generation (Part 1)
# See: http://make.mad-scientist.net/papers/advanced-auto-dependency-generation/
DEPFLAGS = -MT $@ -MMD -MP -MF dep/$*.d
CFLAGS = $(DEPFLAGS) $(WARN) $(OPT)
# Executables
EXE := test ydotool ydotoold
# Secondary expansion for expanding dependency variable lists in generic linking rule
.SECONDEXPANSION:
# Executable dependencies
test_DEP := uinput.o test.o
ydotool_DEP := ydotool.o uinput.o
ydotoold_DEP := ydotoold.o uinput.o
# Default to building the executables
.PHONY: default
default: $(EXE)
# Generic compilation rule
%.o : %.c dep/%.d | dep
$(CC) $(CFLAGS) -c $< -o $@
# Generic linking rule
$(EXE): %: $$(%_DEP)
$(CC) $(CFLAGS) $^ -o $@
# Make dependency directory if it doesn't exist
dep:
@mkdir -p $@
# Auto-dependency generation (Part 2)
# See: http://make.mad-scientist.net/papers/advanced-auto-dependency-generation/
SRCS := $(wildcard *.c)
DEPFILES := $(SRCS:%.c=dep/%.d)
$(DEPFILES):
include $(wildcard $(DEPFILES))
# Install built binaries
.PHONY: install
install:
mkdir -p /usr/local/bin
cp ydotool /usr/local/bin
cp ydotoold /usr/local/bin
# Remove build files
.PHONY: clean
clean:
$(RM) -r $(EXE) *.o ./dep ./doc
# Perform a static analysis check
.PHONY: cppcheck
cppcheck:
@cppcheck --enable=all --force -q --suppress=missingIncludeSystem .
# Generate doxygen documentation
.PHONY: doxygen
doxygen:
@doxygen