Makefile
author Oleksandr Gavenko <gavenkoa@gmail.com>
Wed, 13 Jan 2010 22:06:21 +0200
changeset 12 52322e5cc6bb
parent 2 48e601bfbca6
child 13 9e590e7ef108
permissions -rw-r--r--
Proper determine Windows.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
12
52322e5cc6bb Proper determine Windows.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2
diff changeset
     1
SHELL = /bin/sh
0
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     2
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     3
ifeq '' '$(HOME)'
12
52322e5cc6bb Proper determine Windows.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2
diff changeset
     4
  $(error HOME env var not set!)
0
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     5
endif
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     6
2
48e601bfbca6 Split files depend of OS. New install algorithm.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 0
diff changeset
     7
host_os = linux
12
52322e5cc6bb Proper determine Windows.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2
diff changeset
     8
ifneq '' '$(COMSPEC)'
2
48e601bfbca6 Split files depend of OS. New install algorithm.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 0
diff changeset
     9
  host_os = windows
48e601bfbca6 Split files depend of OS. New install algorithm.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 0
diff changeset
    10
endif
48e601bfbca6 Split files depend of OS. New install algorithm.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 0
diff changeset
    11
0
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    12
.PHONY: all install uninstall clean distclean
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    13
2
48e601bfbca6 Split files depend of OS. New install algorithm.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 0
diff changeset
    14
ALL_DIR = all
48e601bfbca6 Split files depend of OS. New install algorithm.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 0
diff changeset
    15
LINUX_DIR = linux
48e601bfbca6 Split files depend of OS. New install algorithm.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 0
diff changeset
    16
WIN_DIR = win
48e601bfbca6 Split files depend of OS. New install algorithm.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 0
diff changeset
    17
48e601bfbca6 Split files depend of OS. New install algorithm.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 0
diff changeset
    18
ifeq 'linux' '$(host_os)'
48e601bfbca6 Split files depend of OS. New install algorithm.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 0
diff changeset
    19
  DIRS = all linux
48e601bfbca6 Split files depend of OS. New install algorithm.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 0
diff changeset
    20
endif
48e601bfbca6 Split files depend of OS. New install algorithm.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 0
diff changeset
    21
ifeq 'windows' '$(host_os)'
48e601bfbca6 Split files depend of OS. New install algorithm.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 0
diff changeset
    22
  DIRS = all win
48e601bfbca6 Split files depend of OS. New install algorithm.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 0
diff changeset
    23
endif
48e601bfbca6 Split files depend of OS. New install algorithm.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 0
diff changeset
    24
0
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    25
install:
2
48e601bfbca6 Split files depend of OS. New install algorithm.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 0
diff changeset
    26
	for srcdir in $(DIRS); do \
48e601bfbca6 Split files depend of OS. New install algorithm.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 0
diff changeset
    27
		for item in `cd  $$srcdir; find $$PWD -type f`; do \
48e601bfbca6 Split files depend of OS. New install algorithm.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 0
diff changeset
    28
			file=$${item#$${PWD}/$${srcdir}/}; \
48e601bfbca6 Split files depend of OS. New install algorithm.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 0
diff changeset
    29
			fname=$${item##*/}; \
48e601bfbca6 Split files depend of OS. New install algorithm.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 0
diff changeset
    30
			dir=$${item#$${PWD}/$${srcdir}}; \
48e601bfbca6 Split files depend of OS. New install algorithm.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 0
diff changeset
    31
			dir=$${dir%/$${fname}}; \
48e601bfbca6 Split files depend of OS. New install algorithm.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 0
diff changeset
    32
			dir=$${dir#/}; \
48e601bfbca6 Split files depend of OS. New install algorithm.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 0
diff changeset
    33
			echo mkdir -p $(HOME)/$$dir; \
48e601bfbca6 Split files depend of OS. New install algorithm.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 0
diff changeset
    34
			echo install -m 660 $$srcdir/$$file $(HOME)/$$dir; \
48e601bfbca6 Split files depend of OS. New install algorithm.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 0
diff changeset
    35
		done; \
48e601bfbca6 Split files depend of OS. New install algorithm.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 0
diff changeset
    36
	done
0
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    37
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    38
uninstall:
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    39
	rm -f $(HOME)/.mailsign
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    40
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    41
clean:
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    42
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    43
distclean: clean
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    44