aboutsummaryrefslogtreecommitdiffstats
path: root/emacs/Makefile
blob: 3f8425ef1e8d70399fbefdeb683e95b3b5c0e696 (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
.POSIX:

install:
	mkdir -p -- ~/.config
	if test -d ~/.emacs.d; then \
		test ! -e ~/.config/emacs && \
		mv -- ~/.emacs.d ~/.config/emacs; \
	else \
		mkdir -p -- ~/.config/emacs; \
	fi
	ln -sf -- .config/emacs ~/.emacs.d
	printf '; %s\n\n' 'This file is generated by ~/.dotfiles/emacs/Makefile' > ~/.config/emacs/init.el
	cat -- init.el >> ~/.config/emacs/init.el
	if pacman -Qq -- emacs-go-mode </dev/null >/dev/null 2>/dev/null; then\
		printf '\n' >> ~/.config/emacs/init.el && \
		cat -- init-go-mode.el >> ~/.config/emacs/init.el; \
	fi
	if pacman -Qq -- emacs-haskell-mode </dev/null >/dev/null 2>/dev/null; then\
		printf '\n' >> ~/.config/emacs/init.el && \
		cat -- init-haskell-mode.el >> ~/.config/emacs/init.el; \
	fi

uninstall:
	-unlink -- ~/.config/emacs/init.el
	-unlink -- ~/.emacs.d
	-rmdir -- ~/.config/emacs

.PHONY: install uninstall