# Rozšířené atributy – program na správu rozšířených atributů souborů
# Copyright © 2023 František Kučera (Frantovo.cz)
#
# 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, version 3 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

SRC=$(shell find src -name '*.java')
MAIN=cz.frantovo.rozsireneatributy.Startér
LAF=-Dswing.defaultlaf=javax.swing.plaf.nimbus.NimbusLookAndFeel
VERSION=0.1-SNAPSHOT
JAR=target/rozsirene-atributy-$(VERSION).jar

all: $(JAR)

.PHONY: all clean run run-binfmt

clean:
	rm -rf target

target/classes: $(SRC)
	mkdir -p target/classes
	touch    target/classes
	javac -d target/classes $(SRC)
	cp \
		src/main/resources/cz/frantovo/rozsireneatributy/*.properties \
		target/classes/cz/frantovo/rozsireneatributy/

$(JAR): target/classes
	jar --create --file $(@) --main-class $(MAIN) -C target/classes .
	chmod +x $(@)

run: $(JAR)
	java $(LAF) -jar $(<) --soubor $(<)

run-binfmt: $(JAR)
	$(<) --soubor $(<)
