Makefile
author Oleksandr Gavenko <gavenkoa@gmail.com>
Wed, 09 Mar 2011 22:27:26 +0200
changeset 128 b051e1bcb85c
parent 117 02b91508db83
child 129 dbd063c9b7d0
permissions -rw-r--r--
Add gnupg config.
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
13
9e590e7ef108 Adds .PHONY exactly before corresponding target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 12
diff changeset
     3
.PHONY: all
9e590e7ef108 Adds .PHONY exactly before corresponding target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 12
diff changeset
     4
all:
9e590e7ef108 Adds .PHONY exactly before corresponding target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 12
diff changeset
     5
0
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     6
ifeq '' '$(HOME)'
12
52322e5cc6bb Proper determine Windows.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2
diff changeset
     7
  $(error HOME env var not set!)
0
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     8
endif
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     9
2
48e601bfbca6 Split files depend of OS. New install algorithm.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 0
diff changeset
    10
host_os = linux
12
52322e5cc6bb Proper determine Windows.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2
diff changeset
    11
ifneq '' '$(COMSPEC)'
2
48e601bfbca6 Split files depend of OS. New install algorithm.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 0
diff changeset
    12
  host_os = windows
48e601bfbca6 Split files depend of OS. New install algorithm.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 0
diff changeset
    13
endif
48e601bfbca6 Split files depend of OS. New install algorithm.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 0
diff changeset
    14
96
1689ded3730f Register .xserverrc for install.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 94
diff changeset
    15
OVERRIDDEN_ITEMS = \
1689ded3730f Register .xserverrc for install.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 94
diff changeset
    16
    .inputrc .minttyrc .Xdefaults .xinitrc .xserverrc \
114
2f28c595d710 Add tidy config to build.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 96
diff changeset
    17
    .bashrc .vimrc .ssh \
2f28c595d710 Add tidy config to build.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 96
diff changeset
    18
    .mailsign .tidy \
128
b051e1bcb85c Add gnupg config.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 117
diff changeset
    19
    .hgrc .hgignore .bazaar .gitconfig .gitignore \
b051e1bcb85c Add gnupg config.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 117
diff changeset
    20
	.gnupg
87
63b568f99e3c Install manually Midnight Commander ini files as for Cygwin and Debian
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 79
diff changeset
    21
MANUALINSTALL_ITEMS = .mc
117
02b91508db83 Add svn user config.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 116
diff changeset
    22
IFNONEXIST_ITEMS = .wgetrc .subversion
2
48e601bfbca6 Split files depend of OS. New install algorithm.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 0
diff changeset
    23
13
9e590e7ef108 Adds .PHONY exactly before corresponding target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 12
diff changeset
    24
.PHONY: install
0
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    25
install:
76
85dc8b07017a Allow installation of file which can be modified by user so you do not lose
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 75
diff changeset
    26
	for item in $(OVERRIDDEN_ITEMS); do \
21
a2b9b6ed57af Pattern like
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 20
diff changeset
    27
		if [ -f $$item ]; then \
a2b9b6ed57af Pattern like
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 20
diff changeset
    28
			install -m 640 $$item $(HOME)/$$item; \
a2b9b6ed57af Pattern like
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 20
diff changeset
    29
		fi; \
a2b9b6ed57af Pattern like
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 20
diff changeset
    30
		if [ -d $$item ]; then \
a2b9b6ed57af Pattern like
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 20
diff changeset
    31
			for file in `find $$item`; do \
a2b9b6ed57af Pattern like
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 20
diff changeset
    32
				if [ -d $$file ]; then \
77
46f5f10ec084 Don't check for existence of source file/dir as find return only existing ones.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 76
diff changeset
    33
					mkdir -p $(HOME)/$$file; \
46f5f10ec084 Don't check for existence of source file/dir as find return only existing ones.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 76
diff changeset
    34
					continue; \
21
a2b9b6ed57af Pattern like
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 20
diff changeset
    35
				fi; \
77
46f5f10ec084 Don't check for existence of source file/dir as find return only existing ones.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 76
diff changeset
    36
				install -m 640 $$file $(HOME)/$$file; \
21
a2b9b6ed57af Pattern like
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 20
diff changeset
    37
			done; \
a2b9b6ed57af Pattern like
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 20
diff changeset
    38
		fi; \
2
48e601bfbca6 Split files depend of OS. New install algorithm.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 0
diff changeset
    39
	done
76
85dc8b07017a Allow installation of file which can be modified by user so you do not lose
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 75
diff changeset
    40
	for item in $(IFNONEXIST_ITEMS); do \
85dc8b07017a Allow installation of file which can be modified by user so you do not lose
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 75
diff changeset
    41
		if [ -f $$item -a ! -f $(HOME)/$$item ]; then \
85dc8b07017a Allow installation of file which can be modified by user so you do not lose
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 75
diff changeset
    42
			install -m 640 $$item $(HOME)/$$item; \
85dc8b07017a Allow installation of file which can be modified by user so you do not lose
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 75
diff changeset
    43
		fi; \
85dc8b07017a Allow installation of file which can be modified by user so you do not lose
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 75
diff changeset
    44
		if [ -d $$item ]; then \
85dc8b07017a Allow installation of file which can be modified by user so you do not lose
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 75
diff changeset
    45
			for file in `find $$item`; do \
