# script to build Parabola Art Collections.
# Copyright (C) 2015  Márcio Alexandre Silva Delgado <coadde@parabola.nu>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero 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 Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

PREFIX = /usr
SHAREDIR = $(PREFIX)/share
DESTDIR = $(SHAREDIR)/wallpapers

16_09_res = 00160x00090 \
            00256x00144 \
            00320x00180 \
            00480x00270 \
            00512x00288 \
            00640x00360 \
            00800x00450 \
            00960x00540 \
            01024x00576 \
            01280x00720 \
            01600x00900 \
            01920x01080 \
            02048x01152 \
            02560x01440 \
            03200x01800 \
            03840x02160 # \
           # 04096x02304 \
           # 05120x02880 \
           # 06400x03600 \
           # 07680x04320 \
           # 08192x04608 \
           # 10240x05760 \
           # 12800x07200 \
           # 15360x08640 # \

16_10_res = 00160x00100 \
            00256x00160 \
            00320x00200 \
            00480x00300 \
            00512x00320 \
            00640x00400 \
            00800x00500 \
            00960x00600 \
            01024x00640 \
            01280x00800 \
            01600x01000 \
            01920x01200 \
            02048x01280 \
            02560x01600 \
            03200x02000 \
            03840x02400 \
           # 04096x02560 \
           # 05120x03200 \
           # 06400x04000 \
           # 07680x04800 \
           # 08192x05120 \
           # 10240x06400 \
           # 12800x08000 \
           # 15360x09600 # \

16_12_res = 00160x00120 \
            00256x00192 \
            00320x00240 \
            00480x00360 \
            00512x00384 \
            00640x00480 \
            00800x00600 \
            00960x00720 \
            01024x00768 \
            01280x00960 \
            01600x01200 \
            01920x01440 \
            02048x01536 \
            02560x01920 \
            03200x02400 \
            03840x02880 # \
           # 04096x03072 \
           # 05120x03840 \
           # 06400x04800 \
           # 07680x05760 \
           # 08192x06144 \
           # 10240x07680 \
           # 12800x09600 \
           # 15360x11520 # \

all: clean mkimgdir $(16_09_res) $(16_10_res) $(16_12_res)

$(16_09_res):
	convert src/img/scn-prbprbprw000001-gnu_wallpaper_01_ld_generic-r04427x02490px-c_rgb08-noa000r00h00m00s000f_nos_xcf02d08_m0001d8g-atf_lcf_nof.png \
		-resize $@^ -gravity center -extent $@ pkg/img/gnu_wallpaper_01_generic-r$@px.png
	convert src/img/scn-prbprbprw000001-gnu_wallpaper_01_ld_parabola-r04427x02490px-c_rgb08-noa000r00h00m00s000f_nos_xcf02d08_m0001d8g-atf_lcf_nof.png \
		-resize $@^ -gravity center -extent $@ pkg/img/gnu_wallpaper_01_parabola-r$@px.png
	convert src/img/scn-prbprbprw000001-gnu_wallpaper_02-r17280x09720px-c_rgb08-noa000r00h00m00s000f_nos_xcf02d08_m0004d0g-atf_lcf_nof.png \
		-resize $@^ -gravity center -extent $@ pkg/img/gnu_wallpaper_02-r$@px.png
	convert src/img/scn-prbprbprw000001-gnu_wallpaper_03-r15360x8640px-c_rgb08-noa000r00h00m00s000f_nos_xcf02d08_m0002d3g-atf_lcf_nof.png \
		-resize $@^ -gravity center -extent $@ pkg/img/gnu_wallpaper_03-r$@px.png

$(16_10_res):
	convert src/img/scn-prbprbprw000001-gnu_wallpaper_01_ld_generic-r04427x02490px-c_rgb08-noa000r00h00m00s000f_nos_xcf02d08_m0001d8g-atf_lcf_nof.png \
		-resize $@^ -gravity center -extent $@ pkg/img/gnu_wallpaper_01_generic-r$@px.png
	convert src/img/scn-prbprbprw000001-gnu_wallpaper_01_ld_parabola-r04427x02490px-c_rgb08-noa000r00h00m00s000f_nos_xcf02d08_m0001d8g-atf_lcf_nof.png \
		-resize $@^ -gravity center -extent $@ pkg/img/gnu_wallpaper_01_parabola-r$@px.png
	convert src/img/scn-prbprbprw000001-gnu_wallpaper_02-r17280x09720px-c_rgb08-noa000r00h00m00s000f_nos_xcf02d08_m0004d0g-atf_lcf_nof.png \
		-resize $@^ -gravity center -extent $@ pkg/img/gnu_wallpaper_02-r$@px.png

$(16_12_res):
	convert src/img/scn-prbprbprw000001-gnu_wallpaper_01_ld_generic-r04427x02490px-c_rgb08-noa000r00h00m00s000f_nos_xcf02d08_m0001d8g-atf_lcf_nof.png \
		-resize $@^ -gravity center -extent $@ pkg/img/gnu_wallpaper_01_generic-r$@px.png
	convert src/img/scn-prbprbprw000001-gnu_wallpaper_01_ld_parabola-r04427x02490px-c_rgb08-noa000r00h00m00s000f_nos_xcf02d08_m0001d8g-atf_lcf_nof.png \
		-resize $@^ -gravity center -extent $@ pkg/img/gnu_wallpaper_01_parabola-r$@px.png
	convert src/img/scn-prbprbprw000001-gnu_wallpaper_02-r17280x09720px-c_rgb08-noa000r00h00m00s000f_nos_xcf02d08_m0004d0g-atf_lcf_nof.png \
		-resize $@^ -gravity center -extent $@ pkg/img/gnu_wallpaper_02-r$@px.png

clean:
	rm -rf img

mkimgdir:
	install -d pkg/img

install:
	install -dm755 $(DESTDIR)
	install -Dm644 pkg/img/* $(DESTDIR)