2020-03-17 14:07:19 -06:00
|
|
|
# paths for the installation
|
2020-03-17 13:47:30 -06:00
|
|
|
PREFIX = /usr
|
|
|
|
BIN_DIR = $(PREFIX)/bin
|
|
|
|
DOC_DIR = $(PREFIX)/share/doc
|
|
|
|
MAN_DIR = $(PREFIX)/share/man/man1
|
|
|
|
|
2020-04-08 07:39:30 -06:00
|
|
|
# compiler options
|
|
|
|
CC = g++
|
2020-04-19 06:51:05 -06:00
|
|
|
CC_OPTIONS := -Wall -Wextra -O2 `pkg-config --cflags libusb-1.0`
|
|
|
|
LIBS != pkg-config --libs libusb-1.0
|
2020-04-08 07:39:30 -06:00
|
|
|
|
2020-05-02 08:50:55 -06:00
|
|
|
# version string
|
2020-05-14 13:56:18 -06:00
|
|
|
VERSION_STRING = "\"2.0\""
|
2020-05-02 08:50:55 -06:00
|
|
|
|
2020-03-17 14:07:19 -06:00
|
|
|
# compile
|
2020-05-09 14:33:14 -06:00
|
|
|
build: constructor.o data.o getters.o helpers.o load_config.o setters.o writers.o readers.o mouse_m908.o
|
2020-04-08 07:39:30 -06:00
|
|
|
$(CC) *.o -o mouse_m908 $(LIBS) $(CC_OPTIONS)
|
2019-11-08 17:10:30 -07:00
|
|
|
|
2020-03-17 14:07:19 -06:00
|
|
|
# copy all files to their correct location
|
2019-11-08 17:10:30 -07:00
|
|
|
install:
|
2019-11-29 16:15:54 -07:00
|
|
|
cp ./mouse_m908 $(BIN_DIR)/mouse_m908 && \
|
2020-03-17 13:47:30 -06:00
|
|
|
cp ./mouse_m908.rules /etc/udev/rules.d && \
|
|
|
|
mkdir $(DOC_DIR)/mouse_m908 | true && \
|
|
|
|
cp ./example.ini $(DOC_DIR)/mouse_m908/ && \
|
|
|
|
cp ./example.macro $(DOC_DIR)/mouse_m908/ && \
|
|
|
|
cp ./README.md $(DOC_DIR)/mouse_m908/ && \
|
2020-03-17 14:07:19 -06:00
|
|
|
cp ./keymap.md $(DOC_DIR)/mouse_m908/ && \
|
2020-05-02 08:50:55 -06:00
|
|
|
cp ./LICENSE $(DOC_DIR)/mouse_m908/ && \
|
2020-03-17 13:47:30 -06:00
|
|
|
cp ./mouse_m908.1 $(MAN_DIR)/
|
2019-11-29 16:15:54 -07:00
|
|
|
|
2020-03-17 14:07:19 -06:00
|
|
|
# remove binary
|
2019-11-29 16:15:54 -07:00
|
|
|
clean:
|
2020-04-08 07:39:30 -06:00
|
|
|
rm ./mouse_m908 *.o
|
2019-11-29 16:15:54 -07:00
|
|
|
|
2020-03-17 14:07:19 -06:00
|
|
|
# remove all installed files
|
2019-11-29 16:15:54 -07:00
|
|
|
uninstall:
|
2020-03-17 13:47:30 -06:00
|
|
|
rm -f $(BIN_DIR)/mouse_m908 && \
|
|
|
|
rm -f /etc/udev/rules.d/mouse_m908.rules && \
|
|
|
|
rm -rf $(DOC_DIR)/mouse_m908 && \
|
|
|
|
rm -f $(MAN_DIR)/mouse_m908.1
|
2019-11-29 16:15:54 -07:00
|
|
|
|
2020-03-17 14:07:19 -06:00
|
|
|
# this is an alias to install for backwards compatibility
|
2020-03-17 13:47:30 -06:00
|
|
|
upgrade: install
|
2020-02-07 19:58:22 -07:00
|
|
|
|
2020-04-08 07:39:30 -06:00
|
|
|
# individual files
|
|
|
|
mouse_m908.o:
|
2020-05-02 08:50:55 -06:00
|
|
|
$(CC) -c mouse_m908.cpp $(CC_OPTIONS) -D VERSION_STRING=$(VERSION_STRING)
|
2020-04-08 07:39:30 -06:00
|
|
|
|
|
|
|
constructor.o:
|
|
|
|
$(CC) -c include/constructor.cpp $(CC_OPTIONS)
|
|
|
|
|
|
|
|
data.o:
|
|
|
|
$(CC) -c include/data.cpp $(CC_OPTIONS)
|
|
|
|
|
|
|
|
getters.o:
|
|
|
|
$(CC) -c include/getters.cpp $(CC_OPTIONS)
|
|
|
|
|
|
|
|
helpers.o:
|
|
|
|
$(CC) -c include/helpers.cpp $(CC_OPTIONS)
|
|
|
|
|
|
|
|
load_config.o:
|
|
|
|
$(CC) -c include/load_config.cpp $(CC_OPTIONS)
|
|
|
|
|
|
|
|
setters.o:
|
|
|
|
$(CC) -c include/setters.cpp $(CC_OPTIONS)
|
|
|
|
|
|
|
|
writers.o:
|
|
|
|
$(CC) -c include/writers.cpp $(CC_OPTIONS)
|
2020-05-09 14:33:14 -06:00
|
|
|
|
|
|
|
readers.o:
|
|
|
|
$(CC) -c include/readers.cpp $(CC_OPTIONS)
|