# Makefile
# By YuGiOhJCJ <yugiohjcj@1s.fr>
# http://yugiohjcj.1s.fr/
# 2011-07-30
#
# 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 3 of the License, or
# (at your option) any later version.
#
# 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/>.

DESTDIR=makedev
MKDIR=mkdir -vp
RM=rm -rfv
CP=cp -rfv
GIMP=gimp
GIMPTOOL=gimptool-2.0
GIMPSCRIPT=misc/xcf-png.scm
PNGFILES=misc/icon.png

.PHONY: all install png dev clean-png clean-dev clean

all: png dev

dev:
	$(MKDIR) $(DESTDIR)/dev
	$(CP) MAKEDEV $(DESTDIR)/dev/
	./MAKEDEV $(DESTDIR)

png: $(PNGFILES)

%.png: %.xcf
	$(GIMPTOOL) --install-script $(GIMPSCRIPT)
	$(GIMP) -i -b '(xcf-png "$<" "$@")' -b '(gimp-quit 0)'

install: all

clean-png:
	$(RM) $(PNGFILES)

clean-dev:
	$(RM) $(DESTDIR)

clean: clean-dev clean-png
