forked from audiohacked/OpenCorsairLink
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
140 lines (113 loc) · 3.61 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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
####################################################################################################
#
# This file is part of OpenCorsairLink.
# Copyright (C) 2017-2019 Sean Nelson <[email protected]>
#
# OpenCorsairLink is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# any later version.
#
# OpenCorsairLink is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with OpenCorsairLink. If not, see <http://www.gnu.org/licenses/>.
#
####################################################################################################
CC ?= gcc
# CFLAGS ?=
CFLAGS += -std=c99
# CFLAGS += -pedantic-errors
CFLAGS += -Iinclude
# CFLAGS += -D_XOPEN_SOURCE=500
LDFLAGS ?= -lm
# pkg-config for libusb-1.0
CFLAGS += $(shell pkg-config --cflags libusb-1.0)
LDFLAGS += $(shell pkg-config --libs libusb-1.0)
PREFIX = /usr/local
GIT_VERSION := $(shell git describe --abbrev=4 --always --tags)
CFLAGS += -DVERSION=\"v0.9.0.0-$(GIT_VERSION)\"
####################################################################################################
MAINLOGIC_SOURCE := \
main.c \
device.c \
driver.c \
print.c \
logic/options.c \
logic/options_fan.c \
logic/options_led.c \
logic/options_pump.c \
logic/scan.c \
logic/settings/commanderpro.c \
logic/settings/hydro_asetek.c \
logic/settings/hydro_asetekpro.c \
logic/settings/hydro_coolit.c \
logic/settings/psu.c
LOWLEVEL_SOURCE := \
lowlevel/asetek.c \
lowlevel/commanderpro.c \
lowlevel/coolit.c \
lowlevel/rmi.c
PROTOCOL_SOURCE := \
protocol/asetek/core.c \
protocol/asetek/fan.c \
protocol/asetek/led.c \
protocol/asetek/pump.c \
protocol/asetek/temperature.c \
protocol/asetekpro/core.c \
protocol/asetekpro/fan.c \
protocol/asetekpro/led.c \
protocol/asetekpro/pump.c \
protocol/asetekpro/temperature.c \
protocol/commanderpro/core.c \
protocol/commanderpro/fan.c \
protocol/commanderpro/power.c \
protocol/commanderpro/temperature.c \
protocol/rmi/core.c \
protocol/rmi/power.c \
protocol/rmi/temperature.c \
protocol/rmi/time.c \
protocol/coolit/core.c \
protocol/coolit/fan.c \
protocol/coolit/led.c \
protocol/coolit/pump.c \
protocol/coolit/temperature.c
HEADER := $(shell find ./include -name '*.h')
EXECUTABLE := OpenCorsairLink.elf
####################################################################################################
OBJS := \
${MAINLOGIC_SOURCE:.c=.o}
OBJS_LL := \
${LOWLEVEL_SOURCE:.c=.o}
OBJS_PROTO := \
${PROTOCOL_SOURCE:.c=.o}
.PHONY: all
all: $(EXECUTABLE)
.PHONY: default
default: all
.PHONY: rebuild
rebuild: clean all
.PHONY: style
style: $(MAINLOGIC_SOURCE) $(LOWLEVEL_SOURCE) $(PROTOCOL_SOURCE) $(HEADER)
clang-format -style=file -i $^
.PHONY: tidy
tidy: $(MAINLOGIC_SOURCE) $(LOWLEVEL_SOURCE) $(PROTOCOL_SOURCE)
clang-tidy $^ -checks=* -- -std=c++11
.PHONY: clean
clean:
$(RM) $(EXECUTABLE) $(OBJS) $(OBJS_LL) $(OBJS_PROTO)
.PHONY: install
install: $(EXECUTABLE)
mkdir -p $(DESTDIR)$(PREFIX)/bin
cp $< $(DESTDIR)$(PREFIX)/bin/$(EXECUTABLE)
.PHONY: uninstall
uninstall:
rm -f $(DESTDIR)$(PREFIX)/bin/$(EXECUTABLE)
%.o: %.c
$(CC) $(CFLAGS) -g -c -o $@ $<
$(EXECUTABLE): $(OBJS) $(OBJS_PROTO) $(OBJS_LL)
$(CC) $^ $(CFLAGS) $(LDFLAGS) -o $@
####################################################################################################