ginput/Makefile

48 lines
1.4 KiB
Makefile
Raw Normal View History

2023-07-20 22:34:35 +02:00
NAME=ginput
CC=gcc
CAMBALACHE=cambalache
2023-09-12 13:58:29 +02:00
CFLAGS=$(shell pkg-config --cflags gtk4 libadwaita-1 libusb-1.0) -O3 -I src
LDFLAGS=$(shell pkg-config --libs gtk4 libadwaita-1 libusb-1.0)
2023-07-20 22:34:35 +02:00
BUILD_DIR=build
CMB := $(wildcard ui/*.cmb)
C_FILES := $(shell find $(src) -name '*.c')
all: resources $(BUILD_DIR)/$(NAME)
# 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)
# UI : Cambalache contains all of the UI files, just compile them all
$(BUILD_DIR)/%.ui: ui/$(NAME).cmb | $(BUILD_DIR)
$(CAMBALACHE) -E $^
2023-07-20 22:34:35 +02:00
mv ui/*.ui $(BUILD_DIR)/
# Resources
$(BUILD_DIR)/resource.c: ui/ginput.gresource.xml ui/style.css $(BUILD_DIR)/main-window.ui
cp ui/style.css $(BUILD_DIR)/
cp ui/ginput.gresource.xml $(BUILD_DIR)/
cd $(BUILD_DIR) && glib-compile-resources --generate-source --target=resource.c ginput.gresource.xml
$(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
# Phony targets
.PHONY: clean
clean:
rm -f ui/*.ui # Remove compiled UI files that might be left over
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