Makefile
author Oleksandr Gavenko <gavenkoa@gmail.com>
Thu, 23 Apr 2015 02:04:23 +0300
changeset 1288 6333a733046f
parent 1285 8e2c4332223d
child 1295 c43104a5ff4a
permissions -rw-r--r--
Use new autobm mode!
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
1263
edc4ecb3ef60 Remove debug flag.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1262
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)))
1241
4f22d9fe2e5b Byte compile '.emacs-my' and 'my/*.el'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1236
diff changeset
    27
curdir := $(realpath .)
518
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
################################################################
576a7e0fd9e0 Prefer native Windows Emacs, so use it if available.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 386
diff changeset
    30
# Platform/environment definition.
576a7e0fd9e0 Prefer native Windows Emacs, so use it if available.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 386
diff changeset
    31
43
7c9cd891400b Added makefile to install dot-emacs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    32
ifeq '' '$(HOME)'
7c9cd891400b Added makefile to install dot-emacs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    33
  $(error Home env var not set!)
7c9cd891400b Added makefile to install dot-emacs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    34
endif
7c9cd891400b Added makefile to install dot-emacs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    35
379
271ed5d61644 Special case for Windows if emacs-nox from Cygwin installed along with native Emacs.
user@localhost
parents: 318
diff changeset
    36
host_os = unix
271ed5d61644 Special case for Windows if emacs-nox from Cygwin installed along with native Emacs.
user@localhost
parents: 318
diff changeset
    37
ifneq '' '$(COMSPEC)'
752
079c2e27357a Add terget to convert RST to HTML.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 750
diff changeset
    38
  ifneq '' '$(WINDIR)'
079c2e27357a Add terget to convert RST to HTML.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 750
diff changeset
    39
    # Probably under Windows.
079c2e27357a Add terget to convert RST to HTML.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 750
diff changeset
    40
    host_os = windows
079c2e27357a Add terget to convert RST to HTML.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 750
diff changeset
    41
  endif
379
271ed5d61644 Special case for Windows if emacs-nox from Cygwin installed along with native Emacs.
user@localhost
parents: 318
diff changeset
    42
endif
271ed5d61644 Special case for Windows if emacs-nox from Cygwin installed along with native Emacs.
user@localhost
parents: 318
diff changeset
    43
752
079c2e27357a Add terget to convert RST to HTML.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 750
diff changeset
    44
################################################################
1283
9765c6674f79 Add version compatibility checks.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1274
diff changeset
    45
# Installation directories and files.
1199
dff272add01e Move all configs to "~/.emacs.d/my".
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1150
diff changeset
    46
dff272add01e Move all configs to "~/.emacs.d/my".
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1150
diff changeset
    47
emacsdir := $(HOME)/.emacs.d
dff272add01e Move all configs to "~/.emacs.d/my".
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1150
diff changeset
    48
mylispdir := $(emacsdir)/my
dff272add01e Move all configs to "~/.emacs.d/my".
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1150
diff changeset
    49
1283
9765c6674f79 Add version compatibility checks.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1274
diff changeset
    50
# Compatibility version.
9765c6674f79 Add version compatibility checks.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1274
diff changeset
    51
COMPAT_VER := 1
9765c6674f79 Add version compatibility checks.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1274
diff changeset
    52
COMPAT_FILE := $(emacsdir)/.emacs-ver
9765c6674f79 Add version compatibility checks.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1274
diff changeset
    53
1199
dff272add01e Move all configs to "~/.emacs.d/my".
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1150
diff changeset
    54
################################################################
752
079c2e27357a Add terget to convert RST to HTML.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 750
diff changeset
    55
# Build tool definition/switches.
079c2e27357a Add terget to convert RST to HTML.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 750
diff changeset
    56
379
271ed5d61644 Special case for Windows if emacs-nox from Cygwin installed along with native Emacs.
user@localhost
parents: 318
diff changeset
    57
EMACS = emacs
518
576a7e0fd9e0 Prefer native Windows Emacs, so use it if available.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 386
diff changeset
    58
# 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
    59
