Makefile
author Oleksandr Gavenko <gavenkoa@gmail.com>
Wed, 13 Jan 2010 22:29:54 +0200
changeset 14 ebe743b087ae
parent 13 9e590e7ef108
child 15 a261abd34f1b
permissions -rw-r--r--
Fix fname and dname calculation. Refactor code.

SHELL = /bin/sh

.PHONY: all
all:

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

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

ALL_DIR = all
LINUX_DIR = linux
WIN_DIR = win

ifeq 'linux' '$(host_os)'
  DIRS = all linux
endif
ifeq 'windows' '$(host_os)'
  DIRS = all
  # DIRS += win
endif

.PHONY: install
install:
	for srcdir in $(DIRS); do \
		prefix=$$PWD/$$srcdir; \
		for item in `find $$prefix -type f`; do \
			fname=$${item##*/}; \
			file=$${item#$${prefix}/}; \
			dir=$${file%$${fname}}; \
			dir=$${dir%/}; \
			echo [ -n $$dir ] '&&' mkdir -p $(HOME)/$$dir; \
			echo install -m 660 $$srcdir/$$file $(HOME)/$$dir; \
		done; \
	done

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

.PHONY: clean
clean:

.PHONY: distclean
distclean: clean