
LIB=/usr/local/lib/picthtml/
WWALSLIB=/usr/local/wwals/lib/

#OPTS=-D
OPTS=

POSTCOMM=pictpost.php
HTMLOPTS=${OPTS}
#HTMLOPTS=${OPTS} --post ${POSTCOMM} --instructions index.php\#GPS
FIGCAPTIONOPTS=--bigfirst 
BIGDIR=big
MAINDIRS=${BIGDIR} small tiny
SUBDIRS=${MAINDIRS} RCS
HUGEDIR=huge.not
MANY=*many.jpg
SHRINKBIG=50%
SHRINKMIN=2097152
#CONVERT="magick convert"
CONVERT="convert"
SLIVERY=400
BASESLIVER=sliver
JPGSLIVER=${BASESLIVER}.jpg
SLIVER=${BIGDIR}/${JPGSLIVER}
JPGDIR=jpg
LAKELOGOS=../../../logos
LAKELOGO=lake.jpg
BLANKX=600
BLANKY=76
LAKEBLANK=lakeblank.jpg

XMAIN=600
XSMALL=300
XTINY=72

DEGREES=90

LAKEDOM=www.l-a-k-e.org
OPFDOM=OkraParadiseFarms.com
OPFSERVER=www.okraparadisefarms.com
WWALSDOM=WWALS.net
RSYNC=rsyncip
SCP=scpip
RSYNCSSH=-razve /usr/bin/ssh
RSYNCSSH=
RSYNCOPTIONS=--exclude-from ${LIB}/exclude-from.inc ${RSYNCSSH}
RSYNCDEST=`cat rsyncdest`
RSYNCSUB=`cat ../rsyncdest`
SSHPATH=`cat rsyncpath`
SSHPATHSUB=`cat ../rsyncpath`
SSHMKDIR=; sship `cat server` set echo ';' '[' -d $$p ']' '||' mkdir $$p

doscp = p=${SSHPATH}; d=${RSYNCDEST} ${SSHMKDIR}; ${SCP} ${2} $$d
doscpsub = p=${SSHPATH}/${1}; d=${RSYNCDEST}/${1}  ${SSHMKDIR}; cd ${1} && ${SCP} ${2} $$d

SFTP=sftpsend
SFTPOPTIONS=--mkdir -D

all: title list main.img small.img tiny.img rehtml index.html bigindex index.lr slides \
	list.json pictlabel jpg.list jpgdir jpg.sizes lynx

TOREHOME=for server http desc basedir http rsyncpath

rehome:
	rm -f ${TOREHOME}
	rm -f *.url
	rm -f index.inc
	rm -f index.*bloginc
	rm -f blueway

slides: slideshow.html slides.inc slides.small.inc

slideshow.html: list
	-perl ${LIB}/list2slides --html list > $@

slides.inc: list
	-perl ${LIB}/list2slides list > $@

slides.small.inc: list
	perl ${LIB}/list2slides --size small list > $@

title:
	perl ${LIB}/picttitle ${OPTS}

name:
	perl ${LIB}/picttitle ${OPTS}

addr:
	perl ${LIB}/picttitle ${OPTS}

wq.list:
	jpg2wqlist.pl *.jpg > $@
	vi $@ list

list:
	perl ${LIB}/picttitle ${OPTS}

list.label:
	labelpacket -v -D > $@ 2>$@.err

list.tbl: list
	list2cost -D --agenda `cat post.txt` list > $@ 2>$@.err

post.url: post.txt wp-convert
	f=`cat post.txt`; g=`basename $$f .txt`.url; \
	rm -f $$g; `cat wp-convert` $$f > $$g; \
	rm -f $@; echo $$g > $@; cat $@

post.post: post.txt wp-command
	`cat wp-command` `cat post.txt`

post.txt: title
	if [ ! -f $@ ]; then (makepictpost > $@) fi
	cat $@

lynx:	post.txt
	f=`cat post.txt`; g=`basename $$f .txt`.lynx; [ $$g -nt $$f ] || make $$g

