Makefile
author Oleksandr Gavenko <gavenkoa@gmail.com>
Sun, 11 Sep 2016 15:06:41 +0300
changeset 1430 8380f91bc913
parent 1408 8ea516ab3865
child 1519 7b320068aa6b
permissions -rw-r--r--
Make possible to move through English word pronunciation with single forward-word.
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
1358
54b0b0bb4570 Move upgrade script to separate file. Add framework to support future upgrades.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1357
diff changeset
     9
SHELL = /bin/bash
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
1320
d2181407c8bd In order to byte-compile under Windows install Cygwin Emacs to PATH!
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1301
diff changeset
    57
# In order to byte-compile under Windows install Cygwin Emacs to PATH!
379
271ed5d61644 Special case for Windows if emacs-nox from Cygwin installed along with native Emacs.
user@localhost
parents: 318
diff changeset
    58
EMACS = emacs
271ed5d61644 Special case for Windows if emacs-nox from Cygwin installed along with native Emacs.
user@localhost
parents: 318
diff changeset
    59
752
079c2e27357a Add terget to convert RST to HTML.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 750
diff changeset
    60
RST2HTML = rst2html
079c2e27357a Add terget to convert RST to HTML.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 750
diff changeset
    61
ifeq '$(host_os)' 'windows'
079c2e27357a Add terget to convert RST to HTML.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 750
diff changeset
    62
  RST2HTML = rst2html.py
079c2e27357a Add terget to convert RST to HTML.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 750
diff changeset
    63
endif
079c2e27357a Add terget to convert RST to HTML.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 750
diff changeset
    64
079c2e27357a Add terget to convert RST to HTML.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 750
diff changeset
    65
################################################################
079c2e27357a Add terget to convert RST to HTML.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 750
diff changeset
    66
# Proj dirs/files.
079c2e27357a Add terget to convert RST to HTML.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 750
diff changeset
    67
1209
aa1de5eb3665 Handle all .el files same.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1199
diff changeset
    68
EL_FILES := $(wildcard *.el)
752
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
RST_FILES := $(wildcard *.rst)
079c2e27357a Add terget to convert RST to HTML.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 750
diff changeset
    71
HTML_FILES := $(RST_FILES:.rst=.html)
079c2e27357a Add terget to convert RST to HTML.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 750
diff changeset
    72
518
576a7e0fd9e0 Prefer native Windows Emacs, so use it if available.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 386
diff changeset
    73
################################################################
576a7e0fd9e0 Prefer native Windows Emacs, so use it if available.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 386
diff changeset
    74
# Targets.
576a7e0fd9e0 Prefer native Windows Emacs, so use it if available.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 386
diff changeset
    75
260
437507e141b4 Write .PHONY exactly before target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 165
diff changeset
    76
.PHONY: all
43
7c9cd891400b Added makefile to install dot-emacs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    77
all: install
7c9cd891400b Added makefile to install dot-emacs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    78
750
db9827b0fdf5 Add some headlines.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 700
diff changeset
    79
################################################################
1369
afb2d0fd7999 Deploy targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1362
diff changeset
    80
# Deploy targets.
afb2d0fd7999 Deploy targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1362
diff changeset
    81
afb2d0fd7999 Deploy targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1362
diff changeset
    82
.PHONY: deploy
afb2d0fd7999 Deploy targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1362
diff changeset
    83
deploy: deploy2defun deploy2sf
afb2d0fd7999 Deploy targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1362
diff changeset
    84
afb2d0fd7999 Deploy targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1362
diff changeset
    85
afb2d0fd7999 Deploy targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1362
diff changeset
    86
DEFUN_USER ?= user
afb2d0fd7999 Deploy targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1362
diff changeset
    87
DEFUN_HG_SRV ?= hg.defun.work
afb2d0fd7999 Deploy targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1362
diff changeset
    88
DEFUN_HG_DIR ?= /srv/hg/dot-emacs
afb2d0fd7999 Deploy targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1362
diff changeset
    89
afb2d0fd7999 Deploy targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1362
diff changeset
    90
.PHONY: deploy2defun
afb2d0fd7999 Deploy targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1362
diff changeset
    91
deploy2defun: deploy2defun-src
afb2d0fd7999 Deploy targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1362
diff changeset
    92
afb2d0fd7999 Deploy targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1362
diff changeset
    93
.PHONY: deploy2defun-src
afb2d0fd7999 Deploy targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1362
diff changeset
    94
