author | Oleksandr Gavenko <gavenkoa@gmail.com> |
Thu, 20 Dec 2012 23:42:25 +0200 | |
changeset 1013 | e88896e74332 |
parent 1008 | ff0b8955a3c0 |
child 1060 | 53526ea61f74 |
permissions | -rw-r--r-- |
279
fd6164dfec82
Update copyright statement and year.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
275
diff
changeset
|
1 |
# Copyright (C) 2008-2010 by Oleksandr Gavenko <gavenkoa@gmail.com> |
fd6164dfec82
Update copyright statement and year.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
275
diff
changeset
|
2 |
# |
fd6164dfec82
Update copyright statement and year.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
275
diff
changeset
|
3 |
# You can do anything with this file without any warranty. |
43
7c9cd891400b
Added makefile to install dot-emacs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
4 |
|
1002
73a5303842e3
Delete target file if command fails.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
908
diff
changeset
|
5 |
|
73a5303842e3
Delete target file if command fails.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
908
diff
changeset
|
6 |
################################################################ |
73a5303842e3
Delete target file if command fails.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
908
diff
changeset
|
7 |
# Standard Makefile settings. |
73a5303842e3
Delete target file if command fails.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
908
diff
changeset
|
8 |
|
536
14583eae4848
Added standard Makefile settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
518
diff
changeset
|
9 |
SHELL = /bin/sh |
678
203ac8ba3934
Add work-around for PATH. Under Windows find.exe going in collision with
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
581
diff
changeset
|
10 |
export PATH := /bin:/usr/bin:${PATH} |
536
14583eae4848
Added standard Makefile settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
518
diff
changeset
|
11 |
|
14583eae4848
Added standard Makefile settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
518
diff
changeset
|
12 |
# Disable built in pattern rules. |
14583eae4848
Added standard Makefile settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
518
diff
changeset
|
13 |
MAKEFLAGS += -r |
14583eae4848
Added standard Makefile settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
518
diff
changeset
|
14 |
# Disable built in variables. |
14583eae4848
Added standard Makefile settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
518
diff
changeset
|
15 |
MAKEFLAGS += -R |
14583eae4848
Added standard Makefile settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
518
diff
changeset
|
16 |
# Disable built in suffix rules. |
14583eae4848
Added standard Makefile settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
518
diff
changeset
|
17 |
.SUFFIXES: |
1002
73a5303842e3
Delete target file if command fails.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
908
diff
changeset
|
18 |
# Delete target file if command fails. |
73a5303842e3
Delete target file if command fails.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
908
diff
changeset
|
19 |
.DELETE_ON_ERROR: |
536
14583eae4848
Added standard Makefile settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
518
diff
changeset
|
20 |
# Default target. |
14583eae4848
Added standard Makefile settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
518
diff
changeset
|
21 |
.DEFAULT_GOAL = all |
14583eae4848
Added standard Makefile settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
518
diff
changeset
|
22 |
|
518
576a7e0fd9e0
Prefer native Windows Emacs, so use it if available.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
386
diff
changeset
|
23 |
################################################################ |
576a7e0fd9e0
Prefer native Windows Emacs, so use it if available.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
386
diff
changeset
|
24 |
# Helper definition. |
576a7e0fd9e0
Prefer native Windows Emacs, so use it if available.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
386
diff
changeset
|
25 |
|
576a7e0fd9e0
Prefer native Windows Emacs, so use it if available.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
386
diff
changeset
|
26 |
which = $(firstword $(foreach item,$(subst :, ,$(PATH)),$(wildcard $(item)/$1))) |
576a7e0fd9e0
Prefer native Windows Emacs, so use it if available.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
386
diff
changeset
|
27 |
|
576a7e0fd9e0
Prefer native Windows Emacs, so use it if available.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
386
diff
changeset
|
28 |
################################################################ |
576a7e0fd9e0
Prefer native Windows Emacs, so use it if available.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
386
diff
changeset
|
29 |
# Platform/environment definition. |
576a7e0fd9e0
Prefer native Windows Emacs, so use it if available.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
386
diff
changeset
|
30 |
|
43
7c9cd891400b
Added makefile to install dot-emacs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
31 |
ifeq '' '$(HOME)' |
7c9cd891400b
Added makefile to install dot-emacs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
32 |
$(error Home env var not set!) |
7c9cd891400b
Added makefile to install dot-emacs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
33 |
endif |
7c9cd891400b
Added makefile to install dot-emacs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
34 |
|
379
271ed5d61644
Special case for Windows if emacs-nox from Cygwin installed along with native Emacs.
user@localhost
parents:
318
diff
changeset
|
35 |
host_os = unix |
271ed5d61644
Special case for Windows if emacs-nox from Cygwin installed along with native Emacs.
user@localhost
parents:
318
diff
changeset
|
36 |
ifneq '' '$(COMSPEC)' |
752
079c2e27357a
Add terget to convert RST to HTML.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
750
diff
changeset
|
37 |
ifneq '' '$(WINDIR)' |
079c2e27357a
Add terget to convert RST to HTML.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
750
diff
changeset
|
38 |
# Probably under Windows. |
079c2e27357a
Add terget to convert RST to HTML.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
750
diff
changeset
|
39 |
host_os = windows |
079c2e27357a
Add terget to convert RST to HTML.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
750
diff
changeset
|
40 |
endif |
379
271ed5d61644
Special case for Windows if emacs-nox from Cygwin installed along with native Emacs.
user@localhost
parents:
318
diff
changeset
|
41 |
endif |
271ed5d61644
Special case for Windows if emacs-nox from Cygwin installed along with native Emacs.
user@localhost
parents:
318
diff
changeset
|
42 |
|
752
079c2e27357a
Add terget to convert RST to HTML.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
750
diff
changeset
|
43 |
################################################################ |
079c2e27357a
Add terget to convert RST to HTML.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
750
diff
changeset
|
44 |
# Build tool definition/switches. |
079c2e27357a
Add terget to convert RST to HTML.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
750
diff
changeset
|
45 |
|
379
271ed5d61644
Special case for Windows if emacs-nox from Cygwin installed along with native Emacs.
user@localhost
parents:
318
diff
changeset
|
46 |
EMACS = emacs |
518
576a7e0fd9e0
Prefer native Windows Emacs, so use it if available.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
386
diff
changeset
|
47 |
# I prefer native Windows Emacs, so use it if available. |
379
271ed5d61644
Special case for Windows if emacs-nox from Cygwin installed along with native Emacs.
user@localhost
parents:
318
diff
changeset
|
48 |
ifeq 'windows' '$(host_os)' |
518
576a7e0fd9e0
Prefer native Windows Emacs, so use it if available.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
386
diff
changeset
|
49 |
ifneq '' '$(call which,runemacs.exe)' |
576a7e0fd9e0
Prefer native Windows Emacs, so use it if available.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
386
diff
changeset
|
50 |
EMACS = runemacs |
576a7e0fd9e0
Prefer native Windows Emacs, so use it if available.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
386
diff
changeset
|
51 |
endif |
379
271ed5d61644
Special case for Windows if emacs-nox from Cygwin installed along with native Emacs.
user@localhost
parents:
318
diff
changeset
|
52 |
endif |
271ed5d61644
Special case for Windows if emacs-nox from Cygwin installed along with native Emacs.
user@localhost
parents:
318
diff
changeset
|
53 |
|
752
079c2e27357a
Add terget to convert RST to HTML.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
750
diff
changeset
|
54 |
RST2HTML = rst2html |
079c2e27357a
Add terget to convert RST to HTML.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
750
diff
changeset
|
55 |
ifeq '$(host_os)' 'windows' |
079c2e27357a
Add terget to convert RST to HTML.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
750
diff
changeset
|
56 |
RST2HTML = rst2html.py |
079c2e27357a
Add terget to convert RST to HTML.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
750
diff
changeset
|
57 |
endif |
079c2e27357a
Add terget to convert RST to HTML.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
750
diff
changeset
|
58 |
|
079c2e27357a
Add terget to convert RST to HTML.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
750
diff
changeset
|
59 |
################################################################ |
079c2e27357a
Add terget to convert RST to HTML.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
750
diff
changeset
|
60 |
# Proj dirs/files. |
079c2e27357a
Add terget to convert RST to HTML.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
750
diff
changeset
|
61 |
|
079c2e27357a
Add terget to convert RST to HTML.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
750
diff
changeset
|
62 |
FILES_MODE_EL := $(wildcard *-mode.el) |
079c2e27357a
Add terget to convert RST to HTML.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
750
diff
changeset
|
63 |
|
079c2e27357a
Add terget to convert RST to HTML.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
750
diff
changeset
|
64 |
RST_FILES := $(wildcard *.rst) |
079c2e27357a
Add terget to convert RST to HTML.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
750
diff
changeset
|
65 |
HTML_FILES := $(RST_FILES:.rst=.html) |
079c2e27357a
Add terget to convert RST to HTML.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
750
diff
changeset
|
66 |
|
518
576a7e0fd9e0
Prefer native Windows Emacs, so use it if available.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
386
diff
changeset
|
67 |
################################################################ |
576a7e0fd9e0
Prefer native Windows Emacs, so use it if available.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
386
diff
changeset
|
68 |
# Targets. |
576a7e0fd9e0
Prefer native Windows Emacs, so use it if available.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
386
diff
changeset
|
69 |
|
260
437507e141b4
Write .PHONY exactly before target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
165
diff
changeset
|
70 |
.PHONY: all |
43
7c9cd891400b
Added makefile to install dot-emacs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
71 |
all: install |
7c9cd891400b
Added makefile to install dot-emacs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
72 |
|
750 | 73 |
################################################################ |
74 |
# Install/uninstall targets. |
|
75 |
||
268
b2cd8fbe5ec3
Install mode file under '.emacs.d' dir.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
267
diff
changeset
|
76 |
.PHONY: install-all |
b2cd8fbe5ec3
Install mode file under '.emacs.d' dir.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
267
diff
changeset
|
77 |
install-all: install |
b2cd8fbe5ec3
Install mode file under '.emacs.d' dir.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
267
diff
changeset
|
78 |
cp .emacs-pre $(HOME)/.emacs-pre |
b2cd8fbe5ec3
Install mode file under '.emacs.d' dir.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
267
diff
changeset
|
79 |
cp .emacs-post $(HOME)/.emacs-post |
164
d7ed163b397e
Added installation of template for -pre/-post scripts.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
111
diff
changeset
|
80 |
|
268
b2cd8fbe5ec3
Install mode file under '.emacs.d' dir.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
267
diff
changeset
|
81 |
.PHONY: install |
318
6a430707c23e
Store all files in current dir for easy access to they.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
279
diff
changeset
|
82 |
install: .emacs .emacs-my .emacs-pre .emacs-post $(FILES_MODE_EL) |
111
fcea9d3b79e1
Rename -my{-pre/-post} to {-pre/-post}.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
103
diff
changeset
|
83 |
for file in .emacs-pre .emacs-post; do \ |
833 | 84 |
[ -f $(HOME)/$$file ] || cp $$file $(HOME)/$$file; \ |
93
99f967be941a
Rename files .emacs-my-custom* to .emacs-my*.
"Oleksandr Gavenko <gavenkoa@gmail.com>"
parents:
45
diff
changeset
|
85 |
done |
103
7c16c6cab2b0
By default .emacs also overwrite.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
96
diff
changeset
|
86 |
cp .emacs $(HOME)/.emacs |
93
99f967be941a
Rename files .emacs-my-custom* to .emacs-my*.
"Oleksandr Gavenko <gavenkoa@gmail.com>"
parents:
45
diff
changeset
|
87 |
cp .emacs-my $(HOME)/.emacs-my |
908 | 88 |
mkdir -p $(HOME)/.gnus/scores |
89 |
cp all.SCORE $(HOME)/.gnus/scores |
|
275
3af8c9807cbf
Added autoload generation.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
270
diff
changeset
|
90 |
rm -f -r $(HOME)/.emacs.d/my-lisp |
3af8c9807cbf
Added autoload generation.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
270
diff
changeset
|
91 |
mkdir -p $(HOME)/.emacs.d/my-lisp |
318
6a430707c23e
Store all files in current dir for easy access to they.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
279
diff
changeset
|
92 |
for file in $(FILES_MODE_EL); do \ |
275
3af8c9807cbf
Added autoload generation.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
270
diff
changeset
|
93 |
cp -f $$file $(HOME)/.emacs.d/my-lisp; \ |
164
d7ed163b397e
Added installation of template for -pre/-post scripts.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
111
diff
changeset
|
94 |
done |
1008
ff0b8955a3c0
Prevent loading site files to speed up install target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1002
diff
changeset
|
95 |
$(EMACS) -Q --batch \ |
275
3af8c9807cbf
Added autoload generation.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
270
diff
changeset
|
96 |
--eval='(let ( (generated-autoload-file "~/.emacs.d/my-lisp/autoload-my.el") ) (update-directory-autoloads "~/.emacs.d/my-lisp") )' |
700
87b7f0f427dc
Try generate by autogen after '.emacs-my' installed.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
696
diff
changeset
|
97 |
./.emacs-autogen.sh $(HOME)/.emacs-autogen |
164
d7ed163b397e
Added installation of template for -pre/-post scripts.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
111
diff
changeset
|
98 |
|
269
81c80df45b37
Udded uninstall target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
268
diff
changeset
|
99 |
.PHONY: uninstall |
81c80df45b37
Udded uninstall target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
268
diff
changeset
|
100 |
uninstall: |
832
6ee7dee9df3a
Implement 'uninstall' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
831
diff
changeset
|
101 |
rm -f $(HOME)/.emacs $(HOME)/.emacs-my $(HOME)/.emacs-autogen |
6ee7dee9df3a
Implement 'uninstall' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
831
diff
changeset
|
102 |
rm -f -r $(HOME)/.emacs.d/my-lisp |
269
81c80df45b37
Udded uninstall target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
268
diff
changeset
|
103 |
|
260
437507e141b4
Write .PHONY exactly before target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
165
diff
changeset
|
104 |
.PHONY: tar |
165
9f5dd505a4cf
Correct target name.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
164
diff
changeset
|
105 |
tar: |
85 | 106 |
tar cf dot-emacs.tar .emacs .emacs-my |
86 | 107 |
|
750 | 108 |
################################################################ |
752
079c2e27357a
Add terget to convert RST to HTML.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
750
diff
changeset
|
109 |
# Documentation targets. |
079c2e27357a
Add terget to convert RST to HTML.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
750
diff
changeset
|
110 |
|
079c2e27357a
Add terget to convert RST to HTML.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
750
diff
changeset
|
111 |
.PHONY: html |
079c2e27357a
Add terget to convert RST to HTML.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
750
diff
changeset
|
112 |
html: $(HTML_FILES) |
079c2e27357a
Add terget to convert RST to HTML.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
750
diff
changeset
|
113 |
|
079c2e27357a
Add terget to convert RST to HTML.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
750
diff
changeset
|
114 |
$(HTML_FILES): %.html: %.rst |
079c2e27357a
Add terget to convert RST to HTML.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
750
diff
changeset
|
115 |
$(RST2HTML) --stylesheet=rst.css $*.rst $@ |
079c2e27357a
Add terget to convert RST to HTML.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
750
diff
changeset
|
116 |
|
079c2e27357a
Add terget to convert RST to HTML.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
750
diff
changeset
|
117 |
################################################################ |
750 | 118 |
# Clean targets. |
119 |
||
260
437507e141b4
Write .PHONY exactly before target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
165
diff
changeset
|
120 |
.PHONY: distclean |
437507e141b4
Write .PHONY exactly before target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
165
diff
changeset
|
121 |
distclean: clean |
437507e141b4
Write .PHONY exactly before target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
165
diff
changeset
|
122 |
|
437507e141b4
Write .PHONY exactly before target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
165
diff
changeset
|
123 |
.PHONY: clean |
86 | 124 |
clean: |
752
079c2e27357a
Add terget to convert RST to HTML.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
750
diff
changeset
|
125 |
rm -f dot-emacs.tar $(HTML_FILES) |