%.lynx: %.txt
	lynx --force_html --dump --width 70 $< > $@
	nofootlynx $@ > $@-nofootnotes

%.txt.blurb: %.txt
	html2text -style pretty $< | sed -e '1,/BODY:/d' \
	-e '/-jsq,/,$$d' -e '/You can join this/,$$d' -e '/KEYWORDS:/,$$d' > $@
	echo "" >> $@
	cat desc >> $@
#	html2text $< | sed -e '1,/BODY:/d' -e '/You can join this/,$$d' -e '/KEYWORDS:/,$$d' /tmp/$@ > $@

%.tags: %.txt
	gettags $< > $@

%.instagram: %.txt %.txt.blurb %.tags
	head -12 $<.blurb > $@
	-grep '^https://wwals.net/?p=' $<.blurb >> $@ || echo "[Short Link]" >> $@
	echo "" >> $@
	cat $*.tags >> $@

post.http: post.txt http
	posthttp `cat post.txt` > $@

blueway: post.txt for
	post=`cat post.txt`; \
	(grep "Basin" $$post && echo Basin > $@) || \
	(grep WRWT $$post && echo WLRWT > $@) || \
	(grep WLRWT $$post && echo WLRWT > $@) || \
	(grep ARWT $$post && echo ARWT > $@) || \
	(grep SRWT $$post && echo SRWT > $@) || \
	(grep Withlacoochee $$post && echo WLRWT > $@) || \
	(grep Alapaha $$post && echo ARWT > $@) || \
	(grep Alapahoochee $$post && echo ARWT > $@) || \
	(grep Willacoochee $$post && echo ARWT > $@) || \
	(grep "Banks Lake" $$post && echo ARWT > $@) || \
	(grep "Little River" $$post && echo WLRWT > $@) || \
	(grep "Suwannee" $$post && echo SRWT > $@) || \
	(grep "Santa Fe" $$post && echo SRWT > $@) || \
	(grep "Ichetucknee" $$post && echo SRWT > $@) || \
	(grep "Okefenokee" $$post && echo SRWT > $@) || \
	(grep "Sugar Creek" $$post && echo WLRWT > $@) || \
	(grep "One Mile Branch" $$post && echo WLRWT > $@) || \
	(grep "Two Mile Branch" $$post && echo WLRWT > $@) || \
	(grep "Three Mile Branch" $$post && echo WLRWT > $@) || \
	(grep "Knights Creek" $$post && echo ARWT > $@) || \
	(grep "Mud Swamp Creek" $$post && echo ARWT > $@) || \
	(grep "Browns Canal" $$post && echo ARWT > $@) || \
	(grep "Dukes Bay Canal" $$post && echo ARWT > $@) || \
	case `cat for` in \
	${WWALSDOM}) false;; \
	*) echo > $@;; \
	esac

gps.list: list blueway
	gpstolist $< > $@ 2>gps.err

addr.inc: name addr
	perl ${LIB}/addrinc > $@

navbar.inc: title
	cp ${LIB}/$@ $@

index.lr:
	cp ${LIB}/$@ $@

${POSTCOMM}:
	cp ${LIB}/${POSTCOMM} $@

index.php: for title desc
	pictphpindex > $@.tmp
	mv $@.tmp $@

index.html: title ${POSTCOMM}
	picthtml ${HTMLOPTS} -doindexhtml > $@ 2>index.err

bigindex: big/index.html

big/index.html:
	[ -d ${BIGDIR} ] || mkdir ${BIGDIR}
	cp ${LIB}/bigindex.html $@

mov.inc: mov
	${LIB}/pictmov > $@

mov:
	mkdir $@
	-mv *.mov $@

expunge:
	[ -d bak ] || mkdir bak
	for f in title date name addr desc Makefile list RCS *.html *.inc *.lr *.bak big small tiny txt mov; \
	do (mv $$f bak/$$f) done

clean:
	rm -f index.inc

rehtml: index.inc index.bloginc

index.inc: basedir blueway index.webinc
	figcaption ${FIGCAPTIONOPTS} index.webinc > $@

index.webinc: index.pictinc
	webwh -border 0 -d /usr/local/www/ $< > $@