deploy2defun-src:
afb2d0fd7999 Deploy targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1362
diff changeset
    95
	hg push ssh://$(DEFUN_USER)@$(DEFUN_HG_SRV)/$(DEFUN_HG_DIR) || [ $$? = 1 ]
afb2d0fd7999 Deploy targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1362
diff changeset
    96
afb2d0fd7999 Deploy targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1362
diff changeset
    97
afb2d0fd7999 Deploy targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1362
diff changeset
    98
SF_USER ?= gavenkoa
afb2d0fd7999 Deploy targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1362
diff changeset
    99
afb2d0fd7999 Deploy targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1362
diff changeset
   100
.PHONY: deploy2sf
afb2d0fd7999 Deploy targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1362
diff changeset
   101
deploy2sf: deploy2sf-src
afb2d0fd7999 Deploy targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1362
diff changeset
   102
afb2d0fd7999 Deploy targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1362
diff changeset
   103
.PHONY: deploy2sf-src
afb2d0fd7999 Deploy targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1362
diff changeset
   104
deploy2sf-src:
afb2d0fd7999 Deploy targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1362
diff changeset
   105
	hg push ssh://$(SF_USER)@hg.code.sf.net/u/$(SF_USER)/dot-emacs || [ $$? = 1 ]
afb2d0fd7999 Deploy targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1362
diff changeset
   106
afb2d0fd7999 Deploy targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1362
diff changeset
   107
################################################################
750
db9827b0fdf5 Add some headlines.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 700
diff changeset
   108
# Install/uninstall targets.
db9827b0fdf5 Add some headlines.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 700
diff changeset
   109
1283
9765c6674f79 Add version compatibility checks.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1274
diff changeset
   110
.PHONY: check-install-comapt
9765c6674f79 Add version compatibility checks.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1274
diff changeset
   111
check-install-comapt:
1301
4ef2dccbddbd Fix: broken checks prevent installation on fresh host.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1297
diff changeset
   112
	\
4ef2dccbddbd Fix: broken checks prevent installation on fresh host.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1297
diff changeset
   113
if [ -f ~/.emacs ]; then \
1408
8ea516ab3865 Fix: Recursive make invocation require '$(MAKE)' usage.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1406
diff changeset
   114
  echo Old style install detected, run '"$(MAKE) upgrade"' first; \
1301
4ef2dccbddbd Fix: broken checks prevent installation on fresh host.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1297
diff changeset
   115
  false; \
4ef2dccbddbd Fix: broken checks prevent installation on fresh host.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1297
diff changeset
   116
fi
4ef2dccbddbd Fix: broken checks prevent installation on fresh host.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1297
diff changeset
   117
	\
4ef2dccbddbd Fix: broken checks prevent installation on fresh host.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1297
diff changeset
   118
if [ -f $(emacsdir)/init.el ]; then \
4ef2dccbddbd Fix: broken checks prevent installation on fresh host.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1297
diff changeset
   119
  if [ ! -f $(COMPAT_FILE) ]; then \
1408
8ea516ab3865 Fix: Recursive make invocation require '$(MAKE)' usage.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1406
diff changeset
   120
    echo $(COMPAT_FILE) missing, run '"$(MAKE) upgrade"' first; \
1301
4ef2dccbddbd Fix: broken checks prevent installation on fresh host.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1297
diff changeset
   121
    exit 1; \
4ef2dccbddbd Fix: broken checks prevent installation on fresh host.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1297
diff changeset
   122
  fi; \
4ef2dccbddbd Fix: broken checks prevent installation on fresh host.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1297
diff changeset
   123
fi
1408
8ea516ab3865 Fix: Recursive make invocation require '$(MAKE)' usage.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1406
diff changeset
   124
	read ver <$(COMPAT_FILE); if [ "$$ver" -ne $(COMPAT_VER) ]; then echo "*** "Run '"$(MAKE) upgrade"' first" ***"; exit 1; fi
1283
9765c6674f79 Add version compatibility checks.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1274
diff changeset
   125
1358
54b0b0bb4570 Move upgrade script to separate file. Add framework to support future upgrades.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1357
diff changeset
   126
.PHONY: upgrade
54b0b0bb4570 Move upgrade script to separate file. Add framework to support future upgrades.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1357
diff changeset
   127
upgrade:
1283
9765c6674f79 Add version compatibility checks.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1274
diff changeset
   128
	\
