Makefile
changeset 76 85dc8b07017a
parent 75 956a463b63e3
child 77 46f5f10ec084
--- a/Makefile	Sat May 08 13:05:00 2010 +0300
+++ b/Makefile	Wed May 12 14:19:12 2010 +0300
@@ -12,11 +12,12 @@
   host_os = windows
 endif
 
-ITEMS = .Xdefaults .bashrc .mailsign .xinitrc .mc .vimrc .inputrc .ssh .hgrc .hgignore .bazaar .wgetrc
+OVERRIDDEN_ITEMS = .Xdefaults .bashrc .mailsign .xinitrc .mc .vimrc .inputrc .ssh .hgrc .hgignore .bazaar
+IFNONEXIST_ITEMS = .wgetrc
 
 .PHONY: install
 install:
-	for item in $(ITEMS); do \
+	for item in $(OVERRIDDEN_ITEMS); do \
 		if [ -f $$item ]; then \
 			install -m 640 $$item $(HOME)/$$item; \
 		fi; \
@@ -31,6 +32,21 @@
 			done; \
 		fi; \
 	done
+	for item in $(IFNONEXIST_ITEMS); do \
+		if [ -f $$item -a ! -f $(HOME)/$$item ]; then \
+			install -m 640 $$item $(HOME)/$$item; \
+		fi; \
+		if [ -d $$item ]; then \
+			for file in `find $$item`; do \
+				if [ -d $$file ]; then \
+					[ -d $(HOME)/$$file ] || mkdir -p $(HOME)/$$file; \
+				fi; \
+				if [ -f $$file -a ! -f $(HOME)/$$file ]; then \
+					install -m 640 $$file $(HOME)/$$file; \
+				fi; \
+			done; \
+		fi; \
+	done
 
 .PHONY: uninstall
 uninstall: