aboutsummaryrefslogblamecommitdiffstats
path: root/emacs/Makefile
blob: 23f2aa3117308ad01b6e3c94a137c15322e40443 (plain) (tree)
1
2
3
4
5
6
7
8
       
                    


                             

                                                                    
              







                                                           
          

                                                                                                          
                                                              


                                                                    
                                                                   









                                                                         
.POSIX:
include ../common.mk

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; \
			mv -- ~/.emacs.d ~/.config/emacs; \
		else \
			mkdir -p -- ~/.config/emacs; \
		fi; \
		ln -sf -- .config/emacs ~/.emacs.d; \
	fi
	printf '; %s\n\n' 'This file is generated by ~/.dotfiles/emacs/Makefile' > ~/.config/emacs/init.el
	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 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