9765c6674f79 Add version compatibility checks.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1274
diff changeset
   129
if [ -f $(COMPAT_FILE) ]; then \
9765c6674f79 Add version compatibility checks.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1274
diff changeset
   130
  read ver <$(COMPAT_FILE); \
9765c6674f79 Add version compatibility checks.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1274
diff changeset
   131
  if [ "$$ver" -gt $(COMPAT_VER) ]; then \
9765c6674f79 Add version compatibility checks.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1274
diff changeset
   132
    echo "*** "Project is too old, downgrade is not possible..." ***"; \
9765c6674f79 Add version compatibility checks.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1274
diff changeset
   133
    exit 1; \
9765c6674f79 Add version compatibility checks.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1274
diff changeset
   134
  fi; \
1358
54b0b0bb4570 Move upgrade script to separate file. Add framework to support future upgrades.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1357
diff changeset
   135
else \
54b0b0bb4570 Move upgrade script to separate file. Add framework to support future upgrades.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1357
diff changeset
   136
  ver=0; \
54b0b0bb4570 Move upgrade script to separate file. Add framework to support future upgrades.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1357
diff changeset
   137
fi; \
54b0b0bb4570 Move upgrade script to separate file. Add framework to support future upgrades.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1357
diff changeset
   138
for ((i=ver+1; i <= $(COMPAT_VER); i++)); do \
54b0b0bb4570 Move upgrade script to separate file. Add framework to support future upgrades.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1357
diff changeset
   139
  $(SHELL) upgrade/$$i.bash $(emacsdir); \
54b0b0bb4570 Move upgrade script to separate file. Add framework to support future upgrades.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1357
diff changeset
   140
done
1408
8ea516ab3865 Fix: Recursive make invocation require '$(MAKE)' usage.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1406
diff changeset
   141
	$(MAKE) install
1199
dff272add01e Move all configs to "~/.emacs.d/my".
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1150
diff changeset
   142
268
b2cd8fbe5ec3 Install mode file under '.emacs.d' dir.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 267
diff changeset
   143
.PHONY: install-all
b2cd8fbe5ec3 Install mode file under '.emacs.d' dir.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 267
diff changeset
   144
install-all: install
1225
613aa3cc60b8 Fix paths.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1224
diff changeset
   145
	cp .emacs-pre $(emacsdir)/.emacs-pre
613aa3cc60b8 Fix paths.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1224
diff changeset
   146
	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
   147
1272
496846754331 Update 'uninstall' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1271
diff changeset
   148
define cleanup_mylispdir
1406
0fddf6d2ccf2 Fix: Solaris 'find' does not support '-delete' option.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1369
diff changeset
   149
  find $(mylispdir) -type f '(' -name '*.el' -o -name '*.elc' -o -name '*~' ')' -exec rm {} ';'
1272
496846754331 Update 'uninstall' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1271
diff changeset
   150
endef
496846754331 Update 'uninstall' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1271
diff changeset
   151
268
b2cd8fbe5ec3 Install mode file under '.emacs.d' dir.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 267
diff changeset
   152
.PHONY: install
1283
9765c6674f79 Add version compatibility checks.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1274
diff changeset
   153
install: check-install-comapt
1199
dff272add01e Move all configs to "~/.emacs.d/my".
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1150
diff changeset
   154
	mkdir -p $(mylispdir)
1358
54b0b0bb4570 Move upgrade script to separate file. Add framework to support future upgrades.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1357
diff changeset
   155
	echo $(COMPAT_VER) >$(COMPAT_FILE)
1272
496846754331 Update 'uninstall' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1271
diff changeset
   156
	$(cleanup_mylispdir)
111
fcea9d3b79e1 Rename -my{-pre/-post} to {-pre/-post}.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 103
diff changeset
   157
	for file in .emacs-pre .emacs-post; do \
