Makefile
author Oleksandr Gavenko <gavenkoa@gmail.com>
Mon, 25 Dec 2023 20:15:49 +0200
changeset 1772 d97be992a1f9
parent 1759 1bbd7898cc9b
permissions -rw-r--r--
Introduced Org state FAILED.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1002
73a5303842e3 Delete target file if command fails.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 908
diff changeset
     1
73a5303842e3 Delete target file if command fails.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 908
diff changeset
     2
################################################################
73a5303842e3 Delete target file if command fails.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 908
diff changeset
     3
# Standard Makefile settings.
73a5303842e3 Delete target file if command fails.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 908
diff changeset
     4
1358
54b0b0bb4570 Move upgrade script to separate file. Add framework to support future upgrades.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1357
diff changeset
     5
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
     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:
1002
73a5303842e3 Delete target file if command fails.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 908
diff changeset
    14
# Delete target file if command fails.
73a5303842e3 Delete target file if command fails.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 908
diff changeset
    15
.DELETE_ON_ERROR:
536
14583eae4848 Added standard Makefile settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 518
diff changeset
    16
# Default target.
14583eae4848 Added standard Makefile settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 518
diff changeset
    17
.DEFAULT_GOAL = all
14583eae4848 Added standard Makefile settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 518
diff changeset
    18
518
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
# Helper definition.
576a7e0fd9e0 Prefer native Windows Emacs, so use it if available.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 386
diff changeset
    21
1241
4f22d9fe2e5b Byte compile '.emacs-my' and 'my/*.el'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1236
diff changeset
    22
curdir := $(realpath .)
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
################################################################
576a7e0fd9e0 Prefer native Windows Emacs, so use it if available.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 386
diff changeset
    25
# Platform/environment definition.
576a7e0fd9e0 Prefer native Windows Emacs, so use it if available.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 386
diff changeset
    26
43
7c9cd891400b Added makefile to install dot-emacs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    27
ifeq '' '$(HOME)'
7c9cd891400b Added makefile to install dot-emacs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    28
  $(error Home env var not set!)
7c9cd891400b Added makefile to install dot-emacs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    29
endif
7c9cd891400b Added makefile to install dot-emacs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    30
379
271ed5d61644 Special case for Windows if emacs-nox from Cygwin installed along with native Emacs.
user@localhost
parents: 318
diff changeset
    31
host_os = unix
271ed5d61644 Special case for Windows if emacs-nox from Cygwin installed along with native Emacs.
user@localhost
parents: 318
diff changeset
    32
ifneq '' '$(COMSPEC)'
752
079c2e27357a Add terget to convert RST to HTML.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 750
diff changeset
    33
  ifneq '' '$(WINDIR)'
079c2e27357a Add terget to convert RST to HTML.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 750
diff changeset
    34
    # Probably under Windows.
079c2e27357a Add terget to convert RST to HTML.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 750
diff changeset
    35
    host_os = windows
079c2e27357a Add terget to convert RST to HTML.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 750
diff changeset
    36
  endif
379
271ed5d61644 Special case for Windows if emacs-nox from Cygwin installed along with native Emacs.
user@localhost
parents: 318
diff changeset
    37
endif
271ed5d61644 Special case for Windows if emacs-nox from Cygwin installed along with native Emacs.
user@localhost
parents: 318
diff changeset
    38
752
079c2e27357a Add terget to convert RST to HTML.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 750
diff changeset
    39
################################################################
1283
9765c6674f79 Add version compatibility checks.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1274
diff changeset
    40
# Installation directories and files.
1199
dff272add01e Move all configs to "~/.emacs.d/my".
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1150
diff changeset
    41
dff272add01e Move all configs to "~/.emacs.d/my".
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1150
diff changeset
    42
emacsdir := $(HOME)/.emacs.d
1666
06937ff1ec5f Moved my elisp modes to dedicated directory to not mixt with init.el.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1665
diff changeset
    43
mylispdir := $(emacsdir)/mylisp
1199
dff272add01e Move all configs to "~/.emacs.d/my".
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1150
diff changeset
    44
1283
9765c6674f79 Add version compatibility checks.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1274
diff changeset
    45
# Compatibility version.
1666
06937ff1ec5f Moved my elisp modes to dedicated directory to not mixt with init.el.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1665
diff changeset
    46
COMPAT_VER := 2
1283
9765c6674f79 Add version compatibility checks.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1274
diff changeset
    47
COMPAT_FILE := $(emacsdir)/.emacs-ver
9765c6674f79 Add version compatibility checks.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1274
diff changeset
    48
1199
dff272add01e Move all configs to "~/.emacs.d/my".
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1150
diff changeset
    49
################################################################
752
079c2e27357a Add terget to convert RST to HTML.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 750
diff changeset
    50
# Build tool definition/switches.
079c2e27357a Add terget to convert RST to HTML.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 750
diff changeset
    51
1659
f91903c43e29 Fixed grammar.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1658
diff changeset
    52
# To byte-compile under Windows register Cygwin Emacs to be first in PATH!
379
271ed5d61644 Special case for Windows if emacs-nox from Cygwin installed along with native Emacs.
user@localhost
parents: 318
diff changeset
    53
EMACS = emacs
271ed5d61644 Special case for Windows if emacs-nox from Cygwin installed along with native Emacs.
user@localhost
parents: 318
diff changeset
    54
752
079c2e27357a Add terget to convert RST to HTML.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 750
diff changeset
    55
RST2HTML = rst2html
079c2e27357a Add terget to convert RST to HTML.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 750
diff changeset
    56
ifeq '$(host_os)' 'windows'
079c2e27357a Add terget to convert RST to HTML.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 750
diff changeset
    57
  RST2HTML = rst2html.py
079c2e27357a Add terget to convert RST to HTML.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 750
diff changeset
    58
endif
079c2e27357a Add terget to convert RST to HTML.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 750
diff changeset
    59
079c2e27357a Add terget to convert RST to HTML.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 750
diff changeset
    60
################################################################
079c2e27357a Add terget to convert RST to HTML.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 750
diff changeset
    61
# Proj dirs/files.
079c2e27357a Add terget to convert RST to HTML.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 750
diff changeset
    62
1666
06937ff1ec5f Moved my elisp modes to dedicated directory to not mixt with init.el.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1665
diff changeset
    63