ifeq 'windows' '$(host_os)'
518
576a7e0fd9e0 Prefer native Windows Emacs, so use it if available.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 386
diff changeset
    60
  ifneq '' '$(call which,runemacs.exe)'
576a7e0fd9e0 Prefer native Windows Emacs, so use it if available.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 386
diff changeset
    61
    EMACS = runemacs
576a7e0fd9e0 Prefer native Windows Emacs, so use it if available.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 386
diff changeset
    62
  endif
379
271ed5d61644 Special case for Windows if emacs-nox from Cygwin installed along with native Emacs.
user@localhost
parents: 318
diff changeset
    63
endif
271ed5d61644 Special case for Windows if emacs-nox from Cygwin installed along with native Emacs.
user@localhost
parents: 318
diff changeset
    64
752
079c2e27357a Add terget to convert RST to HTML.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 750
diff changeset
    65
RST2HTML = rst2html
079c2e27357a Add terget to convert RST to HTML.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 750
diff changeset
    66
ifeq '$(host_os)' 'windows'
079c2e27357a Add terget to convert RST to HTML.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 750
diff changeset
    67
  RST2HTML = rst2html.py
079c2e27357a Add terget to convert RST to HTML.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 750
diff changeset
    68
endif
079c2e27357a Add terget to convert RST to HTML.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 750
diff changeset
    69
079c2e27357a Add terget to convert RST to HTML.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 750
diff changeset
    70
################################################################
079c2e27357a Add terget to convert RST to HTML.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 750
diff changeset
    71
# Proj dirs/files.
079c2e27357a Add terget to convert RST to HTML.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 750
diff changeset
    72
1209
aa1de5eb3665 Handle all .el files same.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1199
diff changeset
    73
EL_FILES := $(wildcard *.el)
752
079c2e27357a Add terget to convert RST to HTML.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 750
diff changeset
    74
079c2e27357a Add terget to convert RST to HTML.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 750
diff changeset
    75
RST_FILES := $(wildcard *.rst)
079c2e27357a Add terget to convert RST to HTML.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 750
diff changeset
    76
HTML_FILES := $(RST_FILES:.rst=.html)
079c2e27357a Add terget to convert RST to HTML.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 750
diff changeset
    77
518
576a7e0fd9e0 Prefer native Windows Emacs, so use it if available.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 386
diff changeset
    78
################################################################
576a7e0fd9e0 Prefer native Windows Emacs, so use it if available.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 386
diff changeset
    79
# Targets.
576a7e0fd9e0 Prefer native Windows Emacs, so use it if available.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 386
diff changeset
    80
260
437507e141b4 Write .PHONY exactly before target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 165
diff changeset
    81
.PHONY: all
43
7c9cd891400b Added makefile to install dot-emacs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    82
all: install
7c9cd891400b Added makefile to install dot-emacs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    83
750
db9827b0fdf5 Add some headlines.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 700
diff changeset
    84
################################################################
db9827b0fdf5 Add some headlines.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 700
diff changeset
    85
# Install/uninstall targets.
db9827b0fdf5 Add some headlines.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 700
diff changeset
    86
1283
9765c6674f79 Add version compatibility checks.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1274
diff changeset
    87
.PHONY: check-install-comapt
9765c6674f79 Add version compatibility checks.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1274
diff changeset
    88
check-install-comapt:
9765c6674f79 Add version compatibility checks.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1274
diff changeset
    89
	[ -f $(COMPAT_FILE) ] || { echo $(COMPAT_FILE) missing, run '"make upgrade"' first; false; }
9765c6674f79 Add version compatibility checks.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1274
diff changeset
    90
	read ver <$(COMPAT_FILE); if [ "$$ver" -ne $(COMPAT_VER) ]; then echo "*** "Run '"make upgrade"' first" ***"; exit 1; fi
9765c6674f79 Add version compatibility checks.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1274
diff changeset
    91
9765c6674f79 Add version compatibility checks.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1274
diff changeset
    92
.PHONY: check-upgrade-comapt
9765c6674f79 Add version compatibility checks.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1274
diff changeset
    93
check-upgrade-comapt:
9765c6674f79 Add version compatibility checks.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1274
diff changeset
    94
	\
