Makefile
author Oleksandr Gavenko <gavenkoa@gmail.com>
Wed, 02 Sep 2009 22:18:21 +0300
changeset 2 48e601bfbca6
parent 0 2acea9e3c0ea
child 12 52322e5cc6bb
permissions -rw-r--r--
Split files depend of OS. New install algorithm.



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

host_os = linux
ifneq '' '$(WINDRIVE)'         # TODO
  host_os = windows
endif

.PHONY: all install uninstall clean distclean

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

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

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

clean:

distclean: clean