EL_FILES := $(wildcard mylisp/*.el)
1519
7b320068aa6b Added target to run byte compilation to gather warnings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1408
diff changeset
    64
ELC_FILES := $(EL_FILES:.el=.elc)
752
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
RST_FILES := $(wildcard *.rst)
079c2e27357a Add terget to convert RST to HTML.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 750
diff changeset
    67
HTML_FILES := $(RST_FILES:.rst=.html)
079c2e27357a Add terget to convert RST to HTML.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 750
diff changeset
    68
518
576a7e0fd9e0 Prefer native Windows Emacs, so use it if available.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 386
diff changeset
    69
################################################################
576a7e0fd9e0 Prefer native Windows Emacs, so use it if available.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 386
diff changeset
    70
# Targets.
576a7e0fd9e0 Prefer native Windows Emacs, so use it if available.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 386
diff changeset
    71
260
437507e141b4 Write .PHONY exactly before target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 165
diff changeset
    72
.PHONY: all
43
7c9cd891400b Added makefile to install dot-emacs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    73
all: install
7c9cd891400b Added makefile to install dot-emacs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    74
750
db9827b0fdf5 Add some headlines.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 700
diff changeset
    75
################################################################
1369
afb2d0fd7999 Deploy targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1362
diff changeset
    76
# Deploy targets.
afb2d0fd7999 Deploy targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1362
diff changeset
    77
afb2d0fd7999 Deploy targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1362
diff changeset
    78
.PHONY: deploy
afb2d0fd7999 Deploy targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1362
diff changeset
    79
deploy: deploy2defun deploy2sf
afb2d0fd7999 Deploy targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1362
diff changeset
    80
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
DEFUN_USER ?= user
afb2d0fd7999 Deploy targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1362
diff changeset
    83
DEFUN_HG_SRV ?= hg.defun.work
afb2d0fd7999 Deploy targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1362
diff changeset
    84
DEFUN_HG_DIR ?= /srv/hg/dot-emacs
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
.PHONY: deploy2defun
afb2d0fd7999 Deploy targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1362
diff changeset
    87
deploy2defun: deploy2defun-src
afb2d0fd7999 Deploy targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1362
diff changeset
    88
afb2d0fd7999 Deploy targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1362
diff changeset
    89
.PHONY: deploy2defun-src
afb2d0fd7999 Deploy targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1362
diff changeset
    90
deploy2defun-src:
afb2d0fd7999 Deploy targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1362
diff changeset
    91
	hg push ssh://$(DEFUN_USER)@$(DEFUN_HG_SRV)/$(DEFUN_HG_DIR) || [ $$? = 1 ]
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
afb2d0fd7999 Deploy targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1362
diff changeset
    94
SF_USER ?= gavenkoa
afb2d0fd7999 Deploy targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1362
diff changeset
    95
afb2d0fd7999 Deploy targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1362
diff changeset
    96
.PHONY: deploy2sf
afb2d0fd7999 Deploy targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1362
diff changeset
    97
deploy2sf: deploy2sf-src
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
.PHONY: deploy2sf-src
afb2d0fd7999 Deploy targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1362
diff changeset
   100
deploy2sf-src:
afb2d0fd7999 Deploy targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1362
diff changeset
   101
	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
   102
afb2d0fd7999 Deploy targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1362
diff changeset
   103
################################################################
750
db9827b0fdf5 Add some headlines.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 700
diff changeset
   104
# Install/uninstall targets.
db9827b0fdf5 Add some headlines.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 700
diff changeset
   105
1665
3685e2321a9b Made "upgrade" target idempotent and added it as dependency to "install".
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1664
diff changeset
   106
ifneq '' '$(filter upgrade,$(MAKECMDGOALS))'
3685e2321a9b Made "upgrade" target idempotent and added it as dependency to "install".
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1664
diff changeset
   107
  ifeq '' '$(filter install%,$(MAKECMDGOALS))'
3685e2321a9b Made "upgrade" target idempotent and added it as dependency to "install".
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1664
diff changeset
   108
    $(error "upgrade" should be invoked from "install")
3685e2321a9b Made "upgrade" target idempotent and added it as dependency to "install".
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1664
diff changeset
   109
  endif
3685e2321a9b Made "upgrade" target idempotent and added it as dependency to "install".
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1664
diff changeset
   110
endif
1283
9765c6674f79 Add version compatibility checks.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1274
diff changeset
   111
1358
54b0b0bb4570 Move upgrade script to separate file. Add framework to support future upgrades.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1357
diff changeset
   112
.PHONY: upgrade
54b0b0bb4570 Move upgrade script to separate file. Add framework to support future upgrades.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1357
diff changeset
   113
upgrade:
1283
9765c6674f79 Add version compatibility checks.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1274
diff changeset
   114
	\
1665
3685e2321a9b Made "upgrade" target idempotent and added it as dependency to "install".
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1664
diff changeset
   115
if [[ -f ~/.emacs ]]; then \
3685e2321a9b Made "upgrade" target idempotent and added it as dependency to "install".
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1664
diff changeset
   116
  echo An old style install detected, delete ~/.emacs first.; \
3685e2321a9b Made "upgrade" target idempotent and added it as dependency to "install".
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1664
diff changeset
   117
  false; \
3685e2321a9b Made "upgrade" target idempotent and added it as dependency to "install".
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1664
diff changeset
   118
fi
3685e2321a9b Made "upgrade" target idempotent and added it as dependency to "install".
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1664
diff changeset
   119
	\
1664
72275301c19d Do not apply migration is there is no ~/.emacs.d/.emacs-ver file.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1663
diff changeset
   120
[[ -f $(COMPAT_FILE) ]] || exit 0; \
72275301c19d Do not apply migration is there is no ~/.emacs.d/.emacs-ver file.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1663
diff changeset
   121
read ver <$(COMPAT_FILE); \
72275301c19d Do not apply migration is there is no ~/.emacs.d/.emacs-ver file.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1663
diff changeset
   122
if [[ "$$ver" -gt $(COMPAT_VER) ]]; then \
72275301c19d Do not apply migration is there is no ~/.emacs.d/.emacs-ver file.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1663
diff changeset
   123
  echo "*** "Project is too old, downgrade is not possible..." ***"; \
72275301c19d Do not apply migration is there is no ~/.emacs.d/.emacs-ver file.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1663
diff changeset
   124
  exit 1; \
1358
54b0b0bb4570 Move upgrade script to separate file. Add framework to support future upgrades.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1357
diff changeset
   125
fi; \
54b0b0bb4570 Move upgrade script to separate file. Add framework to support future upgrades.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1357
diff changeset
   126
for ((i=ver+1; i <= $(COMPAT_VER); i++)); do \
1663
a0494ee73d5f Set installation dir explicitly in upgrade script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1661
diff changeset
   127
  $(SHELL) upgrade/$$i.bash; \
1358
54b0b0bb4570 Move upgrade script to separate file. Add framework to support future upgrades.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1357
diff changeset
   128
done
1199
dff272add01e Move all configs to "~/.emacs.d/my".
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1150
diff changeset
   129
268
b2cd8fbe5ec3 Install mode file under '.emacs.d' dir.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 267
diff changeset
   130
.PHONY: install-all
b2cd8fbe5ec3 Install mode file under '.emacs.d' dir.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 267
diff changeset
   131
install-all: install
1667
7f70095fbf32 Use command "install -m ..." instead "cp" in many occasions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1666
diff changeset
   132
	install -m 0644 -t $(emacsdir) .emacs-pre .emacs-post
164
d7ed163b397e Added installation of template for -pre/-post scripts.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 111
diff changeset
   133
1687
3f69332472cb Added Make target to preinstall packages from ELPA.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1681
diff changeset
   134
.PHONY: install-packages
3f69332472cb Added Make target to preinstall packages from ELPA.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1681
diff changeset
   135
install-packages:
3f69332472cb Added Make target to preinstall packages from ELPA.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1681
diff changeset
   136
	$(EMACS) --batch -l "$(curdir)/.emacs-defs" -f my-lisp--install-external-packages
3f69332472cb Added Make target to preinstall packages from ELPA.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1681
diff changeset
   137
268
b2cd8fbe5ec3 Install mode file under '.emacs.d' dir.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 267
diff changeset
   138
.PHONY: install
1665
3685e2321a9b Made "upgrade" target idempotent and added it as dependency to "install".
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1664
diff changeset
   139
install: upgrade
1681
c3e2faa4f118 Simplified cleanup of "mylispdir".
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1675
diff changeset
   140
	rm -rf $(mylispdir)
1199
dff272add01e Move all configs to "~/.emacs.d/my".
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1150
diff changeset
   141
	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
   142
	echo $(COMPAT_VER) >$(COMPAT_FILE)
1667
7f70095fbf32 Use command "install -m ..." instead "cp" in many occasions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1666
diff changeset
   143
	for f in .emacs-pre .emacs-post; do \
7f70095fbf32 Use command "install -m ..." instead "cp" in many occasions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1666
diff changeset
   144
		[[ -f $(emacsdir)/$$f ]] || install -m 0644 $$f $(emacsdir)/$$f; \
93
99f967be941a Rename files .emacs-my-custom* to .emacs-my*.
"Oleksandr Gavenko <gavenkoa@gmail.com>"
parents: 45
diff changeset
   145
	done
1667
7f70095fbf32 Use command "install -m ..." instead "cp" in many occasions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1666
diff changeset
   146
	install -m 0644 -t $(emacsdir) .emacs-defs init.el .emacs-my
1713
a2f35bf9a928 Moved Gnus's all.SCORE to separate project as it reveals some private data.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1687
diff changeset
   147
	mkdir -p $(emacsdir)/server
1661
e4711ae3529f Launch .emacs-autogen.sh with predefined SHELL.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1659
diff changeset
   148
	$(SHELL) .emacs-autogen.sh $(emacsdir)/.emacs-autogen
1668
1d87a245ab55 Do not byte compile .emacs-my during installation. Compilation code moved to separate target useful warnings are reported during compilation.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1667
diff changeset
   149
	cp -r srecode/ $(HOME)/.emacs.d/
1297
b638d2b23ec9 Use built-in options for elisp actions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1295
diff changeset
   150
	\
1667
7f70095fbf32 Use command "install -m ..." instead "cp" in many occasions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1666
diff changeset
   151
install -m 0644 -t $(mylispdir) $(EL_FILES); \
1759
1bbd7898cc9b Ported Makefile to MSYS2: Emacs is native here and cannot deal with MSYS2-style paths.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1718
diff changeset
   152
cd $(mylispdir); \
1bbd7898cc9b Ported Makefile to MSYS2: Emacs is native here and cannot deal with MSYS2-style paths.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1718
diff changeset
   153
$(EMACS) --batch -Q --eval='(progn (setq generated-autoload-file "./loaddefs.el") (update-directory-autoloads "."))'
164
d7ed163b397e Added installation of template for -pre/-post scripts.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 111
diff changeset
   154
269
81c80df45b37 Udded uninstall target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 268
diff changeset
   155
.PHONY: uninstall
81c80df45b37 Udded uninstall target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 268
diff changeset
   156
uninstall:
1272
496846754331 Update 'uninstall' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1271
diff changeset
   157
	rm -f $(patsubst %,$(emacsdir)/%, init.el .emacs-defs .emacs-my .emacs-autogen)
1681
c3e2faa4f118 Simplified cleanup of "mylispdir".
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1675
diff changeset
   158
	rm -rf $(mylispdir)
1199
dff272add01e Move all configs to "~/.emacs.d/my".
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1150
diff changeset
   159
	rm -f -r $(emacsdir)/srecode
269
81c80df45b37 Udded uninstall target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 268
diff changeset
   160
260
437507e141b4 Write .PHONY exactly before target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 165
diff changeset
   161
.PHONY: tar
165
9f5dd505a4cf Correct target name.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 164
diff changeset
   162
tar:
85
2bb7e6aceac9 Added target dist-tar.
gavenkoa@gavenko.bifit.int
parents: 45
diff changeset
   163
	tar cf dot-emacs.tar .emacs .emacs-my
86
0cf1b0216dac Added target clean.
gavenkoa@gavenko.bifit.int
parents: 85
diff changeset
   164
750
db9827b0fdf5 Add some headlines.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 700
diff changeset
   165
################################################################
1519
7b320068aa6b Added target to run byte compilation to gather warnings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1408
diff changeset
   166
# Check targets.
7b320068aa6b Added target to run byte compilation to gather warnings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1408
diff changeset
   167
7b320068aa6b Added target to run byte compilation to gather warnings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1408
diff changeset
   168
.PHONY: check
1668
1d87a245ab55 Do not byte compile .emacs-my during installation. Compilation code moved to separate target useful warnings are reported during compilation.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1667
diff changeset
   169
check: check-byte-compile-modes check-byte-compile-dot-emacs
1519
7b320068aa6b Added target to run byte compilation to gather warnings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1408
diff changeset
   170
1668
1d87a245ab55 Do not byte compile .emacs-my during installation. Compilation code moved to separate target useful warnings are reported during compilation.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1667
diff changeset
   171
.PHONY: check-byte-compile-modes
1d87a245ab55 Do not byte compile .emacs-my during installation. Compilation code moved to separate target useful warnings are reported during compilation.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1667
diff changeset
   172
check-byte-compile-modes:
1519
7b320068aa6b Added target to run byte compilation to gather warnings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1408
diff changeset
   173
	\
1666
06937ff1ec5f Moved my elisp modes to dedicated directory to not mixt with init.el.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1665
diff changeset
   174
$(EMACS) -f package-initialize --eval '(push "mylisp" load-path)'  --batch -f batch-byte-compile $(EL_FILES) || :
1519
7b320068aa6b Added target to run byte compilation to gather warnings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1408
diff changeset
   175
	rm -f $(ELC_FILES)
7b320068aa6b Added target to run byte compilation to gather warnings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1408
diff changeset
   176
1668
1d87a245ab55 Do not byte compile .emacs-my during installation. Compilation code moved to separate target useful warnings are reported during compilation.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1667
diff changeset
   177
.PHONY: check-byte-compile-dot-emacs
1d87a245ab55 Do not byte compile .emacs-my during installation. Compilation code moved to separate target useful warnings are reported during compilation.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1667
diff changeset
   178
check-byte-compile-dot-emacs:
1675
08f7fd3c4d5b Load more files for byte compilation check. Switched to my-lisp-* prefix.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1672
diff changeset
   179
	$(EMACS) --batch --load "$(curdir)/.emacs-defs" -f 'my-lisp--load-all' --eval='(byte-compile-file ".emacs-my")'
1668
1d87a245ab55 Do not byte compile .emacs-my during installation. Compilation code moved to separate target useful warnings are reported during compilation.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1667
diff changeset
   180
	rm -f .emacs-my.elc
1d87a245ab55 Do not byte compile .emacs-my during installation. Compilation code moved to separate target useful warnings are reported during compilation.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1667
diff changeset
   181
1519
7b320068aa6b Added target to run byte compilation to gather warnings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1408
diff changeset
   182
################################################################
752
079c2e27357a Add terget to convert RST to HTML.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 750
diff changeset
   183
# Documentation targets.
079c2e27357a Add terget to convert RST to HTML.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 750
diff changeset
   184
079c2e27357a Add terget to convert RST to HTML.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 750
diff changeset
   185
.PHONY: html
079c2e27357a Add terget to convert RST to HTML.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 750
diff changeset
   186
html: $(HTML_FILES)
079c2e27357a Add terget to convert RST to HTML.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 750
diff changeset
   187
079c2e27357a Add terget to convert RST to HTML.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 750
diff changeset
   188
$(HTML_FILES): %.html: %.rst
079c2e27357a Add terget to convert RST to HTML.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 750
diff changeset
   189
	$(RST2HTML) --stylesheet=rst.css $*.rst $@
079c2e27357a Add terget to convert RST to HTML.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 750
diff changeset
   190
079c2e27357a Add terget to convert RST to HTML.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 750
diff changeset
   191
################################################################
750
db9827b0fdf5 Add some headlines.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 700
diff changeset
   192
# Clean targets.
db9827b0fdf5 Add some headlines.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 700
diff changeset
   193
260
437507e141b4 Write .PHONY exactly before target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 165
diff changeset
   194
.PHONY: distclean
437507e141b4 Write .PHONY exactly before target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 165
diff changeset
   195
distclean: clean
437507e141b4 Write .PHONY exactly before target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 165
diff changeset
   196
437507e141b4 Write .PHONY exactly before target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 165
diff changeset
   197
.PHONY: clean
86
0cf1b0216dac Added target clean.
gavenkoa@gavenko.bifit.int
parents: 85
diff changeset
   198
clean:
1519
7b320068aa6b Added target to run byte compilation to gather warnings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1408
diff changeset
   199
	rm -f dot-emacs.tar $(HTML_FILES) $(ELC_FILES)