index.pictinc: addr.inc navbar.inc ${POSTCOMM} list.star
	-rm -f index.inc.old
	-mv -f index.inc index.inc.old
	-[ -d html.bak ] || mkdir html.bak
	-mv -f *.html html.bak
	picthtml ${HTMLOPTS} -f list >index.pictinc 2>rehtml.err

index.bloginc: http index.inc
	rebasehrefsrc `cat http` index.inc > $@
	make index.bigbloginc

index.bigbloginc: http index.inc
	rebasehrefsrc -n `cat http` index.inc > $@

html.list: list
	rm -f $@
	sed -n -e 's/\.html.*/.html/p' $< > $@

rcs.list: list
	rm -f $@
	sed -n -e 's/\.html.*/.html,v/p' $< > $@

rmhtml: html.list rcs.list
	[ -d bak ] || mkdir bak
	-mv -f `cat html.list` bak
	[ -d bak/RCS ] || mkdir bak/RCS
	-cd RCS && mv -f `cat ../rcs.list` ../bak/RCS

platrotate:
	for f in `egrep 'Plat|Future' list | sed -e 's/html.*/jpg/' `; \
	do (make IMG=$$f rotate) done

rotate:
	[ ${IMG} != "" ] || (echo "Must set make IMG=filename rotate" && exit 1)
	cd ${BIGDIR} && mogrify -rotate ${DEGREES} ${IMG}
	make `basename ${IMG} .jpg`.desize
	grep ${IMG} rot.list || echo ${IMG} >> rot.list

flip:
	[ ${IMG} != "" ] || (echo "Must set make IMG=filename rotate" && exit 1)
	cd ${BIGDIR} && mogrify -flip ${IMG}
	make `basename ${IMG} .jpg`.desize
	echo ${IMG} >> rot.list

flop:
	[ ${IMG} != "" ] || (echo "Must set make IMG=filename rotate" && exit 1)
	cd ${BIGDIR} && mogrify -flop ${IMG}
	make `basename ${IMG} .jpg`.desize
	echo ${IMG} >> rot.list

negate:
	[ ${IMG} != "" ] || (echo "Must set make IMG=filename negate" && exit 1)
	mogrify -negate ${IMG}
	- cd ${BIGDIR} && mogrify -negate ${IMG}
	cd small && mogrify -negate ${IMG}
	cd tiny && mogrify -negate ${IMG}

shrinkbig:
	for f in *.jpg; do ( make `basename $$f .jpg`.shrinkbig) done

%.shrinkbig: %.jpg
	[ -d ${HUGEDIR} ] || mkdir ${HUGEDIR}
	- set -x
	[ `stat -c %s ${BIGDIR}/$<` -gt ${SHRINKMIN} ] && \
	mv ${BIGDIR}/$< ${HUGEDIR} && ${CONVERT} -resize ${SHRINKBIG} ${HUGEDIR}/$< ${BIGDIR}/$<

%.${BASESLIVER}: %.jpg
	cd ${BIGDIR} && ${CONVERT} -crop 1x${SLIVERY}+1+0 $< ${JPGSLIVER}
	#make ${BASESLIVER}.desize

%.addsliver: %.jpg
	[ -d ${BIGDIR}/bak ] || mkdir ${BIGDIR}/bak
	cd ${BIGDIR} && mv $< bak && ${CONVERT} +append ${JPGSLIVER} bak/$< ${JPGSLIVER} $<
	make `basename $< .jpg`.desize

${JPGSLIVER}: ${SLIVER}

${SLIVER}: jpg.list
	f=`head -1 jpg.list`; make `basename $$f .jpg`.${BASESLIVER}

rotsliver: ${SLIVER} rot.list
	for f in `cat rot.list`; do (make `basename $$f .jpg`.addsliver) done

igup: up/000-igmany.jpg

up/000-igmany.jpg: igmany.jpg
	cd up && rm 000*.jpg
	cd up && ln -s ../igmany.jpg 000-igmany.jpg

fbup: up/000-fbmany.jpg

