Makefile
author Oleksandr Gavenko <gavenkoa@gmail.com>
Thu, 21 Sep 2017 15:09:27 +0300
changeset 1537 592689d6d222
parent 1519 7b320068aa6b
child 1608 9c9e7f91f4f3
permissions -rw-r--r--
Some symbols from default composition rules cause Emacs redisplay hang on Windows.
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)
1519
7b320068aa6b Added target to run byte compilation to gather warnings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1408
diff changeset
    69
ELC_FILES := $(EL_FILES:.el=.elc)
752
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
RST_FILES := $(wildcard *.rst)
079c2e27357a Add terget to convert RST to HTML.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 750
diff changeset
    72
HTML_FILES := $(RST_FILES:.rst=.html)
079c2e27357a Add terget to convert RST to HTML.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 750
diff changeset
    73
518
576a7e0fd9e0 Prefer native Windows Emacs, so use it if available.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 386
diff changeset
    74
################################################################
576a7e0fd9e0 Prefer native Windows Emacs, so use it if available.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 386
diff changeset
    75
# Targets.
576a7e0fd9e0 Prefer native Windows Emacs, so use it if available.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 386
diff changeset
    76
260
437507e141b4 Write .PHONY exactly before target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 165
diff changeset
    77
.PHONY: all
43
7c9cd891400b Added makefile to install dot-emacs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    78
all: install
7c9cd891400b Added makefile to install dot-emacs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    79
750
db9827b0fdf5 Add some headlines.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 700
diff changeset
    80
################################################################
1369
afb2d0fd7999 Deploy targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1362
diff changeset
    81
# Deploy targets.
afb2d0fd7999 Deploy targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1362
diff changeset
    82
afb2d0fd7999 Deploy targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1362
diff changeset
    83
.PHONY: deploy
afb2d0fd7999 Deploy targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1362
diff changeset
    84
deploy: deploy2defun deploy2sf
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
afb2d0fd7999 Deploy targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1362
diff changeset
    87
DEFUN_USER ?= user
afb2d0fd7999 Deploy targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1362
diff changeset
    88
DEFUN_HG_SRV ?= hg.defun.work
afb2d0fd7999 Deploy targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1362
diff changeset
    89
DEFUN_HG_DIR ?= /srv/hg/dot-emacs
afb2d0fd7999 Deploy targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1362
diff changeset
    90
afb2d0fd7999 Deploy targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1362
diff changeset
    91
.PHONY: deploy2defun
afb2d0fd7999 Deploy targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1362
diff changeset
    92
deploy2defun: deploy2defun-src
afb2d0fd7999 Deploy targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1362
diff changeset
    93
afb2d0fd7999 Deploy targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1362
diff changeset
    94
.PHONY: deploy2defun-src
afb2d0fd7999 Deploy targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1362
diff changeset
    95
deploy2defun-src:
afb2d0fd7999 Deploy targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1362
diff changeset
    96
	hg push ssh://$(DEFUN_USER)@$(DEFUN_HG_SRV)/$(DEFUN_HG_DIR) || [ $$? = 1 ]
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
afb2d0fd7999 Deploy targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1362
diff changeset
    99
SF_USER ?= gavenkoa
afb2d0fd7999 Deploy targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1362
diff changeset
   100
afb2d0fd7999 Deploy targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1362
diff changeset
   101
.PHONY: deploy2sf
afb2d0fd7999 Deploy targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1362
diff changeset
   102
deploy2sf: deploy2sf-src
afb2d0fd7999 Deploy targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1362
diff changeset
   103
afb2d0fd7999 Deploy targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1362
diff changeset
   104
.PHONY: deploy2sf-src
afb2d0fd7999 Deploy targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1362
diff changeset
   105
deploy2sf-src:
afb2d0fd7999 Deploy targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1362
diff changeset
   106
	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
   107
afb2d0fd7999 Deploy targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1362
diff changeset
   108
################################################################
750
db9827b0fdf5 Add some headlines.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 700
diff changeset
   109
# Install/uninstall targets.
db9827b0fdf5 Add some headlines.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 700
diff changeset
   110
1283
9765c6674f79 Add version compatibility checks.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1274
diff changeset
   111
.PHONY: check-install-comapt
9765c6674f79 Add version compatibility checks.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1274
diff changeset
   112
check-install-comapt:
1301
4ef2dccbddbd Fix: broken checks prevent installation on fresh host.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1297
diff changeset
   113
	\
4ef2dccbddbd Fix: broken checks prevent installation on fresh host.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1297
diff changeset
   114
if [ -f ~/.emacs ]; then \
1408
8ea516ab3865 Fix: Recursive make invocation require '$(MAKE)' usage.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1406
diff changeset
   115
  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
   116
  false; \
4ef2dccbddbd Fix: broken checks prevent installation on fresh host.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1297
diff changeset
   117
fi
4ef2dccbddbd Fix: broken checks prevent installation on fresh host.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1297
diff changeset
   118
	\
