Makefile
changeset 189 c3ec8e16a007
parent 165 9f5dd505a4cf
child 260 437507e141b4
--- a/Makefile	Sun Oct 18 11:09:44 2009 +0300
+++ b/Makefile	Sun Oct 18 11:10:35 2009 +0300
@@ -4,23 +4,47 @@
   $(error Home env var not set!)
 endif
 
-.PHONY: all install install-all
+.PHONY: all install preinstall install-all preinstall-all update-dot-emacs-pre update-dot-emacs-post tar
 
 all: install
 
-install: .emacs .emacs-my .emacs-pre .emacs-post
+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: .emacs .emacs-my .emacs-pre .emacs-post
+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
 
-dist-tar:
+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: