Skip to content

Commit a57d5fe

Browse files
authored
Merge pull request #29 from commonlispbr/docker-makefile
[Makefile] Run emacs through docker image ryukinix/lerax
2 parents ed6356b + 9d3b881 commit a57d5fe

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

Makefile

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,28 @@
1-
EMACS_INIT := ~/.emacs.d/init.el
1+
EMACS_INIT := /root/.emacs.d/init.el
22
EMACS_LOAD := -l $(EMACS_INIT)
33
EMACS_FLAGS := --batch --kill $(EMACS_LOAD)
44
ORG_FILES := $(wildcard *.org)
55
HTML_FILES := $(patsubst %.org, %.html, $(ORG_FILES))
6+
DOCKER_IMG := ryukinix/lerax
7+
USER := $(shell id -u):$(shell id -g)
8+
DOCKER_RUN := docker run -w /tmp \
9+
-v $(shell pwd):/tmp \
10+
--rm \
11+
-t
12+
STATUS_PREFIX := "\033[1;32m[+]\033[0m "
13+
ATTENTION_PREFIX := "\033[1;36m[!]\033[0m "
614

7-
.PHONY: clean
15+
.PHONY: clean shell
816

917
all: $(HTML_FILES)
1018

19+
shell:
20+
$(DOCKER_RUN) -i --entrypoint=/bin/zsh $(DOCKER_IMG)
21+
1122
%.html: %.org
12-
emacs $< $(EMACS_FLAGS) -f org-html-export-to-html
23+
@printf $(STATUS_PREFIX); echo "COMPILING: $< -> $*.html"
24+
@$(DOCKER_RUN) $(DOCKER_IMG) $< $(EMACS_FLAGS) -f org-html-export-to-html
25+
@$(DOCKER_RUN) --entrypoint=/bin/chown $(DOCKER_IMG) $(USER) "$*.org"
1326

1427
clean:
1528
rm -rf *.html

0 commit comments

Comments
 (0)