Makefile
author Oleksandr Gavenko <gavenkoa@gmail.com>
Tue, 18 Jan 2011 00:03:25 +0200
changeset 542 22eb7a31b689
parent 536 14583eae4848
child 581 5e3a485408f4
permissions -rw-r--r--
Speedup find-dired.
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
536
14583eae4848 Added standard Makefile settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 518
diff changeset
     5
SHELL = /bin/sh
14583eae4848 Added standard Makefile settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 518
diff changeset
     6
14583eae4848 Added standard Makefile settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 518
diff changeset
     7
# Disable built in pattern rules.
14583eae4848 Added standard Makefile settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 518
diff changeset
     8
MAKEFLAGS += -r
14583eae4848 Added standard Makefile settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 518
diff changeset
     9
# Disable built in variables.
14583eae4848 Added standard Makefile settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 518
diff changeset
    10
MAKEFLAGS += -R
14583eae4848 Added standard Makefile settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 518
diff changeset
    11
# Disable built in suffix rules.
14583eae4848 Added standard Makefile settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 518
diff changeset
    12
.SUFFIXES:
14583eae4848 Added standard Makefile settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 518
diff changeset
    13
# Default target.
14583eae4848 Added standard Makefile settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 518
diff changeset
    14
.DEFAULT_GOAL = all
14583eae4848 Added standard Makefile settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 518
diff changeset
    15
518
576a7e0fd9e0 Prefer native Windows Emacs, so use it if available.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 386
diff changeset
    16
################################################################
576a7e0fd9e0 Prefer native Windows Emacs, so use it if available.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 386
diff changeset
    17
# Helper definition.
576a7e0fd9e0 Prefer native Windows Emacs, so use it if available.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 386
diff changeset
    18
576a7e0fd9e0 Prefer native Windows Emacs, so use it if available.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 386
diff changeset
    19
which = $(firstword $(foreach item,$(subst :, ,$(PATH)),$(wildcard $(item)/$1)))
576a7e0fd9e0 Prefer native Windows Emacs, so use it if available.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 386
diff changeset
    20
576a7e0fd9e0 Prefer native Windows Emacs, so use it if available.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 386
diff changeset
    21
################################################################
576a7e0fd9e0 Prefer native Windows Emacs, so use it if available.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 386
diff changeset
    22
# Platform/environment definition.
576a7e0fd9e0 Prefer native Windows Emacs, so use it if available.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 386
diff changeset
    23
43
7c9cd891400b Added makefile to install dot-emacs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    24
ifeq '' '$(HOME)'
7c9cd891400b Added makefile to install dot-emacs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    25
  $(error Home env var not set!)
7c9cd891400b Added makefile to install dot-emacs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    26
endif
7c9cd891400b Added makefile to install dot-emacs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    27
379
271ed5d61644 Special case for Windows if emacs-nox from Cygwin installed along with native Emacs.
user@localhost
parents: 318
diff changeset
    28
host_os = unix
271ed5d61644 Special case for Windows if emacs-nox from Cygwin installed along with native Emacs.
user@localhost
parents: 318
diff changeset
    29
ifneq '' '$(COMSPEC)'
271ed5d61644 Special case for Windows if emacs-nox from Cygwin installed along with native Emacs.
user@localhost
parents: 318
diff changeset
    30
  host_os = windows
271ed5d61644 Special case for Windows if emacs-nox from Cygwin installed along with native Emacs.
user@localhost
parents: 318
diff changeset
    31
endif
271ed5d61644 Special case for Windows if emacs-nox from Cygwin installed along with native Emacs.
user@localhost
parents: 318
diff changeset
    32
271ed5d61644 Special case for Windows if emacs-nox from Cygwin installed along with native Emacs.
user@localhost
parents: 318
diff changeset
    33
EMACS = emacs
518
576a7e0fd9e0 Prefer native Windows Emacs, so use it if available.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 386
diff changeset
    34
# I prefer native Windows Emacs, so use it if available.
379
271ed5d61644 Special case for Windows if emacs-nox from Cygwin installed along with native Emacs.
user@localhost
parents: 318
diff changeset
    35
ifeq 'windows' '$(host_os)'
518
576a7e0fd9e0 Prefer native Windows Emacs, so use it if available.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 386
diff changeset
    36
  ifneq '' '$(call which,runemacs.exe)'
576a7e0fd9e0 Prefer native Windows Emacs, so use it if available.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 386
diff changeset
    37
    EMACS = runemacs
576a7e0fd9e0 Prefer native Windows Emacs, so use it if available.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 386
diff changeset
    38
  endif
379
271ed5d61644 Special case for Windows if emacs-nox from Cygwin installed along with native Emacs.
user@localhost
parents: 318
diff changeset
    39
endif
271ed5d61644 Special case for Windows if emacs-nox from Cygwin installed along with native Emacs.
user@localhost
parents: 318
diff changeset
    40
518
576a7e0fd9e0 Prefer native Windows Emacs, so use it if available.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 386
diff changeset
    41
################################################################
576a7e0fd9e0 Prefer native Windows Emacs, so use it if available.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 386
diff changeset
    42
# Targets.
576a7e0fd9e0 Prefer native Windows Emacs, so use it if available.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 386
diff changeset
    43
318
6a430707c23e Store all files in current dir for easy access to they.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 279
diff changeset
    44
FILES_MODE_EL := $(wildcard *-mode.el)
6a430707c23e Store all files in current dir for easy access to they.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 279
diff changeset
    45
