author | Oleksandr Gavenko <gavenkoa@gmail.com> |
Tue, 10 Jul 2012 18:34:22 +0300 | |
changeset 893 | 0e1febcbddb6 |
parent 833 | 023190b14d77 |
child 908 | e3b3e9f4d759 |
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 |
|
536
14583eae4848
Added standard Makefile settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
518
diff
changeset
|
5 |
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
|
6 |
export PATH := /bin:/usr/bin:${PATH} |
536
14583eae4848
Added standard Makefile settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
518
diff
changeset
|
7 |
|
14583eae4848
Added standard Makefile settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
518
diff
changeset
|
8 |
# Disable built in pattern rules. |
14583eae4848
Added standard Makefile settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
518
diff
changeset
|
9 |
MAKEFLAGS += -r |
14583eae4848
Added standard Makefile settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
518
diff
changeset
|
10 |
# Disable built in variables. |
14583eae4848
Added standard Makefile settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
518
diff
changeset
|
11 |
MAKEFLAGS += -R |
14583eae4848
Added standard Makefile settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
518
diff
changeset
|
12 |
# Disable built in suffix rules. |
14583eae4848
Added standard Makefile settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
518
diff
changeset
|
13 |
.SUFFIXES: |
14583eae4848
Added standard Makefile settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
518
diff
changeset
|
14 |
# Default target. |
14583eae4848
Added standard Makefile settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
518
diff
changeset
|
15 |
.DEFAULT_GOAL = all |
14583eae4848
Added standard Makefile settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
518
diff
changeset
|
16 |
|
518
576a7e0fd9e0
Prefer native Windows Emacs, so use it if available.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
386
diff
changeset
|
17 |
################################################################ |
576a7e0fd9e0
Prefer native Windows Emacs, so use it if available.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
386
diff
changeset
|
18 |
# Helper definition. |
576a7e0fd9e0
Prefer native Windows Emacs, so use it if available.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
386
diff
changeset
|
19 |
|
576a7e0fd9e0
Prefer native Windows Emacs, so use it if available.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
386
diff
changeset
|
20 |
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
|
21 |
|
576a7e0fd9e0
Prefer native Windows Emacs, so use it if available.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
386
diff
changeset
|
22 |
################################################################ |
576a7e0fd9e0
Prefer native Windows Emacs, so use it if available.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
386
diff
changeset
|
23 |
# Platform/environment definition. |
576a7e0fd9e0
Prefer native Windows Emacs, so use it if available.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
386
diff
changeset
|
24 |
|
43
7c9cd891400b
Added makefile to install dot-emacs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
25 |
ifeq '' '$(HOME)' |
7c9cd891400b
Added makefile to install dot-emacs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
26 |
$(error Home env var not set!) |
7c9cd891400b
Added makefile to install dot-emacs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
27 |
endif |
7c9cd891400b
Added makefile to install dot-emacs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
28 |
|
379
271ed5d61644
Special case for Windows if emacs-nox from Cygwin installed along with native Emacs.
user@localhost
parents:
318
diff
changeset
|
29 |
host_os = unix |
271ed5d61644
Special case for Windows if emacs-nox from Cygwin installed along with native Emacs.
user@localhost
parents:
318
diff
changeset
|
30 |
ifneq '' '$(COMSPEC)' |
752
079c2e27357a
Add terget to convert RST to HTML.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
750
diff
changeset
|
31 |
ifneq '' '$(WINDIR)' |
079c2e27357a
Add terget to convert RST to HTML.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
750
diff
changeset
|
32 |
# Probably under Windows. |
079c2e27357a
Add terget to convert RST to HTML.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
750
diff
changeset
|
33 |
host_os = windows |
079c2e27357a
Add terget to convert RST to HTML.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
750
diff
changeset
|
34 |
endif |
379
271ed5d61644
Special case for Windows if emacs-nox from Cygwin installed along with native Emacs.
user@localhost
parents:
318
diff
changeset
|
35 |
endif |
271ed5d61644
Special case for Windows if emacs-nox from Cygwin installed along with native Emacs.
user@localhost
parents:
318
diff
changeset
|
36 |
|
752
079c2e27357a
Add terget to convert RST to HTML.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
750
diff
changeset
|
37 |
################################################################ |
079c2e27357a
Add terget to convert RST to HTML.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
750
diff
changeset
|
38 |
# Build tool definition/switches. |
079c2e27357a
Add terget to convert RST to HTML.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
750
diff
changeset
|
39 |
|
379
271ed5d61644
Special case for Windows if emacs-nox from Cygwin installed along with native Emacs.
user@localhost
parents:
318
diff
changeset
|
40 |
EMACS = emacs |
518
576a7e0fd9e0
Prefer native Windows Emacs, so use it if available.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
386
diff
changeset
|
41 |
# 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
|
42 |
ifeq 'windows' '$(host_os)' |
518
576a7e0fd9e0
Prefer native Windows Emacs, so use it if available.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
386
diff
changeset
|
43 |
ifneq '' '$(call which,runemacs.exe)' |
576a7e0fd9e0
Prefer native Windows Emacs, so use it if available.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
386
diff
changeset
|
44 |
EMACS = runemacs |
576a7e0fd9e0
Prefer native Windows Emacs, so use it if available.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
386
diff
changeset
|
45 |
endif |
379
271ed5d61644
Special case for Windows if emacs-nox from Cygwin installed along with native Emacs.
user@localhost
parents:
318
diff
changeset
|
46 |
endif |
271ed5d61644
Special case for Windows if emacs-nox from Cygwin installed along with native Emacs.
user@localhost
parents:
318
diff
changeset
|
47 |
|
752
079c2e27357a
Add terget to convert RST to HTML.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
750
diff
changeset
|
48 |
RST2HTML = rst2html |
079c2e27357a
Add terget to convert RST to HTML.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
750
diff
changeset
|
49 |
ifeq '$(host_os)' 'windows' |
079c2e27357a
Add terget to convert RST to HTML.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
750
diff
changeset
|
50 |
RST2HTML = rst2html.py |
079c2e27357a
Add terget to convert RST to HTML.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
750
diff
changeset
|
51 |
endif |
079c2e27357a
Add terget to convert RST to HTML.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
750
diff
changeset
|
52 |
|
079c2e27357a
Add terget to convert RST to HTML.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
750
diff
changeset
|
53 |
################################################################ |
079c2e27357a
Add terget to convert RST to HTML.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
750
diff
changeset
|
54 |
# Proj dirs/files. |
079c2e27357a
Add terget to convert RST to HTML.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
750
diff
changeset
|
55 |
|
079c2e27357a
Add terget to convert RST to HTML.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
750
diff
changeset
|
56 |
FILES_MODE_EL := $(wildcard *-mode.el) |
079c2e27357a
Add terget to convert RST to HTML.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
750
diff
changeset
|
57 |
|
079c2e27357a
Add terget to convert RST to HTML.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
750
diff
changeset
|
58 |
RST_FILES := $(wildcard *.rst) |
079c2e27357a
Add terget to convert RST to HTML.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
750
diff
changeset
|
59 |
HTML_FILES := $(RST_FILES:.rst=.html) |
079c2e27357a
Add terget to convert RST to HTML.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
750
diff
changeset
|
60 |
|
518
576a7e0fd9e0
Prefer native Windows Emacs, so use it if available.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
386
diff
changeset
|
61 |
################################################################ |
576a7e0fd9e0
Prefer native Windows Emacs, so use it if available.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
386
diff
changeset
|
62 |
# Targets. |
576a7e0fd9e0
Prefer native Windows Emacs, so use it if available.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
386
diff
changeset
|
63 |
|
260
437507e141b4
Write .PHONY exactly before target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
165
diff
changeset
|
64 |
.PHONY: all |
43
7c9cd891400b
Added makefile to install dot-emacs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
65 |
all: install |
7c9cd891400b
Added makefile to install dot-emacs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
66 |
|
750 | 67 |
################################################################ |
68 |
# Install/uninstall targets. |
|
69 |
||
268
b2cd8fbe5ec3
Install mode file under '.emacs.d' dir.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
267
diff
changeset
|
70 |
.PHONY: install-all |
b2cd8fbe5ec3
Install mode file under '.emacs.d' dir.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
267
diff
changeset
|
71 |
install-all: install |
b2cd8fbe5ec3
Install mode file under '.emacs.d' dir.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
267
diff
changeset
|
72 |
cp .emacs-pre $(HOME)/.emacs-pre |
b2cd8fbe5ec3
Install mode file under '.emacs.d' dir.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
267
diff
changeset
|
73 |
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
|
74 |
|
268
b2cd8fbe5ec3
Install mode file under '.emacs.d' dir.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
267
diff
changeset
|
75 |
.PHONY: install |
318
6a430707c23e
Store all files in current dir for easy access to they.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
279
diff
changeset
|
76 |
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
|
77 |
for file in .emacs-pre .emacs-post; do \ |
833 | 78 |
[ -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
|
79 |
done |
103
7c16c6cab2b0
By default .emacs also overwrite.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
96
diff
changeset
|
80 |
cp .emacs $(HOME)/.emacs |
93
99f967be941a
Rename files .emacs-my-custom* to .emacs-my*.
"Oleksandr Gavenko <gavenkoa@gmail.com>"
parents:
45
diff
changeset
|
81 |
cp .emacs-my $(HOME)/.emacs-my |
275
3af8c9807cbf
Added autoload generation.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
270
diff
changeset
|
82 |
rm -f -r $(HOME)/.emacs.d/my-lisp |
3af8c9807cbf
Added autoload generation.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
270
diff
changeset
|
83 |
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
|
84 |
for file in $(FILES_MODE_EL); do \ |
275
3af8c9807cbf
Added autoload generation.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
270
diff
changeset
|
85 |
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
|
86 |
done |
379
271ed5d61644
Special case for Windows if emacs-nox from Cygwin installed along with native Emacs.
user@localhost
parents:
318
diff
changeset
|
87 |
$(EMACS) --batch \ |
275
3af8c9807cbf
Added autoload generation.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
270
diff
changeset
|
88 |
--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
|
89 |
./.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
|
90 |
|
269
81c80df45b37
Udded uninstall target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
268
diff
changeset
|
91 |
.PHONY: uninstall |
81c80df45b37
Udded uninstall target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
268
diff
changeset
|
92 |
uninstall: |
832
6ee7dee9df3a
Implement 'uninstall' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
831
diff
changeset
|
93 |
rm -f $(HOME)/.emacs $(HOME)/.emacs-my $(HOME)/.emacs-autogen |
6ee7dee9df3a
Implement 'uninstall' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
831
diff
changeset
|
94 |
rm -f -r $(HOME)/.emacs.d/my-lisp |
269
81c80df45b37
Udded uninstall target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
268
diff
changeset
|
95 |
|
260
437507e141b4
Write .PHONY exactly before target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
165
diff
changeset
|
96 |
.PHONY: tar |
165
9f5dd505a4cf
Correct target name.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
164
diff
changeset
|
97 |
tar: |
85 | 98 |
tar cf dot-emacs.tar .emacs .emacs-my |
86 | 99 |
|
750 | 100 |
################################################################ |
752
079c2e27357a
Add terget to convert RST to HTML.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
750
diff
changeset
|
101 |
# Documentation targets. |
079c2e27357a
Add terget to convert RST to HTML.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
750
diff
changeset
|
102 |
|
079c2e27357a
Add terget to convert RST to HTML.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
750
diff
changeset
|
103 |
.PHONY: html |
079c2e27357a
Add terget to convert RST to HTML.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
750
diff
changeset
|
104 |
html: $(HTML_FILES) |
079c2e27357a
Add terget to convert RST to HTML.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
750
diff
changeset
|
105 |
|
079c2e27357a
Add terget to convert RST to HTML.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
750
diff
changeset
|
106 |
$(HTML_FILES): %.html: %.rst |
079c2e27357a
Add terget to convert RST to HTML.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
750
diff
changeset
|
107 |
$(RST2HTML) --stylesheet=rst.css $*.rst $@ |
079c2e27357a
Add terget to convert RST to HTML.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
750
diff
changeset
|
108 |
|
079c2e27357a
Add terget to convert RST to HTML.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
750
diff
changeset
|
109 |
################################################################ |
750 | 110 |
# Clean targets. |
111 |
||
260
437507e141b4
Write .PHONY exactly before target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
165
diff
changeset
|
112 |
.PHONY: distclean |
437507e141b4
Write .PHONY exactly before target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
165
diff
changeset
|
113 |
distclean: clean |
437507e141b4
Write .PHONY exactly before target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
165
diff
changeset
|
114 |
|
437507e141b4
Write .PHONY exactly before target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
165
diff
changeset
|
115 |
.PHONY: clean |
86 | 116 |
clean: |
752
079c2e27357a
Add terget to convert RST to HTML.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
750
diff
changeset
|
117 |
rm -f dot-emacs.tar $(HTML_FILES) |