9765c6674f79 Add version compatibility checks.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1274
diff changeset
    95
if [ -f $(COMPAT_FILE) ]; then \
9765c6674f79 Add version compatibility checks.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1274
diff changeset
    96
  read ver <$(COMPAT_FILE); \
9765c6674f79 Add version compatibility checks.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1274
diff changeset
    97
  if [ "$$ver" -gt $(COMPAT_VER) ]; then \
9765c6674f79 Add version compatibility checks.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1274
diff changeset
    98
    echo "*** "Project is too old, downgrade is not possible..." ***"; \
9765c6674f79 Add version compatibility checks.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1274
diff changeset
    99
    exit 1; \
9765c6674f79 Add version compatibility checks.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1274
diff changeset
   100
  fi; \
9765c6674f79 Add version compatibility checks.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1274
diff changeset
   101
fi
9765c6674f79 Add version compatibility checks.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1274
diff changeset
   102
1199
dff272add01e Move all configs to "~/.emacs.d/my".
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1150
diff changeset
   103
.PHONY: upgrade
1283
9765c6674f79 Add version compatibility checks.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1274
diff changeset
   104
upgrade: check-upgrade-comapt
1199
dff272add01e Move all configs to "~/.emacs.d/my".
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1150
diff changeset
   105
	\
1216
6c7c0366b4be Improve previous upgrade script to handle more situations.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1215
diff changeset
   106
mkdir -p $(mylispdir); \
6c7c0366b4be Improve previous upgrade script to handle more situations.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1215
diff changeset
   107
rm -f $(emacsdir)/autoload-my.el; \
1267
5a6527540e19 Install updated files that take in account hierarchy changes after upgrade.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1266
diff changeset
   108
rm -f ~/.emacs; \
1262
daacd1a0408f Remove logic duplication. Make file moving safer.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1226
diff changeset
   109
[ -d $(emacsdir)/my-lisp ] && mv $(emacsdir)/my-lisp $(mylispdir); \
1285
8e2c4332223d Use newer recommended place for bookmarks.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1283
diff changeset
   110
for f in .emacs-my .emacs-custom.el .emacs-pre .emacs-post .emacs-places .emacs.desktop .emacs-places .emacs-autogen .ido.last .recentf; do \
1262
daacd1a0408f Remove logic duplication. Make file moving safer.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1226
diff changeset
   111
  if [ -f ~/$$f ]; then [ -f $(emacsdir)/$$f ] && mv ~/$$f $(emacsdir)/$$f.1 || mv ~/$$f $(emacsdir); fi; \
daacd1a0408f Remove logic duplication. Make file moving safer.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1226
diff changeset
   112
  if [ -f $(mylispdir)/$$f ]; then [ -f $(emacsdir)/$$f ] && mv $(mylispdir)/$$f $(emacsdir)/$$f.2 || mv $(mylispdir)/$$f $(emacsdir); fi; \
daacd1a0408f Remove logic duplication. Make file moving safer.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1226
diff changeset
   113
done; \
1274
cd0b674eeb5c Revert upgrade logic, lost during merge.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1272
diff changeset
   114
