author | Oleksandr Gavenko <gavenkoa@gmail.com> |
Tue, 24 Apr 2012 13:30:21 +0300 | |
changeset 432 | dc9bb516bde7 |
parent 427 | 59627b533219 |
child 433 | 93d05f55825a |
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 |
||
427
59627b533219
Merge ".fvwm" project into "skel" project.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
329
diff
changeset
|
36 |
OVERRIDDEN_ITEMS := \ |
432
dc9bb516bde7
Add '.xxkbrc' to install target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
427
diff
changeset
|
37 |
.fvwm .xxkbrc \ |
208
ba6619e43b22
Add '.dircolors' but don't enable it.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
201
diff
changeset
|
38 |
.inputrc .minttyrc .Xdefaults .xinitrc .xserverrc .screenrc .dircolors \ |
286
82d95a95c82c
Add .bash_path to install. Fix string order.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
278
diff
changeset
|
39 |
.bashrc .bash_path .bash_completion .zshrc .vimrc .ssh .pystartup \ |
312
fc29a6c443ba
http://stackoverflow.com/questions/35470/are-there-any-static-analysis-tools-for-python
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
295
diff
changeset
|
40 |
.pylintrc \ |
234
420c06da8fd1
Fix mail signature file name.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
229
diff
changeset
|
41 |
.signature .muttrc .tidy \ |
188 | 42 |
.dictrc \ |
292
b19f6e8f2450
Fix '.cvsrc' file name.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
287
diff
changeset
|
43 |
.hgrc .hgignore .hgstyle .bazaar .gitconfig .gitignore .cvsrc \ |
293 | 44 |
.gnupg \ |
45 |
.glhackrc |
|
87
63b568f99e3c
Install manually Midnight Commander ini files as for Cygwin and Debian
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
79
diff
changeset
|
46 |
MANUALINSTALL_ITEMS = .mc |
117
02b91508db83
Add svn user config.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
116
diff
changeset
|
47 |
IFNONEXIST_ITEMS = .wgetrc .subversion |
2
48e601bfbca6
Split files depend of OS. New install algorithm.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
0
diff
changeset
|
48 |
|
249 | 49 |
RST_FILES = $(wildcard *.rst) |
50 |
HTML_FILES = $(RST_FILES:.rst=.html) |
|
51 |
||
52 |
################################################################ |
|
53 |
# Build targets. |
|
54 |
||
55 |
.PHONY: all |
|
56 |
all: |
|
57 |
||
218 | 58 |
################################################################ |
59 |
# Install/uninstall targets. |
|
60 |
||
13
9e590e7ef108
Adds .PHONY exactly before corresponding target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
12
diff
changeset
|
61 |
.PHONY: install |
0 | 62 |
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
|
63 |
for item in $(OVERRIDDEN_ITEMS); do \ |
21 | 64 |
if [ -f $$item ]; then \ |
65 |
install -m 640 $$item $(HOME)/$$item; \ |
|
66 |
fi; \ |
|
67 |
if [ -d $$item ]; then \ |
|
68 |
for file in `find $$item`; do \ |
|
69 |
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
|
70 |
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
|
71 |
continue; \ |
21 | 72 |
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
|
73 |
install -m 640 $$file $(HOME)/$$file; \ |
21 | 74 |
done; \ |
75 |
fi; \ |
|
2
48e601bfbca6
Split files depend of OS. New install algorithm.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
0
diff
changeset
|
76 |
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
|
77 |
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
|
78 |
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
|
79 |
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
|
80 |
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
|
81 |
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
|
82 |
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
|
83 |
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
|
84 |
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
|
85 |
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
|
86 |
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
|
87 |
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
|
88 |
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
|
89 |
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
|
90 |
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
|
91 |
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
|
92 |
done |
287
fa17ae49bfff
Add execute permission to '.xinitrc' to use Bash script language instead of
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
286
diff
changeset
|
93 |
chmod a+x ~/.xinitrc ~/.xserverrc |
278
b6adff7cbcb1
Fix "ln: creating symbolic link `/home/user/.xsession': File exists".
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
275
diff
changeset
|
94 |
rm -f ~/.xsession |
275
2f79af90c708
ln -s ~/.xinitrc ~/.xsession
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
249
diff
changeset
|
95 |
ln -s ~/.xinitrc ~/.xsession |
324
e30f2ac488aa
Port MC config to 4.8.x version.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
312
diff
changeset
|
96 |
v=`mc --version | sed 's|.*\([0-9]\+\.[0-9]\+\.[0-9]\+\)$$|\1|;q'`; \ |
e30f2ac488aa
Port MC config to 4.8.x version.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
312
diff
changeset
|
97 |
vmajor=$${v%%.*}; \ |
e30f2ac488aa
Port MC config to 4.8.x version.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
312
diff
changeset
|
98 |
vminor=$${v#*.}; \ |
e30f2ac488aa
Port MC config to 4.8.x version.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
312
diff
changeset
|
99 |
vminor=$${vminor%.*}; \ |
328
3e80c4af5ab6
Merge my config for mc.ext with system wide as only ~/.config/mc/mc.ext
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
324
diff
changeset
|
100 |
umask 0117; \ |
324
e30f2ac488aa
Port MC config to 4.8.x version.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
312
diff
changeset
|
101 |
if [ $$vmajor -gt 4 -o '(' $$vmajor -eq 4 -a $$vminor -ge 8 ')' ]; then \ |
e30f2ac488aa
Port MC config to 4.8.x version.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
312
diff
changeset
|
102 |
mkdir -p $(HOME)/.config/mc $(HOME)/.local/share/mc/; \ |
e30f2ac488aa
Port MC config to 4.8.x version.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
312
diff
changeset
|
103 |
install -m 640 .local/share/mc/bashrc $(HOME)/.local/share/mc/; \ |
329
5c0a22da5ef3
Remove Cygwin version of mc.ext as they is exactly same.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
328
diff
changeset
|
104 |
cat .config/mc/mc.ext /etc/mc/mc.ext > $(HOME)/.local/share/mc/mc.ext; \ |
324
e30f2ac488aa
Port MC config to 4.8.x version.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
312
diff
changeset
|
105 |
else \ |
e30f2ac488aa
Port MC config to 4.8.x version.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
312
diff
changeset
|
106 |
mkdir -p $(HOME)/.mc; \ |
e30f2ac488aa
Port MC config to 4.8.x version.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
312
diff
changeset
|
107 |
install -m 640 .local/share/mc/bashrc $(HOME)/.mc; \ |
329
5c0a22da5ef3
Remove Cygwin version of mc.ext as they is exactly same.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
328
diff
changeset
|
108 |
install -m 640 .config/mc/mc.ext $(HOME)/.mc/bindings; \ |
324
e30f2ac488aa
Port MC config to 4.8.x version.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
312
diff
changeset
|
109 |
fi |
295 | 110 |
if command -v file 1>/dev/null; then \ |
111 |
install -m 640 .magic $(HOME); \ |
|
112 |
cd $(HOME); \ |
|
113 |
file --compile -m .magic; \ |
|
114 |
fi |
|
0 | 115 |
|
13
9e590e7ef108
Adds .PHONY exactly before corresponding target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
12
diff
changeset
|
116 |
.PHONY: uninstall |
0 | 117 |
uninstall: |
78 | 118 |
for item in $(OVERRIDDEN_ITEMS); do \ |
119 |
if [ -f $$item ]; then \ |
|
120 |
[ -f $(HOME)/$$file ] && rm -f $(HOME)/$$item; \ |
|
121 |
fi; \ |
|
122 |
if [ -d $$item ]; then \ |
|
123 |
for file in `find $$item -depth`; do \ |
|
124 |
if [ -d $$file ]; then \ |
|
125 |
rmdir $(HOME)/$$file || :; \ |
|
126 |
continue; \ |
|
127 |
fi; \ |
|
128 |
[ -f $(HOME)/$$file ] && rm $(HOME)/$$file; \ |
|
129 |
done; \ |
|
130 |
fi; \ |
|
131 |
done |
|
87
63b568f99e3c
Install manually Midnight Commander ini files as for Cygwin and Debian
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
79
diff
changeset
|
132 |
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
|
133 |
rmdir $(HOME)/.mc || : |
0 | 134 |
|
218 | 135 |
################################################################ |
249 | 136 |
# Docs targets. |
137 |
||
138 |
.PHONY: html |
|
139 |
html: $(HTML_FILES) |
|
140 |
||
141 |
# --stylesheet=rst.css |
|
142 |
$(HTML_FILES): %.html: %.rst |
|
143 |
$(RST2HTML) $*.rst $@ |
|
144 |
||
145 |
################################################################ |
|
218 | 146 |
# Clean targets. |
147 |
||
13
9e590e7ef108
Adds .PHONY exactly before corresponding target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
12
diff
changeset
|
148 |
.PHONY: clean |
0 | 149 |
clean: |
249 | 150 |
rm -f $(HTML_FILES) |
0 | 151 |
|
13
9e590e7ef108
Adds .PHONY exactly before corresponding target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
12
diff
changeset
|
152 |
.PHONY: distclean |
0 | 153 |
distclean: clean |
217
fdcf941346bb
Print supported targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
216
diff
changeset
|
154 |
|
fdcf941346bb
Print supported targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
216
diff
changeset
|
155 |
################################################################ |
fdcf941346bb
Print supported targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
216
diff
changeset
|
156 |
# Helper target. |
fdcf941346bb
Print supported targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
216
diff
changeset
|
157 |
|
fdcf941346bb
Print supported targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
216
diff
changeset
|
158 |
.PHONY: help |
fdcf941346bb
Print supported targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
216
diff
changeset
|
159 |
help: |
fdcf941346bb
Print supported targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
216
diff
changeset
|
160 |
@echo |
fdcf941346bb
Print supported targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
216
diff
changeset
|
161 |
@echo Supported targets: |
fdcf941346bb
Print supported targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
216
diff
changeset
|
162 |
@sed -n -e '/^[[:alnum:]_-]*:/{s=^\(.*\):.*= \1=;p;}' $(MAKEFILE_LIST) |
fdcf941346bb
Print supported targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
216
diff
changeset
|
163 |