1
0
Fork 0
easejs/Makefile

66 lines
1.8 KiB
Makefile
Raw Normal View History

# Builds website
#
2011-12-28 19:26:48 -05:00
header := includes/header.html
footer := includes/footer.html
input_html := $(wildcard *.html)
input_images := $(wildcard images/*.png)
input_scripts := $(shell find scripts/ -name '*.js')
outdir := webroot
output_html := $(addprefix $(outdir)/, $(input_html))
output_images := $(addprefix $(outdir)/, $(input_images))
output_scripts := $(addprefix $(outdir)/, $(input_scripts))
2012-01-07 22:56:49 -05:00
.PHONY: default clean blog publish
default: $(outdir) $(output_html) $(output_images) \
$(output_scripts) $(outdir)/style.css
$(outdir):
mkdir -p $@ $@/images $@/scripts/ex
$(outdir)/style.css: style.css | $(outdir)
cp $< $@
$(outdir)/scripts/%.js: scripts/%.js | $(outdir)
cp -r $< $@
$(outdir)/images/%.png: images/%.png | $(outdir)
cp -r $< $@
$(outdir)/%.html: %.html $(header) $(footer) tools/page-parse | $(outdir)
cat $(header) \
| sed 's/\(<body\)/\1 class="$*"/' \
| cat - $< $(footer) \
| sed 's/^ \+//;s/^ *#//;' \
| tools/page-parse \
> $@
2012-01-04 23:09:00 -05:00
# requires git-weblog from mikegerwitz's git-supp package
blog:
@[ "$$( which git-weblog )" ] \
|| ( echo "Please add git-weblog to PATH" >&2 && false )
git fetch origin refs/notes/*:refs/notes/*
2012-01-04 23:09:00 -05:00
git log --log-size --format="%H%n%B" master \
| grep -A1 '^log size \([5-9][0-9]\{2,\}\|[0-9]\{4,\}\)$$' \
| grep -o '^[a-z0-9]\+$$' \
2012-05-03 22:10:58 -04:00
| xargs git weblog -Dn $$( git tag -l ) \
2012-01-04 23:09:00 -05:00
| cat $(header) - $(footer) \
| sed 's/\(<body\)/\1 class="blog"/' \
> "$(outdir)/blog.html"
# documentation, styled to match the rest of the website
webdoc:
./tools/webdoc
2012-01-07 22:56:49 -05:00
# publish webroot to remote server using rsync (do not delete files, since we
# may not have built everything)
publish: | default
2012-01-10 00:39:22 -05:00
@[ -n "$(PUBROOT)" ] || ( echo "PUBROOT not set; aborting." >&2 && false )
rsync -vr $(outdir)/./* "$(PUBROOT)"
2012-01-07 22:56:49 -05:00
clean:
${RM} -r webroot