up/000-fbmany.jpg: fbmany.jpg
	cd up && rm 000*.jpg
	cd up && ln -s ../fbmany.jpg 000-fbmany.jpg

up: jpg.list
	[ -d up ] || wqup.pl

postup: postjpg.list
	[ -d up ] || wqup.pl -l $<

postjpg.list:
	f=`cat post.txt`; grep jpg $$f | sed -e 's/jpg\".*/jpg/' -e 's/.*\/pictures/../' -e 's%.*http://%/www/%' -e 's/big\///' > $@

desize:
	for f in big/*.jpg; do ( make `basename $$f .jpg`.desize ) done

%.desize: big/%.jpg
	j=`basename $@ .desize`.jpg; (cd big ; \
		convert -resize ${XMAIN} $$j ../$$j ; \
		convert -resize ${XSMALL} $$j ../small/$$j ; \
		convert -resize ${XTINY} $$j ../tiny/$$j )

main.img: list
	- cd big && pictsmall ${OPTS} -i -x ${XMAIN} ..
	echo > $@

small.img: list
	[ -d small ] || mkdir small
	-chmod a+xr small
	pictsmall ${OPTS} -i -x ${XSMALL} small
	echo > $@

tiny.img: list
	[ -d tiny ] || mkdir tiny
	-chmod a+xr tiny
	pictsmall ${OPTS} -x ${XTINY} tiny
	echo > $@

listbase: list
	rm -f $@
	grep html list | sed -e 's/\.html.*//' > $@

mvfrom: listbase
	[ ${FROM} != "" ] || (echo "Must set make FROM=previousdirectory mvfrom" && exit 1)
	for d in ${SUBDIRS}; do (\
		[ -d $$d ] || mkdir $$d; \
	) done
	for f in `cat listbase`; do (\
		mv ${FROM}/$$f.* .; \
		for d in ${SUBDIRS}; do (\
			mv ${FROM}/$$d/$$f.* $$d; \
		) done; \
	) done

cpfrom: listbase
	[ ${FROM} != "" ] || (echo "Must set make FROM=previousdirectory cpfrom" && exit 1)
	for d in ${SUBDIRS}; do (\
		[ -d $$d ] || mkdir $$d; \
	) done
	for f in `cat listbase`; do (\
		rsync ${FROM}/$$f.* .; \
		for d in ${SUBDIRS}; do (\
			rsync ${FROM}/$$d/$$f.* $$d/; \
		) done; \
	) done

deleted:
	[ -d deleted ] || mkdir deleted
	for d in ${SUBDIRS}; do (\
		e=deleted/$$d; [ -d $$e ] || mkdir $$e; \
	) done

rmnot:
	rm -f not

images: .
	rm -f $@
	-ls *.jpg *.png *.gif > $@

not: list images
	rm -f not
	for f in `cat images`; do (\
		g=`echo $$f | sed -e 's/\.[^\.]*$$//'`; \
		echo $$g; \
		grep "^$$g.html" list || echo $$g >> not; \
	) done

delnot: not deleted
	for g in `cat not`; do (\
		mv -f $$g.* deleted; \
		for d in ${SUBDIRS}; do (\
			e=deleted/$$d; [ -d $$e ] || mkdir $$e; \
			mv -f $$d/$$g.* $$e; \
		) done; \
	) done

limit2list: rmnot not delnot

delhtml: listbase
	[ -d deleted ] || mkdir deleted
	[ -d deleted/big ] || mkdir deleted/big
	[ -d deleted/RCS ] || mkdir deleted/RCS
	for f in `cat listbase`; do (\
		mv $$f.html deleted; \
		mv big/$$f.html deleted/big; \
		mv RCS/$$f.html,v deleted/RCS; \
	) done

${LAKELOGO}: ${LAKELOGOS}/${LAKELOGO}
	cp $< $@

${LAKEBLANK}:
	convert -size ${BLANKX}x${BLANKY} xc:white ${LAKEBLANK}

png2jpg:
	for d in . ${MAINDIRS}; do \
	(cd $$d && \
	[ -d png ] || mkdir png; \
	for f in *.png; do \
	(convert $$f `basename $$f .png`.jpg && mv $$f png) \
	done \
	) done

