Makefile
author Oleksandr Gavenko <gavenkoa@gmail.com>
Fri, 14 Oct 2011 15:24:08 +0300
changeset 226 97139da73273
parent 218 92582492ecde
child 229 c351b7891093
permissions -rw-r--r--
Enable python statement readline completion and readline history for interactive Python .
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.
217
fdcf941346bb Print supported targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 216
diff changeset
    11
.DEFAULT_GOAL = help
166
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
218
92582492ecde Add heading.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 217
diff changeset
    25
################################################################
92582492ecde Add heading.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 217
diff changeset
    26
# Project dirs/files.
92582492ecde Add heading.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 217
diff changeset
    27
96
1689ded3730f Register .xserverrc for install.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 94
diff changeset
    28
OVERRIDDEN_ITEMS = \
208
ba6619e43b22 Add '.dircolors' but don't enable it.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 201
diff changeset
    29
    .inputrc .minttyrc .Xdefaults .xinitrc .xserverrc .screenrc .dircolors \
226
97139da73273 Enable python statement readline completion and readline history for interactive Python .
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 218
diff changeset
    30
    .bashrc .bash_completion .zshrc .vimrc .ssh .pystartup \
196
212adbf0e988 Add mutt settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 188
diff changeset
    31
    .mailsign .muttrc .tidy \
188
ff31eb2242c9 Add '.dictrc'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 173
diff changeset
    32
    .dictrc \
201
9042970ef6f3 Install .cvsrc
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 196
diff changeset
    33
    .hgrc .hgignore .bazaar .gitconfig .gitignore .cvs \
129
dbd063c9b7d0 TAB ==> SPACE.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 128
diff changeset
    34
    .gnupg
87
63b568f99e3c Install manually Midnight Commander ini files as for Cygwin and Debian
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 79
diff changeset
    35
MANUALINSTALL_ITEMS = .mc
117
02b91508db83 Add svn user config.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 116
diff changeset
    36
IFNONEXIST_ITEMS = .wgetrc .subversion
2
48e601bfbca6 Split files depend of OS. New install algorithm.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 0
diff changeset
    37
218
92582492ecde Add heading.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 217
diff changeset
    38
################################################################
92582492ecde Add heading.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 217
diff changeset
    39
# Install/uninstall targets.
92582492ecde Add heading.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 217
diff changeset
    40
13
9e590e7ef108 Adds .PHONY exactly before corresponding target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 12
diff changeset
    41
.PHONY: install
0
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    42
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
    43
	for item in $(OVERRIDDEN_ITEMS); do \
21
a2b9b6ed57af Pattern like
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 20
diff changeset
    44
		if [ -f $$item ]; then \
a2b9b6ed57af Pattern like
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 20
diff changeset
    45
			install -m 640 $$item $(HOME)/$$item; \
a2b9b6ed57af Pattern like
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 20
diff changeset
    46
		fi; \
a2b9b6ed57af Pattern like
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 20
diff changeset
    47
		if [ -d $$item ]; then \
a2b9b6ed57af Pattern like
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 20
diff changeset
    48
			for file in `find $$item`; do \
a2b9b6ed57af Pattern like
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 20
diff changeset
    49
				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
    50
					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
    51
					continue; \
21
a2b9b6ed57af Pattern like
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 20
diff changeset
    52
				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
    53
				install -m 640 $$file $(HOME)/$$file; \
21
a2b9b6ed57af Pattern like
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 20
diff changeset
    54
			done; \
a2b9b6ed57af Pattern like
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 20
diff changeset
    55
		fi; \
2
48e601bfbca6 Split files depend of OS. New install algorithm.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 0
diff changeset
    56
	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
    57
	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
    58
		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
    59
			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
    60
		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
    61
		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
    62
			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
    63
				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
    64
					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
    65
					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
    66
				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
    67
				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
    68
					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
    69
				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
    70
			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
    71
		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
    72
	done
