Skip to content

Instantly share code, notes, and snippets.

@Donearm
Last active April 1, 2018 21:43
Show Gist options
  • Save Donearm/6fcfe5ea12aa1cd1cfb6 to your computer and use it in GitHub Desktop.
Save Donearm/6fcfe5ea12aa1cd1cfb6 to your computer and use it in GitHub Desktop.
Makefile for personal blog
PELICAN=pelican
PELICANOPTS=--ignore-cache
ifneq ($(wildcard /mnt/c/Projects/donearm.github.com),)
BASEDIR=/mnt/c/Projects/donearm.github.com
else
BASEDIR=/mnt/documents/c/Projects/donearm.github.com
endif
SOURCEDIR=$(BASEDIR)
CONFFILE=$(SOURCEDIR)/pelican.conf.py
DROPBOX_DIR=/mnt/d/Dropbox/Public/
TERMINALCV_DIR=/mnt/documents/c/Projects/terminalCV/
RESUME_DIR=$(SOURCEDIR)/startbootstrap-resume/
SKELETONFILE=$(SOURCEDIR)/content/skeleton.md
DEBUG ?= 0
ifeq ($(DEBUG), 1)
PELICANOPTS += -D
endif
help:
@echo 'Makefile for a pelican Web site '
@echo ' '
@echo 'Usage '
@echo ' make new TITLE= create a new post, giving title after TITLE='
@echo ' make html (re)generate the web site '
@echo ' make show (re)generate the web site and serve it at http://localhost:8001 '
@echo ' make clean remove the generated files '
@echo ' make dropbox upload the web site via Dropbox '
@echo ' make github publish site on github page '
@echo ' make terminalcv (re)generate the terminalCV page only '
@echo ' make resume (re)generate the resume only '
@echo ' make everything (re)generate terminalCV, web site and publish to Github '
@echo ' '
@echo 'Set the DEBUG variable to 1 to enable debugging, e.g. make DEBUG=1 html'
@echo ' '
new:
cd $(BASEDIR); \
cp $(SKELETONFILE) "$(BASEDIR)/content/$(TITLE).md"; \
$(EDITOR) "$(BASEDIR)/content/$(TITLE).md";
html:
cd $(SOURCEDIR); \
$(PELICAN) . -s $(CONFFILE) $(PELICANOPTS)
show:
cd $(BASEDIR); \
$(SERVESCRIPT) &
clean:
[ ! -d $$(OUTPUTDIR)/html/ ] || rm -rf $$(OUTPUTDIR)/html/
dropbox:
cp -r $(BASEDIR)/* $(DROPBOX_DIR)
github:
cd $(BASEDIR); \
git push origin master
terminalcv:
cd $(TERMINALCV_DIR); \
python render.py; \
cp -r www/* $(BASEDIR)/html/terminalcv/
resume:
rm -rf $(BASEDIR)/html/resume/ ; \
rsync -av --exclude='startbootstrap-resume/.git' --exclude='startbootstrap-resume/*.md' startbootstrap-resume $(BASEDIR)/html/ ; \
mv $(BASEDIR)/html/startbootstrap-resume $(BASEDIR)/html/resume
everything: resume terminalcv html github
.PHONY: new html show clean dropbox github terminalcv resume everything
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment