Makefile
author Oleksandr Gavenko <gavenkoa@gmail.com>
Thu, 28 Jan 2010 19:51:11 +0200
changeset 261 16b1f9a3ee99
parent 260 437507e141b4
child 267 55541cafde9d
permissions -rw-r--r--
Install pre/post config into auto files.

# Copyright (C) 2008 by Oleksandr Gavenko <gavenkoa@gmail.com>

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

.PHONY: all
all: install

.PHONY: install
install: preinstall update-dot-emacs-pre update-dot-emacs-post

.PHONY: preinstall
preinstall: .emacs .emacs-my .emacs-pre .emacs-post
	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-my $(HOME)/.emacs-my

.PHONY: install-all
install-all: preinstall-all update-dot-emacs-pre update-dot-emacs-post

.PHONY: preinstall-all
preinstall-all: .emacs .emacs-my .emacs-pre .emacs-post
	for file in $^; do \
		cp $$file $(HOME)/$$file; \
	done

.PHONY: update-dot-emacs-pre
update-dot-emacs-pre:
	printf ";; DO NOT EDIT! This file automatically generated.\n\n" >$(HOME)/.emacs-pre-auto
	for file in `cd template-pre; ls *.el`; do \
		cat template-pre/$$file >>$(HOME)/.emacs-pre-auto; \
	done

.PHONY: update-dot-emacs-post
update-dot-emacs-post:
	printf ";; DO NOT EDIT! This file automatically generated.\n\n" >$(HOME)/.emacs-post-auto
	for file in `cd template-post; ls *.el`; do \
		cat template-post/$$file >>$(HOME)/.emacs-post-auto; \
	done

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

.PHONY: distclean
distclean: clean

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