4ef2dccbddbd Fix: broken checks prevent installation on fresh host.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1297
diff changeset
   119
if [ -f $(emacsdir)/init.el ]; then \
4ef2dccbddbd Fix: broken checks prevent installation on fresh host.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1297
diff changeset
   120
  if [ ! -f $(COMPAT_FILE) ]; then \
1408
8ea516ab3865 Fix: Recursive make invocation require '$(MAKE)' usage.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1406
diff changeset
   121
    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
   122
    exit 1; \
4ef2dccbddbd Fix: broken checks prevent installation on fresh host.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1297
diff changeset
   123
  fi; \
4ef2dccbddbd Fix: broken checks prevent installation on fresh host.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1297
diff changeset
   124
fi
1408
8ea516ab3865 Fix: Recursive make invocation require '$(MAKE)' usage.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1406
diff changeset
   125
	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
   126
1358
54b0b0bb4570 Move upgrade script to separate file. Add framework to support future upgrades.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1357
diff changeset
   127
.PHONY: upgrade
54b0b0bb4570 Move upgrade script to separate file. Add framework to support future upgrades.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1357
diff changeset
   128
upgrade:
1283
9765c6674f79 Add version compatibility checks.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1274
diff changeset
   129
	\
9765c6674f79 Add version compatibility checks.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1274
diff changeset
   130
if [ -f $(COMPAT_FILE) ]; then \
9765c6674f79 Add version compatibility checks.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1274
diff changeset
   131
  read ver <$(COMPAT_FILE); \
9765c6674f79 Add version compatibility checks.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1274
diff changeset
   132
  if [ "$$ver" -gt $(COMPAT_VER) ]; then \
9765c6674f79 Add version compatibility checks.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1274
diff changeset
   133
    echo "*** "Project is too old, downgrade is not possible..." ***"; \
9765c6674f79 Add version compatibility checks.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1274
diff changeset
   134
    exit 1; \
9765c6674f79 Add version compatibility checks.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1274
diff changeset
   135
  fi; \
1358
54b0b0bb4570 Move upgrade script to separate file. Add framework to support future upgrades.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1357
diff changeset
   136
else \
54b0b0bb4570 Move upgrade script to separate file. Add framework to support future upgrades.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1357
diff changeset
   137
  ver=0; \
54b0b0bb4570 Move upgrade script to separate file. Add framework to support future upgrades.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1357
diff changeset
   138
