You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
45 lines
1.2 KiB
45 lines
1.2 KiB
NAME=ginput
|
|
CC=gcc
|
|
CFLAGS=$(shell pkg-config --cflags gtk4 libadwaita-1 libusb-1.0) -O3 -Wall -I src
|
|
LDFLAGS=$(shell pkg-config --libs gtk4 libadwaita-1 libusb-1.0)
|
|
BUILD_DIR=build
|
|
|
|
UI := $(shell find ui/ -name '*.ui')
|
|
C_FILES := $(shell find src/ -name '*.c')
|
|
|
|
all: resources $(BUILD_DIR)/$(NAME) $(BUILD_DIR)/drivers
|
|
|
|
# Top-level targets
|
|
resources: $(BUILD_DIR)/glib-2.0/schemas/gschemas.compiled
|
|
|
|
$(BUILD_DIR)/$(NAME): $(BUILD_DIR)/resource.c $(C_FILES) | $(BUILD_DIR)
|
|
$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS)
|
|
|
|
# Build directory
|
|
$(BUILD_DIR):
|
|
mkdir -p $(BUILD_DIR)
|
|
|
|
# Resources
|
|
$(BUILD_DIR)/resource.c: ui/ginput.gresource.xml ui/style.css $(UI)
|
|
cp ui/style.css $(BUILD_DIR)/
|
|
cd ui && glib-compile-resources --generate-source --target=resource.c ginput.gresource.xml
|
|
mv ui/resource.c $(BUILD_DIR)/
|
|
|
|
$(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
|
|
|
|
# Drivers
|
|
.PHONY: $(BUILD_DIR)/drivers
|
|
$(BUILD_DIR)/drivers:
|
|
cd drivers && make
|
|
|
|
# Phony targets
|
|
.PHONY: clean
|
|
clean:
|
|
rm -rf $(BUILD_DIR)
|
|
|
|
.PHONY: run
|
|
.SILENT: run
|
|
run: all
|
|
XDG_DATA_DIRS=./$(BUILD_DIR) ./$(BUILD_DIR)/ginput
|
|
|