# Compiler Configuration
VALAC = valac
PKGS = --pkg gtk+-3.0 --pkg gio-2.0 --pkg cairo --pkg gio-unix-2.0
VALAFLAGS = -X -O2
TARGET = canvas_server
SOURCES = canvas_server.vala



# Default Target
all: $(TARGET)

# Compile Release Binary
$(TARGET): $(SOURCES)
	$(VALAC) $(VALAFLAGS) $(PKGS) $(SOURCES) -o $(TARGET)

# Compile Debug Binary
debug:
	$(VALAC) -g $(PKGS) $(SOURCES) -o $(TARGET)

# Clean Build Artifacts
clean:
	rm -f $(TARGET)

# Installation Paths
PREFIX ?= /usr/local

install: $(TARGET)
	install -d $(DESTDIR)$(PREFIX)/bin
	install -m 755 $(TARGET) $(DESTDIR)$(PREFIX)/bin/$(TARGET)

uninstall:
	rm -f $(DESTDIR)$(PREFIX)/bin/$(TARGET)

.PHONY: all debug clean install uninstall