author | Oleksandr Gavenko <gavenkoa@gmail.com> |
Mon, 02 Jan 2012 17:57:42 +0200 | |
changeset 278 | b6adff7cbcb1 |
parent 275 | 2f79af90c708 |
child 286 | 82d95a95c82c |
permissions | -rw-r--r-- |
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 | 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 |
|
249 | 13 |
################################################################ |
14 |
# Platform definition. |
|
13
9e590e7ef108
Adds .PHONY exactly before corresponding target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
12
diff
changeset
|
15 |
|
0 | 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 | 18 |
endif |
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)' |
249 | 22 |
host_os = cygwin |
23 |
endif |
|
24 |
||
25 |
################################################################ |
|
26 |
# Build tool definition/switches. |
|
27 |
||
28 |
RST2HTML = rst2html |
|
29 |
ifeq '$(host_os)' 'cygwin' |
|
30 |
RST2HTML = rst2html.py |
|
2
48e601bfbca6
Split files depend of OS. New install algorithm.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
0
diff
changeset
|
31 |
endif |
48e601bfbca6
Split files depend of OS. New install algorithm.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
0
diff
changeset
|
32 |
|
218 | 33 |
################################################################ |
34 |
# Project dirs/files. |
|
35 |
||
96
1689ded3730f
Register .xserverrc for install.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
94
diff
changeset
|
36 |
OVERRIDDEN_ITEMS = \ |
208
ba6619e43b22
Add '.dircolors' but don't enable it.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
201
diff
changeset
|
37 |
.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
|
38 |
.bashrc .bash_completion .zshrc .vimrc .ssh .pystartup \ |
234
420c06da8fd1
Fix mail signature file name.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
229
diff
changeset
|
39 |
.signature .muttrc .tidy \ |
188 | 40 |
.dictrc \ |
229
c351b7891093
Add own style for HG to print date in ISO 8601 format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
226
diff
changeset
|
41 |
.hgrc .hgignore .hgstyle .bazaar .gitconfig .gitignore .cvs \ |
129 | 42 |
.gnupg |
87
63b568f99e3c
Install manually Midnight Commander ini files as for Cygwin and Debian
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
79
diff
changeset
|
43 |
MANUALINSTALL_ITEMS = .mc |
117
02b91508db83
Add svn user config.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
116
diff
changeset
|
44 |
IFNONEXIST_ITEMS = .wgetrc .subversion |
2
48e601bfbca6
Split files depend of OS. New install algorithm.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
0
diff
changeset
|
45 |
|
249 | 46 |
RST_FILES = $(wildcard *.rst) |
47 |
HTML_FILES = $(RST_FILES:.rst=.html) |
|
48 |
||
49 |
################################################################ |
|
50 |
# Build targets. |
|
51 |
||
52 |
.PHONY: all |
|
53 |
all: |
|
54 |
||
218 | 55 |
################################################################ |
56 |
# Install/uninstall targets. |
|
57 |
||
13
9e590e7ef108
Adds .PHONY exactly before corresponding target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
12
diff
changeset
|
58 |
.PHONY: install |
0 | 59 |
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
|
60 |
for item in $(OVERRIDDEN_ITEMS); do \ |
21 | 61 |
if [ -f $$item ]; then \ |
62 |
install -m 640 $$item $(HOME)/$$item; \ |
|
63 |
fi; \ |
|
64 |
if [ -d $$item ]; then \ |
|
65 |
for file in `find $$item`; do \ |
|
66 |
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
|
67 |
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
|
68 |
continue; \ |
21 | 69 |
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
|
70 |
install -m 640 $$file $(HOME)/$$file; \ |
21 | 71 |
done; \ |
72 |
fi; \ |
|
2
48e601bfbca6
Split files depend of OS. New install algorithm.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
0
diff
changeset
|
73 |
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
|
74 |
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
|
75 |
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
|
76 |
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
|
77 |
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
|
78 |
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
|
79 |
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
|
80 |
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
|
81 |
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
|
82 |
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
|
83 |
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
|
84 |
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
|
85 |
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
|
86 |
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
|
87 |
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
|
88 |
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
|
89 |
done |
87
63b568f99e3c
Install manually Midnight Commander ini files as for Cygwin and Debian
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
79
diff
changeset
|
90 |
mkdir -p $(HOME)/.mc |
278
b6adff7cbcb1
Fix "ln: creating symbolic link `/home/user/.xsession': File exists".
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
275
diff
changeset
|
91 |
rm -f ~/.xsession |
275
2f79af90c708
ln -s ~/.xinitrc ~/.xsession
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
249
diff
changeset
|
92 |
ln -s ~/.xinitrc ~/.xsession |
87
63b568f99e3c
Install manually Midnight Commander ini files as for Cygwin and Debian
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
79
diff
changeset
|
93 |
install -m 640 .mc/bashrc $(HOME)/.mc |
249 | 94 |
ifeq '$(host_os)' 'cygwin' |
87
63b568f99e3c
Install manually Midnight Commander ini files as for Cygwin and Debian
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
79
diff
changeset
|
95 |
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
|
96 |
else |
63b568f99e3c
Install manually Midnight Commander ini files as for Cygwin and Debian
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
79
diff
changeset
|
97 |
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
|
98 |
endif |
0 | 99 |
|
13
9e590e7ef108
Adds .PHONY exactly before corresponding target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
12
diff
changeset
|
100 |
.PHONY: uninstall |
0 | 101 |
uninstall: |
78 | 102 |
for item in $(OVERRIDDEN_ITEMS); do \ |
103 |
if [ -f $$item ]; then \ |
|
104 |
[ -f $(HOME)/$$file ] && rm -f $(HOME)/$$item; \ |
|
105 |
fi; \ |
|
106 |
if [ -d $$item ]; then \ |
|
107 |
for file in `find $$item -depth`; do \ |
|
108 |
if [ -d $$file ]; then \ |
|
109 |
rmdir $(HOME)/$$file || :; \ |
|
110 |
continue; \ |
|
111 |
fi; \ |
|
112 |
[ -f $(HOME)/$$file ] && rm $(HOME)/$$file; \ |
|
113 |
done; \ |
|
114 |
fi; \ |
|
115 |
done |
|
87
63b568f99e3c
Install manually Midnight Commander ini files as for Cygwin and Debian
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
79
diff
changeset
|
116 |
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
|
117 |
rmdir $(HOME)/.mc || : |
0 | 118 |
|
218 | 119 |
################################################################ |
249 | 120 |
# Docs targets. |
121 |
||
122 |
.PHONY: html |
|
123 |
html: $(HTML_FILES) |
|
124 |
||
125 |
# --stylesheet=rst.css |
|
126 |
$(HTML_FILES): %.html: %.rst |
|
127 |
$(RST2HTML) $*.rst $@ |
|
128 |
||
129 |
################################################################ |
|
218 | 130 |
# Clean targets. |
131 |
||
13
9e590e7ef108
Adds .PHONY exactly before corresponding target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
12
diff
changeset
|
132 |
.PHONY: clean |
0 | 133 |
clean: |
249 | 134 |
rm -f $(HTML_FILES) |
0 | 135 |
|
13
9e590e7ef108
Adds .PHONY exactly before corresponding target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
12
diff
changeset
|
136 |
.PHONY: distclean |
0 | 137 |
distclean: clean |
217
fdcf941346bb
Print supported targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
216
diff
changeset
|
138 |
|
fdcf941346bb
Print supported targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
216
diff
changeset
|
139 |
################################################################ |
fdcf941346bb
Print supported targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
216
diff
changeset
|
140 |
# Helper target. |
fdcf941346bb
Print supported targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
216
diff
changeset
|
141 |
|
fdcf941346bb
Print supported targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
216
diff
changeset
|
142 |
.PHONY: help |
fdcf941346bb
Print supported targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
216
diff
changeset
|
143 |
help: |
fdcf941346bb
Print supported targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
216
diff
changeset
|
144 |
@echo |
fdcf941346bb
Print supported targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
216
diff
changeset
|
145 |
@echo Supported targets: |
fdcf941346bb
Print supported targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
216
diff
changeset
|
146 |
@sed -n -e '/^[[:alnum:]_-]*:/{s=^\(.*\):.*= \1=;p;}' $(MAKEFILE_LIST) |
fdcf941346bb
Print supported targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
216
diff
changeset
|
147 |