Makefile
author Oleksandr Gavenko <gavenkoa@gmail.com>
Sat, 13 Mar 2010 16:07:06 +0200
changeset 21 a2b9b6ed57af
parent 20 9cf206648ce7
child 22 887d49d11bfa
permissions -rw-r--r--
Pattern like [ -d $$file ] && [ -d $(HOME)/$$file ] || mkdir -p $(HOME)/$$file; as if $$file is regular file mkdir will executed. Fix all them.

SHELL = /bin/sh

.PHONY: all
all:

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

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

ITEMS = .Xdefaults .bashrc .mailsign .xinitrc .mc

.PHONY: install
install:
	for item in $(ITEMS); do \
		if [ -f $$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 ]; then \
					install -m 640 $$file $(HOME)/$$file; \
				fi; \
			done; \
		fi; \
	done

.PHONY: uninstall
uninstall:
	rm -f $(HOME)/.mailsign

.PHONY: clean
clean:

.PHONY: distclean
distclean: clean