Makefile
author Oleksandr Gavenko <gavenkoa@gmail.com>
Sun, 15 Nov 2009 21:42:40 +0200
changeset 196 154d8ebf534b
parent 165 9f5dd505a4cf
child 260 437507e141b4
permissions -rw-r--r--
Added matches for makefile-gmake-mode.

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

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

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

all: install

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

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

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

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

update-dot-emacs-pre:
	for file in `cd template-pre; ls *.el`; do \
		tag=$${file%.el}; \
		if grep "DO NOT EDIT COMMENT! TAG: $$tag" $(HOME)/.emacs-pre; then \
			:; \
		else \
			cat template-pre/$$file >>$(HOME)/.emacs-pre; \
		fi; \
	done

update-dot-emacs-post:
	for file in `cd template-post; ls *.el`; do \
		tag=$${file%.el}; \
		if grep "DO NOT EDIT COMMENT! TAG: $$tag" $(HOME)/.emacs-post; then \
			:; \
		else \
			cat template-post/$$file >>$(HOME)/.emacs-post; \
		fi; \
	done

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

clean:
	rm -f dot-emacs.tar