87
63b568f99e3c Install manually Midnight Commander ini files as for Cygwin and Debian
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 79
diff changeset
    73
	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
    74
	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
    75
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
    76
	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
    77
else
63b568f99e3c Install manually Midnight Commander ini files as for Cygwin and Debian
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 79
diff changeset
    78
	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
    79
endif
0
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    80
13
9e590e7ef108 Adds .PHONY exactly before corresponding target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 12
diff changeset
    81
.PHONY: uninstall
0
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    82
uninstall:
78
c014474497f0 Correct uninstall target.
user@gavenko
parents: 77
diff changeset
    83
	for item in $(OVERRIDDEN_ITEMS); do \
c014474497f0 Correct uninstall target.
user@gavenko
parents: 77
diff changeset
    84
		if [ -f $$item ]; then \
c014474497f0 Correct uninstall target.
user@gavenko
parents: 77
diff changeset
    85
			[ -f $(HOME)/$$file ] && rm -f $(HOME)/$$item; \
c014474497f0 Correct uninstall target.
user@gavenko
parents: 77
diff changeset
    86
		fi; \
c014474497f0 Correct uninstall target.
user@gavenko
parents: 77
diff changeset
    87
		if [ -d $$item ]; then \
c014474497f0 Correct uninstall target.
user@gavenko
parents: 77
diff changeset
    88
			for file in `find $$item -depth`; do \
c014474497f0 Correct uninstall target.
user@gavenko
parents: 77
diff changeset
    89
				if [ -d $$file ]; then \
c014474497f0 Correct uninstall target.
user@gavenko
parents: 77
diff changeset
    90
					rmdir $(HOME)/$$file || :; \
c014474497f0 Correct uninstall target.
user@gavenko
parents: 77
diff changeset
    91
					continue; \
c014474497f0 Correct uninstall target.
user@gavenko
parents: 77
diff changeset
    92
				fi; \
c014474497f0 Correct uninstall target.
user@gavenko
parents: 77
diff changeset
    93
				[ -f $(HOME)/$$file ] && rm $(HOME)/$$file; \
c014474497f0 Correct uninstall target.
user@gavenko
parents: 77
diff changeset
    94
			done; \
c014474497f0 Correct uninstall target.
user@gavenko
parents: 77
diff changeset
    95
		fi; \
c014474497f0 Correct uninstall target.
user@gavenko
parents: 77
diff changeset
    96
	done
87
63b568f99e3c Install manually Midnight Commander ini files as for Cygwin and Debian
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 79
diff changeset
    97
	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
    98
	rmdir $(HOME)/.mc || :
0
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    99
218
92582492ecde Add heading.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 217
diff changeset
   100
################################################################
92582492ecde Add heading.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 217
diff changeset
   101
# Clean targets.
92582492ecde Add heading.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 217
diff changeset
   102
13
9e590e7ef108 Adds .PHONY exactly before corresponding target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 12
diff changeset
   103
.PHONY: clean
0
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   104
clean:
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   105
13
9e590e7ef108 Adds .PHONY exactly before corresponding target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 12
diff changeset
   106
.PHONY: distclean
0
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   107
distclean: clean
217
fdcf941346bb Print supported targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 216
diff changeset
   108
fdcf941346bb Print supported targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 216
diff changeset
   109
################################################################
fdcf941346bb Print supported targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 216
diff changeset
   110
# Helper target.
fdcf941346bb Print supported targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 216
diff changeset
   111
fdcf941346bb Print supported targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 216
diff changeset
   112
.PHONY: help
fdcf941346bb Print supported targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 216
diff changeset
   113
help:
fdcf941346bb Print supported targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 216
diff changeset
   114
	@echo
fdcf941346bb Print supported targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 216
diff changeset
   115
	@echo Supported targets:
fdcf941346bb Print supported targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 216
diff changeset
   116
	@sed -n -e '/^[[:alnum:]_-]*:/{s=^\(.*\):.*=  \1=;p;}' $(MAKEFILE_LIST)
fdcf941346bb Print supported targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 216
diff changeset
   117