-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
96 lines (82 loc) · 2.19 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
## Configuration
DOMAIN ?= emacsmirror.net
PUBLIC ?= https://$(DOMAIN)
CFRONT_DIST ?= E1IXJGPIOM4EUW
PUBLISH_BUCKET ?= s3://$(DOMAIN)
S3_ZONE ?= s3-website.eu-central-1
PUBLISH_S3_URL ?= http://$(DOMAIN).$(S3_ZONE).amazonaws.com
EMACS ?= emacs
SITE_LISP ?= ~/.config/emacs/lib/
EPKG_REPOSITORY ?= ~/src/emacs/epkgs/
SRC = .
DST = /stats
SYNC = --exclude "*"
SYNC += --include "*.html"
SYNC += --exclude "index.html"
SYNC += --exclude "borg/*"
SYNC += --exclude "epkg/*"
BABEL = $(filter-out config.org misc.org, $(wildcard *.org))
HTML = $(BABEL:.org=.html)
DEPS = borg
DEPS += closql
DEPS += compat
DEPS += dash
DEPS += elx
DEPS += emir
DEPS += epkg/lisp
DEPS += emacsql
DEPS += f
DEPS += ghub/lisp
DEPS += graphql
DEPS += llama
DEPS += magit/lisp
DEPS += org/lisp
DEPS += package-build
DEPS += packed
DEPS += s
DEPS += transient/lisp
DEPS += treepy
DEPS += with-editor/lisp
LOAD_PATH = $(addprefix -L $(SITE_LISP),$(DEPS))
BATCH = $(EMACS) -Q --batch $(LOAD_PATH)
## Usage
help:
$(info )
$(info make babel - evaluate code-blocks)
$(info make html - generate html)
$(info make publish - publish html)
$(info make clean - remove html)
$(info )
$(info Public: $(PUBLIC))
$(info Publish: $(PUBLISH_S3_URL))
@echo
## Targets
babel: $(BABEL)
html: $(HTML)
force:
%.org: force
@echo "Updating $@..."
@$(BATCH) $@ --eval "(progn\
(require 'org)\
(setq epkg-repository \"$(EPKG_REPOSITORY)\")\
(setq org-confirm-babel-evaluate nil)\
(org-fold-show-all)\
(org-babel-execute-buffer)\
(save-buffer))" 2>&1 | (grep -v -e "((" || true)
%.html: %.org
@echo "Generating $@..."
@$(BATCH) $(subst html,org,$@) --eval "(progn\
(require 'org)\
(setq org-babel-confirm-evaluate-answer-no 'noeval)\
(org-html-export-to-html))" 2>&1 |\
grep -v "Evaluation of this emacs-lisp code block" | true
@rm -f $@~
publish:
@echo "Uploading to $(PUBLISH_BUCKET)..."
@aws s3 sync $(SRC) $(PUBLISH_BUCKET)$(DST) --delete $(SYNC)
@echo "Performing CDN invalidation"
@aws cloudfront create-invalidation \
--distribution-id $(CFRONT_DIST) --paths "/stats/*" > /dev/null
clean:
@echo "Cleaning..."
@rm -rf $(HTML) $(addsuffix ~,$(HTML))