-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
71 lines (60 loc) · 1.82 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
65
66
67
68
69
70
71
NAME := cherrybuckle
SRC := main.c
VERSION := 1.5.1
PATH_AUDIO ?= "./wav"
PATH_CHERRY_MX_BLUE_AUDIO ?= "./wav_cherrymxblue"
CFLAGS ?= -O3 -g
LDFLAGS ?= -g
CFLAGS += -Wall -Werror
CFLAGS += -DVERSION=\"$(VERSION)\"
CFLAGS += -DPATH_AUDIO=\"$(PATH_AUDIO)\"
CFLAGS += -DPATH_CHERRY_MX_BLUE_AUDIO=\"$(PATH_CHERRY_MX_BLUE_AUDIO)\"
ifdef mingw
BIN := $(NAME).exe
CROSS := i686-w64-mingw32-
CFLAGS += -Iwin32/include -Iwin32/include/AL
LDFLAGS += -mwindows -static-libgcc -static-libstdc++
LIBS += -Lwin32/lib -lALURE32 -lOpenAL32
SRC += scan-windows.c
else
OS := $(shell uname)
ifeq ($(OS), Darwin)
BIN := $(NAME)
PKG_CONFIG_PATH := "./mac/lib/pkgconfig"
LIBS += $(shell PKG_CONFIG_PATH=$(PKG_CONFIG_PATH) pkg-config --libs alure openal)
CFLAGS += $(shell PKG_CONFIG_PATH=$(PKG_CONFIG_PATH) pkg-config --cflags alure openal)
LDFLAGS += -framework ApplicationServices -framework OpenAL
SRC += scan-mac.c
else
BIN := $(NAME)
ifdef libinput
LIBS += $(shell pkg-config --libs openal alure libinput libudev)
CFLAGS += $(shell pkg-config --cflags openal alure libinput libudev)
SRC += scan-libinput.c
else
LIBS += $(shell pkg-config --libs openal alure xtst x11)
CFLAGS += $(shell pkg-config --cflags openal alure xtst x11)
SRC += scan-x11.c
endif
endif
endif
OBJS = $(subst .c,.o, $(SRC))
CC ?= $(CROSS)gcc
LD ?= $(CROSS)gcc
CCLD ?= $(CC)
STRIP = $(CROSS)strip
%.o: %.c
$(CC) $(CPPFLAGS) $(CFLAGS) -c $< -o $@
$(BIN): $(OBJS)
$(CCLD) $(LDFLAGS) -o $@ $(OBJS) $(LIBS)
dist:
mkdir -p $(NAME)-$(VERSION)
cp -a *.c *.h wav Makefile LICENSE $(NAME)-$(VERSION)
tar -zcf /tmp/$(NAME)-$(VERSION).tgz $(NAME)-$(VERSION)
rm -rf $(NAME)-$(VERSION)
rec: rec.c
gcc -Wall -Werror rec.c -o rec
clean:
$(RM) $(OBJS) $(BIN) core rec
strip: $(BIN)
$(STRIP) $(BIN)