Makefile
author Oleksandr Gavenko <gavenkoa@gmail.com>
Fri, 21 Jan 2011 01:02:53 +0200
changeset 116 a8fea1f09a09
parent 114 2f28c595d710
child 117 02b91508db83
permissions -rw-r--r--
Config for git.
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 \
116
a8fea1f09a09 Config for git.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 114
diff changeset
    19
    .hgrc .hgignore .bazaar .gitconfig .gitignore
87
63b568f99e3c Install manually Midnight Commander ini files as for Cygwin and Debian
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 79
diff changeset
    20
MANUALINSTALL_ITEMS = .mc
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
    21
IFNONEXIST_ITEMS = .wgetrc
2
48e601bfbca6 Split files depend of OS. New install algorithm.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 0
diff changeset
    22
13
9e590e7ef108 Adds .PHONY exactly before corresponding target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 12
diff changeset
    23
.PHONY: install
0
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    24
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
    25
	for item in $(OVERRIDDEN_ITEMS); do \
21
a2b9b6ed57af Pattern like
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 20
diff changeset
    26
		if [ -f $$item ]; then \
a2b9b6ed57af Pattern like
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 20
diff changeset
    27
			install -m 640 $$item $(HOME)/$$item; \
a2b9b6ed57af Pattern like
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 20
diff changeset
    28
		fi; \
a2b9b6ed57af Pattern like
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 20
diff changeset
    29
		if [ -d $$item ]; then \
a2b9b6ed57af Pattern like
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 20
diff changeset
    30
			for file in `find $$item`; do \
a2b9b6ed57af Pattern like
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 20
diff changeset
    31
				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
    32
					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
    33
					continue; \
21
a2b9b6ed57af Pattern like
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 20
diff changeset
    34
				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
    35
				install -m 640 $$file $(HOME)/$$file; \
21
a2b9b6ed57af Pattern like
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 20
diff changeset
    36
			done; \
a2b9b6ed57af Pattern like
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 20
diff changeset
    37
		fi; \
2
48e601bfbca6 Split files depend of OS. New install algorithm.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 0
diff changeset
    38
	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
    39
	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
    40
		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
    41
			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
    42
		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
    43
		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
    44
			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
    45
				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
    46
					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
    47
					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
    48
				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
    49
				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
    50
					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
    51
				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
    52
			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
    53
		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
    54
	done
87
63b568f99e3c Install manually Midnight Commander ini files as for Cygwin and Debian
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 79
diff changeset
    55
	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
    56
	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
    57
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
    58
	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
    59
else
63b568f99e3c Install manually Midnight Commander ini files as for Cygwin and Debian
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 79
diff changeset
    60
	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
    61
endif
0
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    62
13
9e590e7ef108 Adds .PHONY exactly before corresponding target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 12
diff changeset
    63
.PHONY: uninstall
0
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    64
uninstall:
78
c014474497f0 Correct uninstall target.
user@gavenko
parents: 77
diff changeset
    65
	for item in $(OVERRIDDEN_ITEMS); do \
c014474497f0 Correct uninstall target.
user@gavenko
parents: 77
diff changeset
    66
		if [ -f $$item ]; then \
c014474497f0 Correct uninstall target.
user@gavenko
parents: 77
diff changeset
    67
			[ -f $(HOME)/$$file ] && rm -f $(HOME)/$$item; \
c014474497f0 Correct uninstall target.
user@gavenko
parents: 77
diff changeset
    68
		fi; \
c014474497f0 Correct uninstall target.
user@gavenko
parents: 77
diff changeset
    69
		if [ -d $$item ]; then \
c014474497f0 Correct uninstall target.
user@gavenko
parents: 77
diff changeset
    70
			for file in `find $$item -depth`; do \
c014474497f0 Correct uninstall target.
user@gavenko
parents: 77
diff changeset
    71
				if [ -d $$file ]; then \
c014474497f0 Correct uninstall target.
user@gavenko
parents: 77
diff changeset
    72
					rmdir $(HOME)/$$file || :; \
c014474497f0 Correct uninstall target.
user@gavenko
parents: 77
diff changeset
    73
					continue; \
c014474497f0 Correct uninstall target.
user@gavenko
parents: 77
diff changeset
    74
				fi; \
c014474497f0 Correct uninstall target.
user@gavenko
parents: 77
diff changeset
    75
				[ -f $(HOME)/$$file ] && rm $(HOME)/$$file; \
c014474497f0 Correct uninstall target.
user@gavenko
parents: 77
diff changeset
    76
			done; \
c014474497f0 Correct uninstall target.
user@gavenko
parents: 77
diff changeset
    77
		fi; \
c014474497f0 Correct uninstall target.
user@gavenko
parents: 77
diff changeset
    78
	done
87
63b568f99e3c Install manually Midnight Commander ini files as for Cygwin and Debian
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 79
diff changeset
    79
	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
    80
	rmdir $(HOME)/.mc || :
0
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    81
13
9e590e7ef108 Adds .PHONY exactly before corresponding target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 12
diff changeset
    82
.PHONY: clean
0
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    83
clean:
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    84
13
9e590e7ef108 Adds .PHONY exactly before corresponding target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 12
diff changeset
    85
.PHONY: distclean
0
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    86
distclean: clean