VALAC = valac
PKGS = --pkg gtk+-3.0
# KORREKTUR: launcher_config_window.vala zur Code-Basis hinzugefügt
SOURCES = config.vala launcher_utils.vala launcher_ui.vala launcher_config_window.vala icon_picker.vala launcher_creator.vala launcher_window_manager.vala main.vala
TARGET = mu-applauncher
VERSION = 1.0.6
PREFIX = /usr/local

all:
	$(VALAC) $(PKGS) $(SOURCES) -o $(TARGET)

clean:
	rm -rf $(TARGET) *.deb *.tar.gz dist_staging

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

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

# Erstellt das universelle Source-Archiv (.tar.gz) inklusive GPLv2+ Lizenztext
dist: clean
	mkdir -p dist_staging/$(TARGET)-$(VERSION)
	cp -r $(SOURCES) Makefile usr DEBIAN dist_staging/$(TARGET)-$(VERSION)/
	@echo "Mu-AppLauncher - Copyright (C) 2026 Mark Ulrich <markulrich@gmx.de>" > dist_staging/$(TARGET)-$(VERSION)/LICENSE
	@echo "This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version." >> dist_staging/$(TARGET)-$(VERSION)/LICENSE
	tar -czf $(TARGET)-$(VERSION).tar.gz -C dist_staging $(TARGET)-$(VERSION)
	rm -rf dist_staging
	@echo "Source-Paket erfolgreich erstellt: $(TARGET)-$(VERSION).tar.gz"

# Erstellt das installierbare Debian-Paket (.deb)
deb: all
	mkdir -p dist_staging/$(TARGET)_$(VERSION)_amd64/usr/bin
	cp $(TARGET) dist_staging/$(TARGET)_$(VERSION)_amd64/usr/bin/
	cp -r usr dist_staging/$(TARGET)_$(VERSION)_amd64/
	cp -r DEBIAN dist_staging/$(TARGET)_$(VERSION)_amd64/
	dpkg-deb --build dist_staging/$(TARGET)_$(VERSION)_amd64
	mv dist_staging/$(TARGET)_$(VERSION)_amd64.deb ./$(TARGET)_$(VERSION)_amd64.deb
	rm -rf dist_staging
	@echo "Debian-Paket erfolgreich erstellt: $(TARGET)_$(VERSION)_amd64.deb"

