mouse_m908/makefile

123 lines
3.5 KiB
Makefile
Raw Normal View History

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-06-16 11:18:39 -06:00
VERSION_STRING = "\"2.1\""
2020-05-02 08:50:55 -06:00
# compile
build: m908 m709 data_rd.o load_config.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 && \
2020-07-20 13:22:21 -06:00
cp ./examples/* $(DOC_DIR)/mouse_m908/ && \
2020-03-17 13:47:30 -06:00
cp ./README.md $(DOC_DIR)/mouse_m908/ && \
2020-03-17 14:07:19 -06:00
cp ./keymap.md $(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-06-13 08:26:01 -06:00
install-bsd:
cp ./mouse_m908 $(BIN_DIR)/mouse_m908 && \
mkdir $(DOC_DIR)/mouse_m908 | true && \
2020-07-20 13:22:21 -06:00
cp ./examples/* $(DOC_DIR)/mouse_m908/ && \
2020-06-13 08:26:01 -06:00
cp ./README.md $(DOC_DIR)/mouse_m908/ && \
cp ./keymap.md $(DOC_DIR)/mouse_m908/ && \
cp ./mouse_m908.1 $(MAN_DIR)/
2020-03-17 14:07:19 -06:00
# remove binary
2019-11-29 16:15:54 -07:00
clean:
2020-05-27 08:55:04 -06:00
rm mouse_m908 *.o
rm -r Haiku/bin Haiku/documentation Haiku/mouse_m908.hpkg | true
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-05-27 08:55:04 -06:00
# this builds a .hpkg package on Haiku
hpkg:
mkdir Haiku/bin
mkdir -p Haiku/documentation/man/man1
mkdir -p Haiku/documentation/packages/mouse_m908
cp mouse_m908 Haiku/bin
cp mouse_m908.1 Haiku/documentation/man/man1
cp example.ini Haiku/documentation/packages/mouse_m908
cp example.macro Haiku/documentation/packages/mouse_m908
cp README.md Haiku/documentation/packages/mouse_m908
cp keymap.md Haiku/documentation/packages/mouse_m908
cd Haiku; \
package create -b mouse_m908.hpkg; \
package add mouse_m908.hpkg bin documentation
# targets for different mice
m908: constructor_m908.o data_m908.o getters_m908.o helpers_m908.o setters_m908.o writers_m908.o readers_m908.o
m709: constructor_m709.o data_m709.o getters_m709.o helpers_m709.o setters_m709.o writers_m709.o readers_m709.o
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
2020-07-12 12:35:13 -06:00
load_config.o:
$(CC) -c include/load_config.cpp $(CC_OPTIONS)
2020-04-08 07:39:30 -06:00
2020-07-12 12:35:13 -06:00
data_rd.o:
2020-04-08 07:39:30 -06:00
$(CC) -c include/data.cpp $(CC_OPTIONS)
2020-07-12 12:35:13 -06:00
constructor_m908.o:
$(CC) -c include/m908/constructor.cpp $(CC_OPTIONS) -o constructor_m908.o
2020-04-08 07:39:30 -06:00
2020-07-12 12:35:13 -06:00
data_m908.o:
$(CC) -c include/m908/data.cpp $(CC_OPTIONS) -o data_m908.o
2020-04-08 07:39:30 -06:00
2020-07-12 12:35:13 -06:00
getters_m908.o:
$(CC) -c include/m908/getters.cpp $(CC_OPTIONS) -o getters_m908.o
helpers_m908.o:
$(CC) -c include/m908/helpers.cpp $(CC_OPTIONS) -o helpers_m908.o
2020-04-08 07:39:30 -06:00
2020-07-12 12:35:13 -06:00
setters_m908.o:
$(CC) -c include/m908/setters.cpp $(CC_OPTIONS) -o setters_m908.o
2020-04-08 07:39:30 -06:00
2020-07-12 12:35:13 -06:00
writers_m908.o:
$(CC) -c include/m908/writers.cpp $(CC_OPTIONS) -o writers_m908.o
2020-05-09 14:33:14 -06:00
2020-07-12 12:35:13 -06:00
readers_m908.o:
$(CC) -c include/m908/readers.cpp $(CC_OPTIONS) -o readers_m908.o
constructor_m709.o:
$(CC) -c include/m709/constructor.cpp $(CC_OPTIONS) -o constructor_m709.o
data_m709.o:
$(CC) -c include/m709/data.cpp $(CC_OPTIONS) -o data_m709.o
getters_m709.o:
$(CC) -c include/m709/getters.cpp $(CC_OPTIONS) -o getters_m709.o
helpers_m709.o:
$(CC) -c include/m709/helpers.cpp $(CC_OPTIONS) -o helpers_m709.o
setters_m709.o:
$(CC) -c include/m709/setters.cpp $(CC_OPTIONS) -o setters_m709.o
writers_m709.o:
$(CC) -c include/m709/writers.cpp $(CC_OPTIONS) -o writers_m709.o
readers_m709.o:
$(CC) -c include/m709/readers.cpp $(CC_OPTIONS) -o readers_m709.o