76e1b33362ec7190931f2ad69f60a60b962dc43f
[blog.git] / Makefile
1 ## Makefile to export org in blog file to html
2
3 emacs ?= emacs
4 OUTDIR := _site
5 FORCE := "no"
6 BLOGDIR := $(PWD)
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 # used for automation on server
16 CSS := $(wildcard css/*.css)
17 OBJS := $(addprefix $(OUTDIR)/,$(CSS))
18
19 #$(OUTDIR)/css/%.css:css/%.css
20 #       echo "***** css changed remove timestamps *****\n"
21 #       rm -rf ~/.org-timestamps
22 #$(OBJS): $(CSS) my-publish.el
23 $(OBJS): _site/css/%.css:css/%.css
24         rm -rf ~/.org-timestamps
25
26 .PHONY: update publish test clean
27
28 update:
29         git pull
30
31 publish: update $(OBJS)
32         $(emacs) -Q --batch  \
33                 --eval $(INIT_PACKAGES) \
34                 --eval '(setq debug-on-error t)' \
35                 -l my-publish.el index.org \
36                 --eval '(blog-setup-project-alist "$(BLOGDIR)" "$(OUTDIR)")' \
37                 --eval '(org-publish-current-project)'
38
39 # test will force publishing all files in the porject 
40 test:
41         $(emacs) -Q --batch \
42                 --eval $(INIT_PACKAGES) \
43                 --eval '(setq debug-on-error t)' \
44                 -l my-publish.el index.org \
45                 --eval '(blog-setup-project-alist "$(BLOGDIR)")' \
46                 --eval '(org-publish-current-project t)'
47
48 clean:
49         rm -rf _site/*