for f in `find $(mylispdir) -maxdepth 1 -type f -name '.emacs?*'`; do \
cd0b674eeb5c Revert upgrade logic, lost during merge.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1272
diff changeset
   115
  fn=$${f##*/}; \
cd0b674eeb5c Revert upgrade logic, lost during merge.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1272
diff changeset
   116
  [ -f $(emacsdir)/$$fn ] && mv $$f $(emacsdir)/$$fn.3 || mv $$f $(emacsdir); \
cd0b674eeb5c Revert upgrade logic, lost during merge.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1272
diff changeset
   117
done; \
1285
8e2c4332223d Use newer recommended place for bookmarks.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1283
diff changeset
   118
if [ -f ~/.emacs.bmk ]; then [ -f $(emacsdir)/bookmarks ] && mv ~/.emacs.bmk $(emacsdir)/bookmarks.$$$$ || mv ~/.emacs.bmk $(emacsdir)/bookmarks; fi; \
8e2c4332223d Use newer recommended place for bookmarks.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1283
diff changeset
   119
if [ -f $(emacsdir)/.emacs.bmk ]; then [ -f $(emacsdir)/bookmarks ] && mv $(emacsdir)/.emacs.bmk $(emacsdir)/bookmarks.$$$$ || mv $(emacsdir)/.emacs.bmk $(emacsdir)/bookmarks; fi; \
1283
9765c6674f79 Add version compatibility checks.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1274
diff changeset
   120
echo $(COMPAT_VER) >$(COMPAT_FILE); \
1270
0e68ef7990ef Fix merge.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1269
diff changeset
   121
make install
1199
dff272add01e Move all configs to "~/.emacs.d/my".
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1150
diff changeset
   122
268
b2cd8fbe5ec3 Install mode file under '.emacs.d' dir.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 267
diff changeset
   123
.PHONY: install-all
b2cd8fbe5ec3 Install mode file under '.emacs.d' dir.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 267
diff changeset
   124
install-all: install
1225
613aa3cc60b8 Fix paths.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1224
diff changeset
   125
	cp .emacs-pre $(emacsdir)/.emacs-pre
613aa3cc60b8 Fix paths.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1224
diff changeset
   126
	cp .emacs-post $(emacsdir)/.emacs-post
164
d7ed163b397e Added installation of template for -pre/-post scripts.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 111
diff changeset
   127
1272
496846754331 Update 'uninstall' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1271
diff changeset
   128
define cleanup_mylispdir
496846754331 Update 'uninstall' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1271
diff changeset
   129
  find $(mylispdir) -type f '(' -name '*.el' -o -name '*.elc' ')' -delete
496846754331 Update 'uninstall' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1271
diff changeset
   130
endef
496846754331 Update 'uninstall' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1271
diff changeset
   131
268
b2cd8fbe5ec3 Install mode file under '.emacs.d' dir.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 267
diff changeset
   132
.PHONY: install
1283
9765c6674f79 Add version compatibility checks.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1274
diff changeset
   133
install: check-install-comapt
1199
dff272add01e Move all configs to "~/.emacs.d/my".
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1150
diff changeset
   134
	mkdir -p $(mylispdir)
1272
496846754331 Update 'uninstall' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1271
diff changeset
   135
	$(cleanup_mylispdir)
111
fcea9d3b79e1 Rename -my{-pre/-post} to {-pre/-post}.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 103
diff changeset
   136
	for file in .emacs-pre .emacs-post; do \
1223
2792a1eb8850 Fix paths.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1217
diff changeset
   137
		[ -f $(emacsdir)/$$file ] || cp $$file $(emacsdir)/$$file; \
93
99f967be941a Rename files .emacs-my-custom* to .emacs-my*.
"Oleksandr Gavenko <gavenkoa@gmail.com>"
parents: 45
diff changeset
   138
	done
1215
c7e52e93465a Move .emacs files to user-emacs-directory.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1209
diff changeset
   139
	cp .emacs $(emacsdir)/init.el
1241
4f22d9fe2e5b Byte compile '.emacs-my' and 'my/*.el'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1236
diff changeset
   140
	cp .emacs-defs .emacs-my $(emacsdir)
1224
433aa3347a48 Fix: server-start: Opening output file: no such file or directory, c:/home/.emacs.d/server/server.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1223
diff changeset
   141
	mkdir -p $(emacsdir)/server $(HOME)/.gnus/scores
908
e3b3e9f4d759 New scoring rules.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 833
diff changeset
   142
	cp all.SCORE $(HOME)/.gnus/scores
1226
febcf7755a3d Simplify code.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1225
diff changeset
   143
	cp -f $(EL_FILES) $(mylispdir); \
1241
4f22d9fe2e5b Byte compile '.emacs-my' and 'my/*.el'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1236
diff changeset
   144
	./.emacs-autogen.sh $(emacsdir)/.emacs-autogen; \
1199
dff272add01e Move all configs to "~/.emacs.d/my".
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1150
diff changeset
   145
	$(EMACS) -Q --batch --eval='(let ((generated-autoload-file "$(mylispdir)/loaddefs.el")) (update-directory-autoloads "$(mylispdir)"))'
1241
4f22d9fe2e5b Byte compile '.emacs-my' and 'my/*.el'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1236
diff changeset
   146
	\
4f22d9fe2e5b Byte compile '.emacs-my' and 'my/*.el'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1236
diff changeset
   147
$(EMACS) -Q --batch --eval='(load "$(curdir)/.emacs-defs")' --eval='(my-load.add-my-loadpaths)' --eval='(load "$(emacsdir)/.emacs-pre")' \
4f22d9fe2e5b Byte compile '.emacs-my' and 'my/*.el'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1236
diff changeset
   148
  --eval='(byte-compile-file "$(emacsdir)/.emacs-my")' --eval='(byte-force-recompile "$(mylispdir)")'
1150
dad3fb58f710 Add srecode templates.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1082
diff changeset
   149
	cp -r srecode/ $(HOME)/.emacs.d/
164
d7ed163b397e Added installation of template for -pre/-post scripts.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 111
diff changeset
   150
269
81c80df45b37 Udded uninstall target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 268
diff changeset
   151
.PHONY: uninstall
81c80df45b37 Udded uninstall target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 268
diff changeset
   152
uninstall:
1272
496846754331 Update 'uninstall' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1271
diff changeset
   153
	rm -f $(patsubst %,$(emacsdir)/%, init.el .emacs-defs .emacs-my .emacs-autogen)
496846754331 Update 'uninstall' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1271
diff changeset
   154
	$(cleanup_mylispdir)
1199
dff272add01e Move all configs to "~/.emacs.d/my".
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1150
diff changeset
   155
	rm -f -r $(emacsdir)/srecode
269
81c80df45b37 Udded uninstall target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 268
diff changeset
   156
260
437507e141b4 Write .PHONY exactly before target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 165
diff changeset
   157
.PHONY: tar
165
9f5dd505a4cf Correct target name.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 164
diff changeset
   158
tar:
85
2bb7e6aceac9 Added target dist-tar.
gavenkoa@gavenko.bifit.int
parents: 45
diff changeset
   159
	tar cf dot-emacs.tar .emacs .emacs-my
86
0cf1b0216dac Added target clean.
gavenkoa@gavenko.bifit.int
parents: 85
diff changeset
   160
750
db9827b0fdf5 Add some headlines.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 700
diff changeset
   161
################################################################
752
079c2e27357a Add terget to convert RST to HTML.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 750
diff changeset
   162
# Documentation targets.
079c2e27357a Add terget to convert RST to HTML.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 750
diff changeset
   163
079c2e27357a Add terget to convert RST to HTML.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 750
diff changeset
   164
.PHONY: html
079c2e27357a Add terget to convert RST to HTML.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 750
diff changeset
   165
html: $(HTML_FILES)
079c2e27357a Add terget to convert RST to HTML.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 750
diff changeset
   166
079c2e27357a Add terget to convert RST to HTML.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 750
diff changeset
   167
$(HTML_FILES): %.html: %.rst
079c2e27357a Add terget to convert RST to HTML.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 750
diff changeset
   168
	$(RST2HTML) --stylesheet=rst.css $*.rst $@
079c2e27357a Add terget to convert RST to HTML.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 750
diff changeset
   169
079c2e27357a Add terget to convert RST to HTML.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 750
diff changeset
   170
################################################################
750
db9827b0fdf5 Add some headlines.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 700
diff changeset
   171
# Clean targets.
db9827b0fdf5 Add some headlines.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 700
diff changeset
   172
260
437507e141b4 Write .PHONY exactly before target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 165
diff changeset
   173
.PHONY: distclean
437507e141b4 Write .PHONY exactly before target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 165
diff changeset
   174
distclean: clean
437507e141b4 Write .PHONY exactly before target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 165
diff changeset
   175
437507e141b4 Write .PHONY exactly before target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 165
diff changeset
   176
.PHONY: clean
86
0cf1b0216dac Added target clean.
gavenkoa@gavenko.bifit.int
parents: 85
diff changeset
   177
clean:
752
079c2e27357a Add terget to convert RST to HTML.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 750
diff changeset
   178
	rm -f dot-emacs.tar $(HTML_FILES)