list.json: date list name addr title desc
	list2json

desc: post.url
	-[ -f desc ] || sed -n -e 's/^DESCURL: //p' `cat post.url` > $@
	cat $@

qrcode: post.txt desc
	bfn=`cat post.txt | sed -e 's/\.txt/-qrcode/'`; \
	ofn="$$bfn.png"; \
	jfn="$$bfn.jpg"; \
	hfn="$$bfn.html"; \
	qrencode -o $$ofn -s 12 `cat desc`; \
	convert $$ofn $$jfn; \
	convert -trim $$ofn `basename $$ofn .png`--trim.png; \
	convert -trim $$jfn `basename $$jfn .jpg`--trim.jpg; \
	grep $$jfn list || echo "T QR\n$$hfn\tQRCode" >> list; \
	feh $$ofn $$jfn

pictlabel: list.json
	pictlabel *.jpg
	[ -d ${JPGDIR} ] || make jpgdir
	echo > $@
#	rm -f *.id
#	rm -f */*.id

jpg.list: list
	jpg2list $< > $@

jpgdir: jpg.list
	rm -rf ${JPGDIR}
	pictjpgdir `cat jpg.list`
	echo > $@

list.star: list
	sed -n -e 's/.html.*/*/p' list > $@

jpg.order: list.star
	-(cd ${JPGDIR} && for f in `cat ../list.star`; do (ls $$f); done ) > $@

jpg.sizes: jpg.order ${JPGDIR}
	(cd ${JPGDIR} && exiftool `cat ../jpg.order` | egrep '====|File Name|Head|Image Size') | tee $@

for:
	case `/bin/pwd` in \
	*wwals*) echo ${WWALSDOM} > $@ ;; \
	*lcdp*) echo "lowndesdems.org" > $@ ;; \
	*zboa*) echo ${LAKEDOM} > $@ ;; \
	*glpc*) echo ${LAKEDOM} > $@ ;; \
	*lcc*) echo ${LAKEDOM} > $@ ;; \
	*loco*) echo ${LAKEDOM} > $@ ;; \
	*rez-*) echo ${LAKEDOM} > $@ ;; \
	*var-*) echo ${LAKEDOM} > $@ ;; \
	*magnolia.quarterman.org*) echo ${OPFDOM} > $@ ;; \
	*okraparadisefarms.com*) echo ${OPFDOM} > $@ ;; \
	*) cp /dev/null for ;; \
	esac

wp-convert: wp-command
	c=`cat wp-command`; d=`echo $$c | sed -e 's/^wp-//'`; \
	echo $${d}.pl > $@; cat $@

wp-command: for
	echo wp-lake > $@
	case `dd conv=lcase<for` in \
	*spectrabusters*) echo wp-sb > $@ ;; \
	*wwals*) echo wp-wwals > $@ ;; \
	*gretchen*) echo wp-g > $@ ;; \
	*lcdp*) echo wp-lcdp > $@ ;; \
	*lowndesdems*) echo wp-lcdp > $@ ;; \
	*okra*) echo wp-opf > $@ ;; \
	*canopy*) echo wp-opf > $@ ;; \
	*spamrankings*) echo wp-sr> $@ ;; \
	*) echo wp-lake > $@ ;; \
	esac
	cat $@

jpg.li: wp-command jpg.order ${JPGDIR}
	(cd ${JPGDIR} && `cat ../wp-command` `cat ../jpg.order`) > $@ 2>$@.err

%.wget: %.li
	sed -n -e 's/ -->//' -e 's/^<\!-- wget/wget/p' $< > $@

%.list: %.li
	echo "T MMM" > $@
	echo "many.html	Collage @ LCC `cat date`" >> $@
	echo "T Stills" >> $@
	sed -n -e 's/ -->//' -e 's/^<\!-- list //p' $< >> $@

jpg.html: jpg.li
	li2float $< > $@ 2>$@.err
	make jpglabel.html
	make jpgmixed.html
	make jpg.kml
	make jpg.need

