-
Notifications
You must be signed in to change notification settings - Fork 0
/
makefile
64 lines (43 loc) · 1.5 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
64
# SPDX-License-Identifier: AGPL-3.0-or-later
MAKEFLAGS += --no-builtin-variables --no-builtin-rules
CC ?= cc
CC := $(CC)
CPPFLAGS := $(CPPFLAGS)
CPPFLAGS += -I include
CFLAGS ?= -Wall -Wextra -Wpedantic -Wno-unused-parameter
CFLAGS := $(CFLAGS)
CFLAGS += -std=c99
LDFLAGS := $(LDFLAGS)
LDLIBS := $(LDLIBS)
LDLIBS += -lhidapi-libusb
directories.source := source
directories.build := build
directories.build.objects := $(directories.build)/objects
directories.build.targets := $(directories.build)/targets
directories.build.all := $(directories.build)/
objects.all :=
objects.all += whisperer.o whisperer/command.o whisperer/devices/ite/829x.o
objects.all := $(addprefix $(directories.build.objects)/, $(objects.all))
directories.build.all += $(dir $(objects.all))
targets.all :=
targets.whisperer := whisperer
targets.whisperer := $(addprefix $(directories.build.targets)/, $(targets.whisperer))
targets.all += $(targets.whisperer)
directories.build.all += $(dir $(targets.all))
$(targets.whisperer) : $(objects.all) | directories
$(strip $(CC) $(LDFLAGS) $(LDLIBS) -o $@ $^)
$(directories.build.objects)/%.o : $(directories.source)/%.c | directories
$(strip $(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<)
targets.phony :=
targets.phony += whisperer
whisperer: $(targets.whisperer)
targets.phony += all
all: whisperer
targets.phony += clean
clean:
rm -rf $(directories.build)/
targets.phony += directories
directories:
mkdir -p $(sort $(directories.build.all))
.PHONY: $(targets.phony)
.DEFAULT_TARGET := whisperer