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

install:
	mkdir -p -- ~/.config
	if test -L ~/.emacs.d; then \
		test "$$(readlink -- ~/.emacs.d)" = .config/emacs; \
	else \
		set -e; \
		if test -d ~/.emacs.d; then \
			(test ! -e ~/.config/emacs || test -L ~/.config/emacs); \
			mv -- ~/.emacs.d ~/.config/emacs; \
		else \
			mkdir -p -- ~/.config/emacs; \
		fi; \
		ln -sf -- .config/emacs ~/.emacs.d; \
	fi
	printf '; %s\n; %s\n\n' > ~/.config/emacs/init.el \
		'This file is generated by ~/.dotfiles/emacs/Makefile' \
		'!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!'
	cat -- init.el >> ~/.config/emacs/init.el
	if ../check-installed emacs-go-mode 2>/dev/null; then \
		printf '\n' >> ~/.config/emacs/init.el && \
		cat -- init-go-mode.el >> ~/.config/emacs/init.el; \
	fi
	if ../check-installed emacs-haskell-mode; then\
		printf '\n' >> ~/.config/emacs/init.el && \
		cat -- init-haskell-mode.el >> ~/.config/emacs/init.el; \
	fi
	if ../check-installed gdb; then \
		printf '\n' >> ~/.config/emacs/init.el && \
		cat -- init-gdb.el >> ~/.config/emacs/init.el; \
	fi
	if grep Ubuntu < /etc/lsb-release >/dev/null 2>/dev/null; then \
		mkdir -p -- ~/.config/profile.d && \
		(test ! -e ~/.config/profile.d/emacs || \
			test -L ~/.config/profile.d/emacs)  && \
		ln -sf -- ~/.dotfiles/emacs/user-profile ~/.config/profile.d/emacs; \
	fi
	mkdir -p -- ~/.local/bin
	test ! -e ~/.local/bin/e || test -L ~/.local/bin/e
	ln -sf -- "$$(which emacs)" ~/.local/bin/e

uninstall:
	+! ../check-installed emacs
	+! ../check-installed emacs-gtk
	+! ../check-installed emacs-gtk2
	+! ../check-installed emacs-lucid
	+! ../check-installed emacs-nox
	-unlink -- ~/.config/profile.d/emacs
	-rmdir -- ~/.config/profile.d
	-unlink -- ~/.config/emacs/init.el
	-unlink -- ~/.emacs.d
	-rmdir -- ~/.config/emacs
	-unlink -- ~/.local/bin/e