jpg.need: jpglabel.html.err jpg.html.err
	sed -n -e 's/ for .*//' -e 's/.*Need: //p' jpglabel.html.err jpg.html.err | sort -u > $@

jpgdir.list: ${JPGDIR}
	(cd ${JPGDIR} && ls *.jpg) > $@

jpgdir.notneed: jpgdir.list
	grep -v --file=jpg.need $< > $@

jpgdir.rmnotneed: jpgdir.notneed
	(cd ${JPGDIR} && rm `cat ../$<`)

jpg.bak:
	[ -d bak ] || mkdir bak
	mv jpg.li jpg*.html bak
	rsync list bak

list.kml: list
	list2kml $< > $@ 2>list.kml.err

jpglabel.html: jpg.li
	li2float --noheader --paralabel --medium $< > $@ 2>$@.err
#	li2float --noheader --paralabel --smaller $< > $@ 2>$@.err

jpgmixed.html: jpg.li
	li2float --mixed --noheader --paralabel --medium $< > $@ 2>$@.err

jpg.kml: jpg.li
	li2float --kml $< > $@ 2>$@.err

server: for wp-command
	case `cat for` in \
	${OPFDOM}) echo ${OPFSERVER} > $@ ;; \
	*) /bin/pwd | grep "www/"; /bin/pwd | sed -e 's%.*/www/%%' -e 's%/.*%%' > $@ ;; \
	esac

basedir:	server
	echo `cat server`
	/bin/pwd | sed -e "s/^.*`cat server`//" -e 's%.*\/pictures/%/pictures/%' > $@

https: for
	case `cat for` in \
	${WWALSDOM}) echo https >$@ ;; \
	*) echo http > $@ ;; \
	esac

baseurl: https server
	echo `cat https`"://"`cat server` > $@

http:	baseurl basedir
	echo `cat baseurl``cat basedir` > $@

rsyncpath: server basedir
	echo "/www/`cat server`/`cat basedir`/" > $@

rsyncdest: server rsyncpath
	echo "`cat server`:`cat rsyncpath`/" > $@

# YouTube playlist processing

%.getplay: %.txt %.url %.playlist
	vi $*.li $<
	-vi $*.list list

%.playlist: %.txt
	make $*.html $*.json $*.li $*.img
	-make $*.wget $*.list
	-sh -x $*.wget
#	g=`basename $< .txt`; make $$g.html $$g.json $$g.li $$g.img

%.url: %.txt
	grep youtube.com $< | head -1 | sed --e 's/.*http/http/' -e 's/\".*//' > $@
# https://www.youtube.com/playlist?list=PLshUv86fYkiEWEORO4WPZmrQ_5lXMKtgq

%.html: %.url
	wget -d --no-check-certificate -O '$@' "`cat $<`"

%.json: %.html
	playlist2json.pl -D $< > $@ 2>$@.err

%.li: %.json
	json2li.pl -D $< > $@ 2>$@.err

%.img: %.li
	sed -n -e '/^http.*img/p' $< | head -1 | sed -e 's/hqdefault/mqdefault/' -e 's/?.*//' > $@

many.sh:
	pictmany list > $@
	chmod u+x $@

big/map.sh:
	makemapsh

# SFTP

sftpindex: server
	${SFTP} ${SFTPOPTIONS} index.*

sftphtml: server
	${SFTP} ${SFTPOPTIONS} *.inc *.html *.id
	${SFTP} ${SFTPOPTIONS} --subdir big *.inc *.html

sftppdf: server
	${SFTP} ${SFTPOPTIONS} *.pdf

sftpall: server
	-${SFTP} ${SFTPOPTIONS} --mkdir index.*
	make sftpmain
	make sftpsmall
	make sftptiny
	make sftppdf
	make sftpbig

sftpmain: server
	${SFTP} ${SFTPOPTIONS} *.inc *.html *.id *.jpg

sftpsmall: server
	${SFTP} ${SFTPOPTIONS} --subdir small *.jpg

sftptiny: server
	${SFTP} ${SFTPOPTIONS} --subdir tiny *.jpg