1223
2792a1eb8850 Fix paths.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1217
diff changeset
   158
		[ -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
   159
	done
1297
b638d2b23ec9 Use built-in options for elisp actions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1295
diff changeset
   160
	\
1357
a796e1fddc70 Fix: Copy missing file.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1353
diff changeset
   161
cp .emacs-defs init.el .emacs-my $(emacsdir)
1241
4f22d9fe2e5b Byte compile '.emacs-my' and 'my/*.el'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1236
diff changeset
   162
	\
1297
b638d2b23ec9 Use built-in options for elisp actions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1295
diff changeset
   163
mkdir -p $(emacsdir)/server $(HOME)/.gnus/scores; \
b638d2b23ec9 Use built-in options for elisp actions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1295
diff changeset
   164
cp all.SCORE $(HOME)/.gnus/scores
b638d2b23ec9 Use built-in options for elisp actions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1295
diff changeset
   165
	\
b638d2b23ec9 Use built-in options for elisp actions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1295
diff changeset
   166
cp -f $(EL_FILES) $(mylispdir); \
b638d2b23ec9 Use built-in options for elisp actions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1295
diff changeset
   167
./.emacs-autogen.sh $(emacsdir)/.emacs-autogen; \
b638d2b23ec9 Use built-in options for elisp actions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1295
diff changeset
   168
$(EMACS) --batch -Q --eval='(let ((generated-autoload-file "$(mylispdir)/loaddefs.el")) (update-directory-autoloads "$(mylispdir)"))'
b638d2b23ec9 Use built-in options for elisp actions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1295
diff changeset
   169
	\
b638d2b23ec9 Use built-in options for elisp actions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1295
diff changeset
   170
$(EMACS) --batch --load "$(curdir)/.emacs-defs" -f 'my-load.add-my-loadpaths' --load "$(emacsdir)/.emacs-pre" \
1241
4f22d9fe2e5b Byte compile '.emacs-my' and 'my/*.el'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1236
diff changeset
   171
  --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
   172
	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
   173
269
81c80df45b37 Udded uninstall target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 268
diff changeset
   174
.PHONY: uninstall
81c80df45b37 Udded uninstall target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 268
diff changeset
   175
uninstall:
1272
496846754331 Update 'uninstall' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1271
diff changeset
   176
	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
   177
	$(cleanup_mylispdir)
1199
dff272add01e Move all configs to "~/.emacs.d/my".
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1150
diff changeset
   178
	rm -f -r $(emacsdir)/srecode
269
81c80df45b37 Udded uninstall target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 268
diff changeset
   179
260
437507e141b4 Write .PHONY exactly before target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 165
diff changeset
   180
.PHONY: tar
165
9f5dd505a4cf Correct target name.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 164
diff changeset
   181
tar:
85
2bb7e6aceac9 Added target dist-tar.
gavenkoa@gavenko.bifit.int
parents: 45
diff changeset
   182
	tar cf dot-emacs.tar .emacs .emacs-my
86
0cf1b0216dac Added target clean.
gavenkoa@gavenko.bifit.int
parents: 85
diff changeset
   183
750
db9827b0fdf5 Add some headlines.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 700
diff changeset
   184
################################################################
752
079c2e27357a Add terget to convert RST to HTML.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 750
diff changeset
   185
# Documentation targets.
079c2e27357a Add terget to convert RST to HTML.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 750
diff changeset
   186
079c2e27357a Add terget to convert RST to HTML.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 750
diff changeset
   187
.PHONY: html
079c2e27357a Add terget to convert RST to HTML.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 750
diff changeset
   188
html: $(HTML_FILES)
079c2e27357a Add terget to convert RST to HTML.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 750
diff changeset
   189
079c2e27357a Add terget to convert RST to HTML.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 750
diff changeset
   190
$(HTML_FILES): %.html: %.rst
079c2e27357a Add terget to convert RST to HTML.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 750
diff changeset
   191
	$(RST2HTML) --stylesheet=rst.css $*.rst $@
079c2e27357a Add terget to convert RST to HTML.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 750
diff changeset
   192
079c2e27357a Add terget to convert RST to HTML.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 750
diff changeset
   193
################################################################
750
db9827b0fdf5 Add some headlines.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 700
diff changeset
   194
# Clean targets.
db9827b0fdf5 Add some headlines.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 700
diff changeset
   195
260
437507e141b4 Write .PHONY exactly before target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 165
diff changeset
   196
.PHONY: distclean
437507e141b4 Write .PHONY exactly before target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 165
diff changeset
   197
distclean: clean
437507e141b4 Write .PHONY exactly before target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 165
diff changeset
   198
437507e141b4 Write .PHONY exactly before target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 165
diff changeset
   199
.PHONY: clean
86
0cf1b0216dac Added target clean.
gavenkoa@gavenko.bifit.int
parents: 85
diff changeset
   200
clean:
752
079c2e27357a Add terget to convert RST to HTML.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 750
diff changeset
   201
	rm -f dot-emacs.tar $(HTML_FILES)