fi; \
54b0b0bb4570 Move upgrade script to separate file. Add framework to support future upgrades.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1357
diff changeset
   139
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
   140
  $(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
   141
done
1408
8ea516ab3865 Fix: Recursive make invocation require '$(MAKE)' usage.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1406
diff changeset
   142
	$(MAKE) install
1199
dff272add01e Move all configs to "~/.emacs.d/my".
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1150
diff changeset
   143
268
b2cd8fbe5ec3 Install mode file under '.emacs.d' dir.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 267
diff changeset
   144
.PHONY: install-all
b2cd8fbe5ec3 Install mode file under '.emacs.d' dir.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 267
diff changeset
   145
install-all: install
1225
613aa3cc60b8 Fix paths.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1224
diff changeset
   146
	cp .emacs-pre $(emacsdir)/.emacs-pre
613aa3cc60b8 Fix paths.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1224
diff changeset
   147
	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
   148
1272
496846754331 Update 'uninstall' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1271
diff changeset
   149
define cleanup_mylispdir
1406
0fddf6d2ccf2 Fix: Solaris 'find' does not support '-delete' option.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1369
diff changeset
   150
  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
   151
endef
496846754331 Update 'uninstall' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1271
diff changeset
   152
268
b2cd8fbe5ec3 Install mode file under '.emacs.d' dir.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 267
diff changeset
   153
.PHONY: install
1283
9765c6674f79 Add version compatibility checks.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1274
diff changeset
   154
install: check-install-comapt
1199
dff272add01e Move all configs to "~/.emacs.d/my".
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1150
diff changeset
   155
	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
   156
	echo $(COMPAT_VER) >$(COMPAT_FILE)
1272
496846754331 Update 'uninstall' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1271
diff changeset
   157
	$(cleanup_mylispdir)
111
fcea9d3b79e1 Rename -my{-pre/-post} to {-pre/-post}.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 103
diff changeset
   158
	for file in .emacs-pre .emacs-post; do \
1223
2792a1eb8850 Fix paths.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1217
diff changeset
   159
		[ -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
   160
	done
1297
b638d2b23ec9 Use built-in options for elisp actions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1295
diff changeset
   161
	\
1357
a796e1fddc70 Fix: Copy missing file.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1353
diff changeset
   162
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
   163
	\
1297
b638d2b23ec9 Use built-in options for elisp actions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1295
diff changeset
   164
mkdir -p $(emacsdir)/server $(HOME)/.gnus/scores; \
b638d2b23ec9 Use built-in options for elisp actions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1295
diff changeset
   165
cp all.SCORE $(HOME)/.gnus/scores
b638d2b23ec9 Use built-in options for elisp actions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1295
diff changeset
   166
	\
b638d2b23ec9 Use built-in options for elisp actions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1295
diff changeset
   167
cp -f $(EL_FILES) $(mylispdir); \
b638d2b23ec9 Use built-in options for elisp actions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1295
diff changeset
   168
./.emacs-autogen.sh $(emacsdir)/.emacs-autogen; \
b638d2b23ec9 Use built-in options for elisp actions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1295
diff changeset
   169
$(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
   170
	\
b638d2b23ec9 Use built-in options for elisp actions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1295
diff changeset
   171
$(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
   172
  --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
   173
	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
   174
269
81c80df45b37 Udded uninstall target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 268
diff changeset
   175
.PHONY: uninstall
81c80df45b37 Udded uninstall target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 268
diff changeset
   176
uninstall:
1272
496846754331 Update 'uninstall' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1271
diff changeset
   177
	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
   178
	$(cleanup_mylispdir)
1199
dff272add01e Move all configs to "~/.emacs.d/my".
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1150
diff changeset
   179
	rm -f -r $(emacsdir)/srecode
269
81c80df45b37 Udded uninstall target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 268
diff changeset
   180
260
437507e141b4 Write .PHONY exactly before target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 165
diff changeset
   181
.PHONY: tar
165
9f5dd505a4cf Correct target name.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 164
diff changeset
   182
tar:
85
2bb7e6aceac9 Added target dist-tar.
gavenkoa@gavenko.bifit.int
parents: 45
diff changeset
   183
	tar cf dot-emacs.tar .emacs .emacs-my
86
0cf1b0216dac Added target clean.
gavenkoa@gavenko.bifit.int
parents: 85
diff changeset
   184
750
db9827b0fdf5 Add some headlines.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 700
diff changeset
   185
################################################################
1519
7b320068aa6b Added target to run byte compilation to gather warnings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1408
diff changeset
   186
# Check targets.
7b320068aa6b Added target to run byte compilation to gather warnings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1408
diff changeset
   187
7b320068aa6b Added target to run byte compilation to gather warnings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1408
diff changeset
   188
.PHONY: check
7b320068aa6b Added target to run byte compilation to gather warnings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1408
diff changeset
   189
check: check-byte-compile
7b320068aa6b Added target to run byte compilation to gather warnings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1408
diff changeset
   190
7b320068aa6b Added target to run byte compilation to gather warnings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1408
diff changeset
   191
.PHONY: check-byte-compile
7b320068aa6b Added target to run byte compilation to gather warnings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1408
diff changeset
   192
check-byte-compile:
7b320068aa6b Added target to run byte compilation to gather warnings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1408
diff changeset
   193
	\
7b320068aa6b Added target to run byte compilation to gather warnings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1408
diff changeset
   194
$(EMACS) -f package-initialize --eval '(push "." load-path)'  --batch -f batch-byte-compile $(filter-out init.el,$(EL_FILES)) || :
7b320068aa6b Added target to run byte compilation to gather warnings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1408
diff changeset
   195
	rm -f $(ELC_FILES)
7b320068aa6b Added target to run byte compilation to gather warnings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1408
diff changeset
   196
7b320068aa6b Added target to run byte compilation to gather warnings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1408
diff changeset
   197
################################################################
752
079c2e27357a Add terget to convert RST to HTML.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 750
diff changeset
   198
# Documentation targets.
079c2e27357a Add terget to convert RST to HTML.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 750
diff changeset
   199
079c2e27357a Add terget to convert RST to HTML.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 750
diff changeset
   200
.PHONY: html
079c2e27357a Add terget to convert RST to HTML.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 750
diff changeset
   201
html: $(HTML_FILES)
079c2e27357a Add terget to convert RST to HTML.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 750
diff changeset
   202
079c2e27357a Add terget to convert RST to HTML.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 750
diff changeset
   203
$(HTML_FILES): %.html: %.rst
079c2e27357a Add terget to convert RST to HTML.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 750
diff changeset
   204
	$(RST2HTML) --stylesheet=rst.css $*.rst $@
079c2e27357a Add terget to convert RST to HTML.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 750
diff changeset
   205
079c2e27357a Add terget to convert RST to HTML.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 750
diff changeset
   206
################################################################
750
db9827b0fdf5 Add some headlines.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 700
diff changeset
   207
# Clean targets.
db9827b0fdf5 Add some headlines.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 700
diff changeset
   208
260
437507e141b4 Write .PHONY exactly before target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 165
diff changeset
   209
.PHONY: distclean
437507e141b4 Write .PHONY exactly before target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 165
diff changeset
   210
distclean: clean
437507e141b4 Write .PHONY exactly before target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 165
diff changeset
   211
437507e141b4 Write .PHONY exactly before target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 165
diff changeset
   212
.PHONY: clean
86
0cf1b0216dac Added target clean.
gavenkoa@gavenko.bifit.int
parents: 85
diff changeset
   213
clean:
1519
7b320068aa6b Added target to run byte compilation to gather warnings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1408
diff changeset
   214
	rm -f dot-emacs.tar $(HTML_FILES) $(ELC_FILES)