Makefile
author Oleksandr Gavenko <gavenkoa@gmail.com>
Sat, 24 Sep 2011 14:54:54 +0300
changeset 201 9042970ef6f3
parent 196 212adbf0e988
child 208 ba6619e43b22
permissions -rw-r--r--
Install .cvsrc
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
165
517623c39dac Add work-around for PATH. Under Windows find.exe going in collision with
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 147
diff changeset
     2
export PATH := /bin:/usr/bin:${PATH}
0
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     3
166
27fc63b27dad Add default Makefile settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 165
diff changeset
     4
# Disable built in pattern rules.
27fc63b27dad Add default Makefile settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 165
diff changeset
     5
MAKEFLAGS += -r
27fc63b27dad Add default Makefile settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 165
diff changeset
     6
# Disable built in variables.
27fc63b27dad Add default Makefile settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 165
diff changeset
     7
MAKEFLAGS += -R
27fc63b27dad Add default Makefile settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 165
diff changeset
     8
# Disable built in suffix rules.
27fc63b27dad Add default Makefile settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 165
diff changeset
     9
.SUFFIXES:
27fc63b27dad Add default Makefile settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 165
diff changeset
    10
# Default target.
27fc63b27dad Add default Makefile settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 165
diff changeset
    11
.DEFAULT_GOAL = all
27fc63b27dad Add default Makefile settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 165
diff changeset
    12
13
9e590e7ef108 Adds .PHONY exactly before corresponding target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 12
diff changeset
    13
.PHONY: all
9e590e7ef108 Adds .PHONY exactly before corresponding target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 12
diff changeset
    14
all:
9e590e7ef108 Adds .PHONY exactly before corresponding target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 12
diff changeset
    15
0
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    16
ifeq '' '$(HOME)'
12
52322e5cc6bb Proper determine Windows.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2
diff changeset
    17
  $(error HOME env var not set!)
0
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    18
endif
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    19
2
48e601bfbca6 Split files depend of OS. New install algorithm.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 0
diff changeset
    20
host_os = linux
12
52322e5cc6bb Proper determine Windows.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2
diff changeset
    21
ifneq '' '$(COMSPEC)'
2
48e601bfbca6 Split files depend of OS. New install algorithm.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 0
diff changeset
    22
  host_os = windows
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
96
1689ded3730f Register .xserverrc for install.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 94
diff changeset
    25
OVERRIDDEN_ITEMS = \
147
cdbf0ba89562 Install .screenrc
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 129
diff changeset
    26
    .inputrc .minttyrc .Xdefaults .xinitrc .xserverrc .screenrc \
173
e0e31102eee5 install .zshrc.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 166
diff changeset
    27
    .bashrc .zshrc .vimrc .ssh \
196
212adbf0e988 Add mutt settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 188
diff changeset
    28
    .mailsign .muttrc .tidy \
188
ff31eb2242c9 Add '.dictrc'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 173
diff changeset
    29
    .dictrc \
201
9042970ef6f3 Install .cvsrc
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 196
diff changeset
    30
    .hgrc .hgignore .bazaar .gitconfig .gitignore .cvs \
129
dbd063c9b7d0 TAB ==> SPACE.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 128
diff changeset
    31
    .gnupg
87
63b568f99e3c Install manually Midnight Commander ini files as for Cygwin and Debian
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 79
diff changeset
    32
MANUALINSTALL_ITEMS = .mc
117
02b91508db83 Add svn user config.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 116
diff changeset
    33
IFNONEXIST_ITEMS = .wgetrc .subversion
2
48e601bfbca6 Split files depend of OS. New install algorithm.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 0
diff changeset
    34
13
9e590e7ef108 Adds .PHONY exactly before corresponding target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 12
diff changeset
    35
.PHONY: install
0
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    36
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
    37
	for item in $(OVERRIDDEN_ITEMS); do \
21
a2b9b6ed57af Pattern like
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 20
diff changeset
    38
		if [ -f $$item ]; then \
a2b9b6ed57af Pattern like
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 20
diff changeset
    39
			install -m 640 $$item $(HOME)/$$item; \