85dc8b07017a Allow installation of file which can be modified by user so you do not lose
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 75
diff changeset
    46
				if [ -d $$file ]; then \
77
46f5f10ec084 Don't check for existence of source file/dir as find return only existing ones.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 76
diff changeset
    47
					mkdir -p $(HOME)/$$file; \
46f5f10ec084 Don't check for existence of source file/dir as find return only existing ones.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 76
diff changeset
    48
					continue; \
76
85dc8b07017a Allow installation of file which can be modified by user so you do not lose
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 75
diff changeset
    49
				fi; \
77
46f5f10ec084 Don't check for existence of source file/dir as find return only existing ones.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 76
diff changeset
    50
				if [ ! -f $(HOME)/$$file ]; then \
76
85dc8b07017a Allow installation of file which can be modified by user so you do not lose
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 75
diff changeset
    51
					install -m 640 $$file $(HOME)/$$file; \
85dc8b07017a Allow installation of file which can be modified by user so you do not lose
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 75
diff changeset
    52
				fi; \
85dc8b07017a Allow installation of file which can be modified by user so you do not lose
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 75
diff changeset
    53
			done; \
85dc8b07017a Allow installation of file which can be modified by user so you do not lose
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 75
diff changeset
    54
		fi; \
85dc8b07017a Allow installation of file which can be modified by user so you do not lose
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 75
diff changeset
    55
	done
87
63b568f99e3c Install manually Midnight Commander ini files as for Cygwin and Debian
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 79
diff changeset
    56
	mkdir -p $(HOME)/.mc
63b568f99e3c Install manually Midnight Commander ini files as for Cygwin and Debian
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 79
diff changeset
    57
	install -m 640 .mc/bashrc $(HOME)/.mc
63b568f99e3c Install manually Midnight Commander ini files as for Cygwin and Debian
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 79
diff changeset
    58
ifeq '$(host_os)' 'windows'
63b568f99e3c Install manually Midnight Commander ini files as for Cygwin and Debian
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 79
diff changeset
    59
	install -m 640 .mc/bindings.cygwin $(HOME)/.mc/bindings
63b568f99e3c Install manually Midnight Commander ini files as for Cygwin and Debian
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 79
diff changeset
    60
else
63b568f99e3c Install manually Midnight Commander ini files as for Cygwin and Debian
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 79
diff changeset
    61
	install -m 640 .mc/bindings $(HOME)/.mc/bindings
63b568f99e3c Install manually Midnight Commander ini files as for Cygwin and Debian
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 79
diff changeset
    62
endif
0
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    63
13
9e590e7ef108 Adds .PHONY exactly before corresponding target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 12
diff changeset
    64
.PHONY: uninstall
0
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    65
uninstall:
78
c014474497f0 Correct uninstall target.
user@gavenko
parents: 77
diff changeset
    66
	for item in $(OVERRIDDEN_ITEMS); do \
c014474497f0 Correct uninstall target.
user@gavenko
parents: 77
diff changeset
    67
		if [ -f $$item ]; then \
c014474497f0 Correct uninstall target.
user@gavenko
parents: 77
diff changeset
    68
			[ -f $(HOME)/$$file ] && rm -f $(HOME)/$$item; \
c014474497f0 Correct uninstall target.
user@gavenko
parents: 77
diff changeset
    69
		fi; \
c014474497f0 Correct uninstall target.
user@gavenko
parents: 77
diff changeset
    70
		if [ -d $$item ]; then \
c014474497f0 Correct uninstall target.
user@gavenko
parents: 77
diff changeset
    71
			for file in `find $$item -depth`; do \
c014474497f0 Correct uninstall target.
user@gavenko
parents: 77
diff changeset
    72
				if [ -d $$file ]; then \
c014474497f0 Correct uninstall target.
user@gavenko
parents: 77
diff changeset
    73
					rmdir $(HOME)/$$file || :; \
c014474497f0 Correct uninstall target.
user@gavenko
parents: 77
diff changeset
    74
					continue; \
c014474497f0 Correct uninstall target.
user@gavenko
parents: 77
diff changeset
    75
				fi; \
c014474497f0 Correct uninstall target.
user@gavenko
parents: 77
diff changeset
    76
				[ -f $(HOME)/$$file ] && rm $(HOME)/$$file; \
c014474497f0 Correct uninstall target.
user@gavenko
parents: 77
diff changeset
    77
			done; \
c014474497f0 Correct uninstall target.
user@gavenko
parents: 77
diff changeset
    78
		fi; \
c014474497f0 Correct uninstall target.
user@gavenko
parents: 77
diff changeset
    79
	done
87
63b568f99e3c Install manually Midnight Commander ini files as for Cygwin and Debian
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 79
diff changeset
    80
	rm -f $(HOME)/.mc/bashrc $(HOME)/.mc/ini $(HOME)/.mc/bindings
63b568f99e3c Install manually Midnight Commander ini files as for Cygwin and Debian
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 79
diff changeset
    81
	rmdir $(HOME)/.mc || :
0
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    82
13
9e590e7ef108 Adds .PHONY exactly before corresponding target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 12
diff changeset
    83
.PHONY: clean
0
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    84
clean:
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    85
13
9e590e7ef108 Adds .PHONY exactly before corresponding target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 12
diff changeset
    86
.PHONY: distclean
0
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    87
distclean: clean