2023-07-20 22:34:35 +02:00
|
|
|
NAME=ginput
|
|
|
|
CC=gcc
|
2023-09-19 15:06:41 +02:00
|
|
|
CFLAGS=$(shell pkg-config --cflags gtk4 libadwaita-1 libusb-1.0) -O3 -Wall -I src
|
2023-09-12 13:58:29 +02:00
|
|
|
LDFLAGS=$(shell pkg-config --libs gtk4 libadwaita-1 libusb-1.0)
|
2023-07-20 22:34:35 +02:00
|
|
|
BUILD_DIR=build
|
|
|
|
|
2023-09-18 11:04:16 +02:00
|
|
|
UI := $(shell find ui/ -name '*.ui')
|
|
|
|
C_FILES := $(shell find src/ -name '*.c')
|
2023-07-20 22:34:35 +02:00
|
|
|
|
2023-09-19 15:06:41 +02:00
|
|
|
all: resources $(BUILD_DIR)/$(NAME) $(BUILD_DIR)/drivers
|
2023-07-20 22:34:35 +02:00
|
|
|
|
|
|
|
# Top-level targets
|
|
|
|
resources: $(BUILD_DIR)/glib-2.0/schemas/gschemas.compiled
|
|
|
|
|
|
|
|
$(BUILD_DIR)/$(NAME): $(BUILD_DIR)/resource.c $(C_FILES) | $(BUILD_DIR)
|
|
|
|
gcc $(CFLAGS) -o $@ $^ $(LDFLAGS)
|
|
|
|
|
|
|
|
# Build directory
|
|
|
|
$(BUILD_DIR):
|
|
|
|
mkdir -p $(BUILD_DIR)
|
|
|
|
|
|
|
|
# Resources
|
2023-09-18 11:30:43 +02:00
|
|
|
$(BUILD_DIR)/resource.c: ui/ginput.gresource.xml ui/style.css $(UI)
|
2023-07-20 22:34:35 +02:00
|
|
|
cp ui/style.css $(BUILD_DIR)/
|
2023-09-18 11:04:16 +02:00
|
|
|
cd ui && glib-compile-resources --generate-source --target=resource.c ginput.gresource.xml
|
|
|
|
mv ui/resource.c $(BUILD_DIR)/
|
2023-07-20 22:34:35 +02:00
|
|
|
|
|
|
|
$(BUILD_DIR)/glib-2.0/schemas/gschemas.compiled: v.ginput.gschema.xml | $(BUILD_DIR)
|
|
|
|
mkdir -p $(BUILD_DIR)/glib-2.0/schemas
|
|
|
|
glib-compile-schemas . --targetdir=$(BUILD_DIR)/glib-2.0/schemas
|
|
|
|
|
2023-09-19 15:06:41 +02:00
|
|
|
# Drivers
|
|
|
|
$(BUILD_DIR)/drivers:
|
|
|
|
cd drivers && make
|
|
|
|
|
2023-07-20 22:34:35 +02:00
|
|
|
# Phony targets
|
|
|
|
.PHONY: clean
|
|
|
|
clean:
|
|
|
|
rm -rf $(BUILD_DIR)
|
|
|
|
|
|
|
|
.PHONY: run
|
|
|
|
.SILENT: run
|
|
|
|
run: all
|
2023-07-23 15:20:23 +02:00
|
|
|
XDG_DATA_DIRS=./$(BUILD_DIR) ./$(BUILD_DIR)/ginput
|