Makefile @ 2714e5634dfd

Update
author Steve Losh <steve@stevelosh.com>
date Sat, 30 Dec 2017 17:29:01 -0500
parents 6e60d0b96c6e
children 344fc7b12455
.PHONY: clean generate serve deploy css

files := $(shell hg files)
less := $(shell ffind --literal '.less')
style := $(subst .less,.css,$(less))

photos := $(shell ffind 'static/media/images/photography/photos/.*/.*.jpg' --entire)
thumbs := $(subst photos,thumbnails,$(photos))

THUMBNAIL_CMD = convert $< -resize "200^>" -gravity center -crop 200x200+0+0 -strip $@

# Main ------------------------------------------------------------------------
public/index.html: $(files) $(style)
	hugo -t stevelosh

generate: public/index.html

clean:
	rm -rf public

serve:
	hugo server -t stevelosh -D

deploy: public/index.html
	rsync -avz ./public/ sl:/var/www/stevelosh.com

# CSS -------------------------------------------------------------------------
css: $(style)

static/media/css/%.css: static/media/css/%.less
	lessc $< > $@

# Image Gallery Hell ----------------------------------------------------------
thumbnails: $(thumbs)

static/media/images/photography/thumbnails/plants/%.jpg: static/media/images/photography/photos/plants/%.jpg
	$(THUMBNAIL_CMD)
static/media/images/photography/thumbnails/scotland/%.jpg: static/media/images/photography/photos/scotland/%.jpg
	$(THUMBNAIL_CMD)
static/media/images/photography/thumbnails/iceland/%.jpg: static/media/images/photography/photos/iceland/%.jpg
	$(THUMBNAIL_CMD)
static/media/images/photography/thumbnails/dancing/%.jpg: static/media/images/photography/photos/dancing/%.jpg
	$(THUMBNAIL_CMD)