a2b9b6ed57af Pattern like
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 20
diff changeset
    40
		fi; \
a2b9b6ed57af Pattern like
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 20
diff changeset
    41
		if [ -d $$item ]; then \
a2b9b6ed57af Pattern like
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 20
diff changeset
    42
			for file in `find $$item`; do \
a2b9b6ed57af Pattern like
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 20
diff changeset
    43
				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
    44
					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
    45
					continue; \
21
a2b9b6ed57af Pattern like
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 20
diff changeset
    46
				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
    47
				install -m 640 $$file $(HOME)/$$file; \
21
a2b9b6ed57af Pattern like
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 20
diff changeset
    48
			done; \
a2b9b6ed57af Pattern like
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 20
diff changeset
    49
		fi; \
2
48e601bfbca6 Split files depend of OS. New install algorithm.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 0
diff changeset
    50
	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
    51
	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
    52
		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
    53
			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
    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
		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
    56
			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
    57
				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
    58
					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
    59
					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
    60
				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
    61
				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
    62
					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
    63
				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
    64
			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
    65
		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
    66
	done
87
63b568f99e3c Install manually Midnight Commander ini files as for Cygwin and Debian
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 79
diff changeset
    67
	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
    68
	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
    69
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
    70
	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
    71
else
63b568f99e3c Install manually Midnight Commander ini files as for Cygwin and Debian
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 79
diff changeset
    72
	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
    73
endif
0
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    74
13
9e590e7ef108 Adds .PHONY exactly before corresponding target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 12
diff changeset
    75
.PHONY: uninstall
0
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    76
uninstall:
78
c014474497f0 Correct uninstall target.
user@gavenko
parents: 77
diff changeset
    77
	for item in $(OVERRIDDEN_ITEMS); do \
c014474497f0 Correct uninstall target.
user@gavenko
parents: 77
diff changeset
    78
		if [ -f $$item ]; then \
c014474497f0 Correct uninstall target.
user@gavenko
parents: 77
diff changeset
    79
			[ -f $(HOME)/$$file ] && rm -f $(HOME)/$$item; \
c014474497f0 Correct uninstall target.
user@gavenko
parents: 77
diff changeset
    80
		fi; \
c014474497f0 Correct uninstall target.
user@gavenko
parents: 77
diff changeset
    81
		if [ -d $$item ]; then \
c014474497f0 Correct uninstall target.
user@gavenko
parents: 77
diff changeset
    82
			for file in `find $$item -depth`; do \
c014474497f0 Correct uninstall target.
user@gavenko
parents: 77
diff changeset
    83
				if [ -d $$file ]; then \
c014474497f0 Correct uninstall target.
user@gavenko
parents: 77
diff changeset
    84
					rmdir $(HOME)/$$file || :; \
c014474497f0 Correct uninstall target.
user@gavenko
parents: 77
diff changeset
    85
					continue; \
c014474497f0 Correct uninstall target.
user@gavenko
parents: 77
diff changeset
    86
				fi; \
c014474497f0 Correct uninstall target.
user@gavenko
parents: 77
diff changeset
    87
				[ -f $(HOME)/$$file ] && rm $(HOME)/$$file; \
c014474497f0 Correct uninstall target.
user@gavenko
parents: 77
diff changeset
    88
			done; \
c014474497f0 Correct uninstall target.
user@gavenko
parents: 77
diff changeset
    89
		fi; \
c014474497f0 Correct uninstall target.
user@gavenko
parents: 77
diff changeset
    90
	done
87
63b568f99e3c Install manually Midnight Commander ini files as for Cygwin and Debian
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 79
diff changeset
    91
	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
    92
	rmdir $(HOME)/.mc || :
0
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    93
13
9e590e7ef108 Adds .PHONY exactly before corresponding target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 12
diff changeset
    94
.PHONY: clean
0
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    95
clean:
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    96
13
9e590e7ef108 Adds .PHONY exactly before corresponding target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 12
diff changeset
    97
.PHONY: distclean
0
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    98
distclean: clean