# -*- Mode:Makefile; Coding:utf-8; fill-column:158 -*-
################################################################################################################################################################
##
# @file      makefile
# @author    Mitch Richling <https://www.mitchr.me>
# @brief     Apollonian Gasket Related Images. @EOL
# @std       GNUmake
# @copyright 
#  @parblock
#  Copyright (c) 2017, Mitchell Jay Richling <https://www.mitchr.me> All rights reserved.
#
#  Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
#
#  1. Redistributions of source code must retain the above copyright notice, this list of conditions, and the following disclaimer.
#
#  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions, and the following disclaimer in the documentation
#     and/or other materials provided with the distribution.
#
#  3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without
#     specific prior written permission.
#
#  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
#  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
#  FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
#  SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
#  TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#  @endparblock
################################################################################################################################################################

#---------------------------------------------------------------------------------------------------------------------------------------------------------------
WRES := 4
HRES := 2
RESM := 000

#---------------------------------------------------------------------------------------------------------------------------------------------------------------
all : www

www : apollonian_gasket_01w_1000.jpg apollonian_gasket_01w_500.jpg apollonian_gasket_01_1000.jpg  apollonian_gasket_01_250.jpg apollonian_gasket_02_1000.jpg  apollonian_gasket_02_250.jpg apollonian_gasket_2D_01_1000.jpg  apollonian_gasket_2D_01_250.jpg apollonian_gasket_2D_02_1000.jpg apollonian_gasket_2D_02_250.jpg apollonian_gasket_03_1000.jpg apollonian_gasket_03_350.jpg

clean :
	rm -f *.jpg *.png *.inc *.svg *~ *.bak

#---------------------------------------------------------------------------------------------------------------------------------------------------------------
apf1.inc : agen.rb
	time ruby agen.rb --doSVG F --doPOV T --output apf1 --r1 1.0    --r2 1.0    --r3 1.0               --crvLim 20000.0 --povClipRad 0.5 --povMinRad 0.003

apf2.inc : agen.rb
	time ruby agen.rb --doSVG F --doPOV T --output apf2 --r1 1.0    --r2 1.0    --r3 0.66666666666666  --crvLim 20000.0 --povClipRad 0.5 --povMinRad 0.003

apf3.inc : agen.rb
	time ruby agen.rb --doSVG F --doPOV T --output apf3 --r1 1.0    --r2 0.6    --r3 0.6 --crvLim 20000.0 --povClipRad 0.5 --povMinRad 0.003

apf3.png : ap3.pov apf3.inc
	povray -W$(WRES)$(RESM) -H$(HRES)$(RESM) -Q11 -P -D +A0.4 -AM2 -R5 +J3 -Oapf3.png -HIapf3.inc -Iap3.pov

apf1.png : ap.pov apf1.inc
	povray -W$(WRES)$(RESM) -H$(HRES)$(RESM) -Q11 -P -D +A0.4 -AM2 -R5 +J3 -Oapf1.png -HIapf1.inc -Iap.pov

apw1.png : apw.pov apf1.inc
	povray -W$(WRES)$(RESM) -H$(HRES)$(RESM) -Q11 -P -D +A0.4 -AM2 -R5 +J3 -Oapw1.png -HIapf1.inc -Iapw.pov

apf2.png : ap3.pov apf2.inc
	povray -W$(WRES)$(RESM) -H$(HRES)$(RESM) -Q11 -P -D +A0.4 -AM2 -R5 +J3 -Oapf2.png -HIapf2.inc -Iap.pov

apollonian_gasket_01.png : apf1.png
	convert apf1.png -pointsize 100 -draw "gravity southeast fill white text 1,150 '©2017 Mitch Richling'" -pointsize 120 -draw "gravity northwest fill white text 1,10 'Apollonian Gasket'" -quality 100 apollonian_gasket_01.png

apollonian_gasket_01w.png : apw1.png
	convert apw1.png -pointsize 50 -draw "gravity southeast fill black text 200,300 '©2017 Mitch Richling'" -quality 100 apollonian_gasket_01w.png

apollonian_gasket_01w_1000.jpg : apollonian_gasket_01w.png
	convert -resize 1000 apollonian_gasket_01w.png apollonian_gasket_01w_1000.jpg

apollonian_gasket_01w_500.jpg : apollonian_gasket_01w.png
	convert -resize 500 apollonian_gasket_01w.png apollonian_gasket_01w_500.jpg

apollonian_gasket_01_1000.jpg : apollonian_gasket_01.png
	convert -resize 1000 apollonian_gasket_01.png apollonian_gasket_01_1000.jpg

apollonian_gasket_01_250.jpg : apollonian_gasket_01.png
	convert -resize 250 apollonian_gasket_01.png apollonian_gasket_01_250.jpg

apollonian_gasket_02_1000.jpg : apollonian_gasket_02.png
	convert -resize 1000 apollonian_gasket_02.png apollonian_gasket_02_1000.jpg

apollonian_gasket_02_250.jpg : apollonian_gasket_02.png
	convert -resize 250 apollonian_gasket_02.png apollonian_gasket_02_250.jpg

apollonian_gasket_03_1000.jpg : apollonian_gasket_03.png
	convert -resize 1000 apollonian_gasket_03.png apollonian_gasket_03_1000.jpg

apollonian_gasket_03_350.jpg : apollonian_gasket_03.png
	convert -resize 250 apollonian_gasket_03.png apollonian_gasket_03_250.jpg

apollonian_gasket_03.png : apf3.png
	convert apf3.png -pointsize 100 -draw "gravity southeast fill white text 1,150 '©2017 Mitch Richling'" -pointsize 120 -draw "gravity northwest fill white text 1,10 'Apollonian Gasket'" -quality 100 apollonian_gasket_03.png


apollonian_gasket_02.png : apf2.png
	convert apf2.png -pointsize 100 -draw "gravity southeast fill white text 1,150 '©2017 Mitch Richling'" -pointsize 120 -draw "gravity northwest fill white text 1,10 'Apollonian Gasket'" -quality 100 apollonian_gasket_02.png

apf1.svg : agen.rb
	time ruby agen.rb --doSVG T --doPOV F --output apf1 --r1 1000.0    --r2 1000.0    --r3 1000.0               --crvLim 1.0

apf1sw.png : apf1.svg
	convert -background white -flatten apf1.svg apf1sw.png

apf1sb.png : apf1.svg
	convert -background black -flatten apf1.svg apf1sb.png

apollonian_gasket_2D_01_1000.jpg : apf1sb.png
	convert -resize 1000 apf1sb.png apollonian_gasket_2D_01_1000.jpg

apollonian_gasket_2D_01_250.jpg : apf1sw.png
	convert -resize 250 apf1sw.png apollonian_gasket_2D_01_250.jpg

apf2.svg : agen.rb
	time ruby agen.rb --doSVG T --doPOV F --output apf2 --r1 1000.0    --r2 1000.0    --r3 666.6666666666       --crvLim 1.0

apf2sw.png : apf2.svg
	convert -background white -flatten apf2.svg apf2sw.png

apf2sb.png : apf2.svg
	convert -background black -flatten apf2.svg apf2sb.png

apollonian_gasket_2D_02_1000.jpg : apf2sb.png
	convert -resize 1000 apf2sb.png apollonian_gasket_2D_02_1000.jpg

apollonian_gasket_2D_02_250.jpg : apf2sw.png
	convert -resize 250 apf2sw.png apollonian_gasket_2D_02_250.jpg