update blog
[blog.git] / Makefile
1 ## Makefile to export org in blog file to html
2
3 emacs ?= emacs
4 OUTDIR := _site
5 BLOGDIR := $(PWD)
6 UPDATE :=
7
8 # To color the code block, install htmlize package
9 INIT_PACKAGES = "(progn \
10                                 (require 'package) \
11                                 (add-to-list 'package-archives '(\"melpa\" . \"http://melpa.org/packages/\")) \
12                                 (package-initialize) \
13                                 (unless (package-installed-p 'htmlize) (package-refresh-contents) (package-install 'htmlize)))"
14
15 CSS := $(wildcard css/*.css)
16
17 .PHONY: update publish clean
18
19 publish: update temp
20         $(emacs) -Q --batch  \
21                 --eval $(INIT_PACKAGES) \
22                 --eval '(setq debug-on-error t)' \
23                 -l my-publish.el index.org \
24                 --eval '(blog-setup-project-alist "$(BLOGDIR)" "$(OUTDIR)")' \
25                 --eval '(org-publish-current-project)'
26
27 update:
28 ifeq ($(UPDATE), true)
29         git pull
30 endif
31
32 # if the source files (css) file changed, remote the org-timestamps to 
33 # re-generate all the html files
34 temp: $(CSS) my-publish.el
35         rm -rf ~/.org-timestamps
36         touch temp
37
38 clean:
39         rm -rf _site/*