Makefile
author Oleksandr Gavenko <gavenkoa@gmail.com>
Fri, 14 Jan 2011 12:25:45 +0200
changeset 527 3996f4df0915
parent 518 576a7e0fd9e0
child 536 14583eae4848
permissions -rw-r--r--
Added exclude pattern to 'grep-find-ignored-files'.

# Copyright (C) 2008-2010 by Oleksandr Gavenko <gavenkoa@gmail.com>
#
# You can do anything with this file without any warranty.

################################################################
# Helper definition.

which = $(firstword $(foreach item,$(subst :, ,$(PATH)),$(wildcard $(item)/$1)))

################################################################
# Platform/environment definition.

ifeq '' '$(HOME)'
  $(error Home env var not set!)
endif

host_os = unix
ifneq '' '$(COMSPEC)'
  host_os = windows
endif

EMACS = emacs
# I prefer native Windows Emacs, so use it if available.
ifeq 'windows' '$(host_os)'
  ifneq '' '$(call which,runemacs.exe)'
    EMACS = runemacs
  endif
endif

################################################################
# Targets.

FILES_MODE_EL := $(wildcard *-mode.el)

.PHONY: all
all: install

.PHONY: install-all
install-all: install
	cp .emacs-pre $(HOME)/.emacs-pre
	cp .emacs-post $(HOME)/.emacs-post

.PHONY: install
install: .emacs .emacs-my .emacs-pre .emacs-post $(FILES_MODE_EL)
	for file in .emacs-pre .emacs-post; do \
		if [ ! -f $(HOME)/$$file ]; then cp $$file $(HOME)/$$file; fi; \
	done
	cp .emacs $(HOME)/.emacs
	cp .emacs-autogen $(HOME)/.emacs-autogen
	sh .emacs-autogen.sh $(HOME)/.emacs-autogen
	cp .emacs-my $(HOME)/.emacs-my
	rm -f -r $(HOME)/.emacs.d/my-lisp
	mkdir -p $(HOME)/.emacs.d/my-lisp
	for file in $(FILES_MODE_EL); do \
		cp -f $$file $(HOME)/.emacs.d/my-lisp; \
	done
	$(EMACS) --batch \
		--eval='(let ( (generated-autoload-file "~/.emacs.d/my-lisp/autoload-my.el") ) (update-directory-autoloads "~/.emacs.d/my-lisp") )'

.PHONY: uninstall
uninstall:
	@echo !!! Nothing done !!!

.PHONY: tar
tar:
	tar cf dot-emacs.tar .emacs .emacs-my

.PHONY: distclean
distclean: clean

.PHONY: clean
clean:
	rm -f dot-emacs.tar