summaryrefslogtreecommitdiffstatshomepage
path: root/Makefile
blob: 13310e94a040965fc898ea1b369503997844ed0c (plain) (blame)
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
EMACS_BIN = emacs
EMACS_QUIET = $(EMACS_BIN) -Q -nw --batch --eval "(setq inhibit-message t)"
EMACS = $(EMACS_QUIET) -l install_packages.el \
			--eval "(ed/load-or-install-packages)" \
			--eval "(add-to-list 'load-path \"modes/org-mode/lisp\")"

# Init should be last
ELS=beauty.el org.el utils.el various-comp-lang.el
ELCS=$(ELS:.el=.elc) early-init.elc init.elc

.PHONY: build cleanall others submodules

all: build mu4e.elc mu4e-autoload.elc others
	$(info Do not forget to install complementary packages:)
	$(info xorg-fonts-100dpi w3m)

build: submodules install_packages.el $(ELCS)

submodules:
	git submodule init
	git submodule update
	./modes/check_git_status.sh modes/flycheck-grammalecte
	./modes/check_git_status.sh modes/ox-gmi.el 434c89c8939996d664b8136e023630b34bee0dd7
	./modes/check_git_status.sh modes/org-mode

cleanall:
	rm -f $(ELCS) install_packages.el
	rm -f mu4e.elc mu4e-autoload.elc

# Specific operation for specific files
init.el: init.org
	$(info Extracting $(PWD)/$<...)
	@$(EMACS_QUIET) --eval "(package-initialize)" \
		--eval "(add-to-list 'load-path \"modes/org-mode/lisp\")" \
		--eval "(setq org-confirm-babel-evaluate nil)" \
		--eval "(find-file \"$<\")" -f org-babel-tangle &> /dev/null

install_packages.el: init.el
	$(info Installing required emacs packages)
	@$(EMACS_QUIET) -l install_packages.el --eval "(ed/load-or-install-packages t)"

mu4e.el: mu4e.org
	@test -d /usr/share/emacs/site-lisp/mu4e || \
		(echo "You must install the mu package for your distribution" && \
			false)
	$(info Extracting $(PWD)/$<...)
	@$(EMACS) --eval "(add-to-list 'load-path \"/usr/share/emacs/site-lisp/mu4e\")" \
		--eval "(find-file \"$<\")" -f org-babel-tangle &> /dev/null

mu4e.elc: mu4e.el
	$(info Compiling $(PWD)/$<...)
	@$(EMACS) --eval "(add-to-list 'load-path \"/usr/share/emacs/site-lisp/mu4e\")" \
		-f batch-byte-compile $< &> /dev/null
	@rm mu4e.el

# Side effects
early-init.el: init.el

mu4e-autoload.el: mu4e.el

# Generic extraction operations
%.el: %.org
	$(info Extracting $(PWD)/$<...)
	@$(EMACS) --eval "(find-file \"$<\")" -f org-babel-tangle &> /dev/null

%.elc: %.el
	$(info Compiling $(PWD)/$<...)
	@$(EMACS) -f batch-byte-compile $< &> /dev/null
	@rm $<