sftpbig: server
	-${SFTP} ${SFTPOPTIONS} --subdir big index.* *.inc *.html *.jpg

# RSYNC

rsyncindex: rsyncdest
	${RSYNC} ${RSYNCOPTIONS} index.* ${RSYNCDEST}

rsynchtml: rsyncdest
	${RSYNC} --exclude="*.jpg" --exclude="*.pdf" ${RSYNCOPTIONS} *.html ${RSYNCDEST}

rsyncmain: rsyncdest
	${RSYNC} ${RSYNCOPTIONS} *.inc *.html *.id *.jpg ${RSYNCDEST}

rsyncsmall: rsyncdest
	${RSYNC} ${RSYNCOPTIONS} small ${RSYNCDEST}

rsynctiny: rsyncdest
	${RSYNC} ${RSYNCOPTIONS} tiny ${RSYNCDEST}

rsyncbig: rsyncdest
	-${RSYNC} ${RSYNCOPTIONS} big ${RSYNCDEST}

rsyncpdf: rsyncdest
	-ls *.pdf && ${RSYNC} ${RSYNCOPTIONS} *.pdf ${RSYNCDEST}

rsyncxls: rsyncdest
	-ls *.xls* && ${RSYNC} ${RSYNCOPTIONS} *.xls* ${RSYNCDEST}

rsyncppt: rsyncdest
	-ls *.ppt* && ${RSYNC} ${RSYNCOPTIONS} *.ppt* ${RSYNCDEST}

rsyncdoc: rsyncdest
	-ls *.doc* && ${RSYNC} ${RSYNCOPTIONS} *.doc* ${RSYNCDEST}

rsyncmp3: rsyncdest
	-ls *.mp* && ${RSYNC} ${RSYNCOPTIONS} *.mp* ${RSYNCDEST}

rsyncall: rsyncdest rsyncindex rsynchtml rsyncmain rsyncsmall rsynctiny rsyncbig rsyncpdf rsyncxls rsyncppt rsyncdoc rsyncmp3

# SCP

scpmkdir: rsyncdest
	d=${SSHPATH} ${SSHMKDIR}

scpindex: rsyncdest index.php
	$(call doscp,.,index.*)

scphtml: rsyncdest
	-$(call doscp,.,*.html)
	-$(call doscpsub,big,*.html)
	-$(call doscpsub,mov,*.html)

scpmain: rsyncdest
	$(call doscp,.,*.inc *.html *.id *.jpg)

scpsmall: rsyncdest
	$(call doscpsub,small,*.jpg *.id)

scptiny: rsyncdest
	$(call doscpsub,tiny,*.jpg *.id)

scpbig: rsyncdest
	$(call doscpsub,big,*.jpg *.id *.inc *.html *.php small tiny)

scppdf: rsyncdest
	-ls *.pdf > /dev/null && ($(call doscp,.,*.pdf))

scpxls: rsyncdest
	-ls *.xls* > /dev/null && ($(call doscp,.,*.xls*))

scpppt: rsyncdest
	-ls *.ppt* > /dev/null && ($(call doscp,.,*.xls*))

scpdoc: rsyncdest
	-ls *.doc* > /dev/null && ($(call doscp,.,*.doc*))

scpmp3: rsyncdest
	-ls *.mp* > /dev/null && ($(call doscp,.,*.mp*))

scpmov: rsyncdest
	-scpip -r mov `cat rsyncdest`

scpall: rsyncdest
	-make scpindex
	-make scphtml
	-make scpmain
	-make scpsmall
	-make scptiny
	-make scpbig
	-make scppdf
	-make scpxls
	-make scpppt
	-make scpdoc
	-make scpmp3
	#-make scpmov

scpmany: rsyncdest
	$(call doscp,.,${MANY})
	$(call doscpsub,small,${MANY})
	$(call doscpsub,tiny,${MANY})
	$(call doscpsub,${BIGDIR},${MANY})

scprot: rot.list
	l=`cat rot.list`;\
	$(call doscp,.,$$l); \
	for dir in ${MAINDIRS}; do ($(call doscpsub,$${dir},$$l)) done
