# Copyright (C) 2022 Karel 'Clock' Kulhavý from Twibright Labs.
# 
# This file is part of Jpeginsert.
#
# Jpeginsert 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 3 of the License, or (at your option) any later version.
#
# Jpeginsert 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 Jpeginsert. If not, see <https://www.gnu.org/licenses/>.

CFLAGS=-O3 -Wall
LDFLAGS=-s -static
LDLIBS=-lgmp
.PHONY: install rsync tgz

install: jpeginsert jpeginsert_play_file.sh jpeginsert_play_music_file.sh jpeginsert_play_url.sh
	sudo install jpeginsert /usr/bin
	sudo install jpeginsert_play_file.sh /usr/bin
	sudo install jpeginsert_play_music_file.sh /usr/bin
	sudo install jpeginsert_play_url.sh /usr/bin

rsync:
	rsync -vv -z -r -t --progress \
	jpeginsert.html \
	ronja:www/twibright.com/ronja/

jpeginsert: jpeginsert.c
	$(CC) -o $@ $(CFLAGS) $< $(LDFLAGS) $(LDLIBS)

tgz: jpeginsert.c Makefile COPYING README INSTALL COPYING jpeginsert_*.sh
	odn=jpeginsert_$$(date -Ihours|cut -b -13|tr -d -); \
	tar --transform="s/^/$$odn\//" -czvf "$$odn".tgz $^
