Makefile @ 0ad7006a154b

if-let post
author Steve Losh <steve@stevelosh.com>
date Sun, 08 Jul 2018 20:11:41 +0000
parents 344fc7b12455
children 65c17aa7972b
.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)