260
437507e141b4 Write .PHONY exactly before target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 165
diff changeset
    46
.PHONY: all
43
7c9cd891400b Added makefile to install dot-emacs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    47
all: install
7c9cd891400b Added makefile to install dot-emacs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    48
268
b2cd8fbe5ec3 Install mode file under '.emacs.d' dir.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 267
diff changeset
    49
.PHONY: install-all
b2cd8fbe5ec3 Install mode file under '.emacs.d' dir.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 267
diff changeset
    50
install-all: install
b2cd8fbe5ec3 Install mode file under '.emacs.d' dir.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 267
diff changeset
    51
	cp .emacs-pre $(HOME)/.emacs-pre
b2cd8fbe5ec3 Install mode file under '.emacs.d' dir.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 267
diff changeset
    52
	cp .emacs-post $(HOME)/.emacs-post
164
d7ed163b397e Added installation of template for -pre/-post scripts.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 111
diff changeset
    53
268
b2cd8fbe5ec3 Install mode file under '.emacs.d' dir.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 267
diff changeset
    54
.PHONY: install
318
6a430707c23e Store all files in current dir for easy access to they.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 279
diff changeset
    55
install: .emacs .emacs-my .emacs-pre .emacs-post $(FILES_MODE_EL)
111
fcea9d3b79e1 Rename -my{-pre/-post} to {-pre/-post}.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 103
diff changeset
    56
	for file in .emacs-pre .emacs-post; do \
93
99f967be941a Rename files .emacs-my-custom* to .emacs-my*.
"Oleksandr Gavenko <gavenkoa@gmail.com>"
parents: 45
diff changeset
    57
		if [ ! -f $(HOME)/$$file ]; then cp $$file $(HOME)/$$file; fi; \
99f967be941a Rename files .emacs-my-custom* to .emacs-my*.
"Oleksandr Gavenko <gavenkoa@gmail.com>"
parents: 45
diff changeset
    58
	done
103
7c16c6cab2b0 By default .emacs also overwrite.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 96
diff changeset
    59
	cp .emacs $(HOME)/.emacs
386
3efe37437745 Explore environment for abilities and tup config in ~/.emacs-autogen.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 379
diff changeset
    60
	cp .emacs-autogen $(HOME)/.emacs-autogen
3efe37437745 Explore environment for abilities and tup config in ~/.emacs-autogen.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 379
diff changeset
    61
	sh .emacs-autogen.sh $(HOME)/.emacs-autogen
93
99f967be941a Rename files .emacs-my-custom* to .emacs-my*.
"Oleksandr Gavenko <gavenkoa@gmail.com>"
parents: 45
diff changeset
    62
	cp .emacs-my $(HOME)/.emacs-my
275
3af8c9807cbf Added autoload generation.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 270
diff changeset
    63
	rm -f -r $(HOME)/.emacs.d/my-lisp
3af8c9807cbf Added autoload generation.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 270
diff changeset
    64
	mkdir -p $(HOME)/.emacs.d/my-lisp
318
6a430707c23e Store all files in current dir for easy access to they.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 279
diff changeset
    65
	for file in $(FILES_MODE_EL); do \
275
3af8c9807cbf Added autoload generation.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 270
diff changeset
    66
		cp -f $$file $(HOME)/.emacs.d/my-lisp; \
164
d7ed163b397e Added installation of template for -pre/-post scripts.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 111
diff changeset
    67
	done
379
271ed5d61644 Special case for Windows if emacs-nox from Cygwin installed along with native Emacs.
user@localhost
parents: 318
diff changeset
    68
	$(EMACS) --batch \
275
3af8c9807cbf Added autoload generation.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 270
diff changeset
    69
		--eval='(let ( (generated-autoload-file "~/.emacs.d/my-lisp/autoload-my.el") ) (update-directory-autoloads "~/.emacs.d/my-lisp") )'
164
d7ed163b397e Added installation of template for -pre/-post scripts.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 111
diff changeset
    70
269
81c80df45b37 Udded uninstall target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 268
diff changeset
    71
.PHONY: uninstall
81c80df45b37 Udded uninstall target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 268
diff changeset
    72
uninstall:
81c80df45b37 Udded uninstall target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 268
diff changeset
    73
	@echo !!! Nothing done !!!
81c80df45b37 Udded uninstall target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 268
diff changeset
    74
260
437507e141b4 Write .PHONY exactly before target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 165
diff changeset
    75
.PHONY: tar
165
9f5dd505a4cf Correct target name.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 164
diff changeset
    76
tar:
85
2bb7e6aceac9 Added target dist-tar.
gavenkoa@gavenko.bifit.int
parents: 45
diff changeset
    77
	tar cf dot-emacs.tar .emacs .emacs-my
86
0cf1b0216dac Added target clean.
gavenkoa@gavenko.bifit.int
parents: 85
diff changeset
    78
260
437507e141b4 Write .PHONY exactly before target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 165
diff changeset
    79
.PHONY: distclean
437507e141b4 Write .PHONY exactly before target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 165
diff changeset
    80
distclean: clean
437507e141b4 Write .PHONY exactly before target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 165
diff changeset
    81
437507e141b4 Write .PHONY exactly before target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 165
diff changeset
    82
.PHONY: clean
86
0cf1b0216dac Added target clean.
gavenkoa@gavenko.bifit.int
parents: 85
diff changeset
    83
clean:
0cf1b0216dac Added target clean.
gavenkoa@gavenko.bifit.int
parents: 85
diff changeset
    84
	rm -f dot-emacs.tar