-
Notifications
You must be signed in to change notification settings - Fork 31
/
Makefile
47 lines (33 loc) · 1.07 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
SRCFILES = attach_devices.c controllers.c joycon_input.c main.c
SRCFILES += uinput_keys.c mapping.c uinput_keys.c calibration.c crc.c
HEADFILES = controllers.h joycon.h uinput_keys.h
CFLAGS = -Wall -Wextra -Wmissing-prototypes
CFLAGS += $(shell pkg-config --cflags hidapi-hidraw)
LDFLAGS = -Wall -Wextra
LDFLAGS += $(shell pkg-config --libs hidapi-hidraw)
ifdef DEBUG
CFLAGS += -fsanitize=address -g
LDFLAGS += -fsanitize=address -g
endif
SRCS = $(addprefix src/, $(SRCFILES))
HEADS = $(addprefix src/, $(HEADFILES))
OBJS = $(SRCS:.c=.o)
all: jcdriver
format: $(SRCS) $(HEADS) switchconnect/main.c
clang-format -style=file -i $^
clean:
rm -f $(OBJS)
rm -f devinput/hidapi_demo.o
rm -f switchconnect/main.o
GOBIN ?= $(GOPATH)/bin
jcdriver: prog4
go install -v ./prog4/jcdriver
cp $(GOBIN)/jcdriver .
jcmapper: $(OBJS)
gcc -o $@ $^ $(LDFLAGS)
jcreader: devinput/hidapi_demo.c
gcc -o $@ devinput/hidapi_demo.c $(shell pkg-config --libs hidapi-hidraw) -fsanitize=address -g
swprobe: switchconnect/main.c
gcc -o $@ $^ -lbluetooth
%.o: %.c $(HEADS)
gcc -c -o $@ $< $(CFLAGS)