Makefile
author Oleksandr Gavenko <gavenkoa@gmail.com>
Wed, 13 Jan 2010 22:09:26 +0200
changeset 13 9e590e7ef108
parent 12 52322e5cc6bb
child 14 ebe743b087ae
permissions -rw-r--r--
Adds .PHONY exactly before corresponding target.

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 win
endif

.PHONY: install
install:
	for srcdir in $(DIRS); do \
		for item in `cd  $$srcdir; find $$PWD -type f`; do \
			file=$${item#$${PWD}/$${srcdir}/}; \
			fname=$${item##*/}; \
			dir=$${item#$${PWD}/$${srcdir}}; \
			dir=$${dir%/$${fname}}; \
			dir=$${dir#/}; \
			echo 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