Some symbols from default composition rules cause Emacs redisplay hang on Windows.
# Copyright (C) 2008-2010 by Oleksandr Gavenko <gavenkoa@gmail.com>
#
# You can do anything with this file without any warranty.
################################################################
# Standard Makefile settings.
SHELL = /bin/bash
export PATH := /bin:/usr/bin:${PATH}
# Disable built in pattern rules.
MAKEFLAGS += -r
# Disable built in variables.
MAKEFLAGS += -R
# Disable built in suffix rules.
.SUFFIXES:
# Delete target file if command fails.
.DELETE_ON_ERROR:
# Default target.
.DEFAULT_GOAL = all
################################################################
# Helper definition.
which = $(firstword $(foreach item,$(subst :, ,$(PATH)),$(wildcard $(item)/$1)))
curdir := $(realpath .)
################################################################
# Platform/environment definition.
ifeq '' '$(HOME)'
$(error Home env var not set!)
endif
host_os = unix
ifneq '' '$(COMSPEC)'
ifneq '' '$(WINDIR)'
# Probably under Windows.
host_os = windows
endif
endif
################################################################
# Installation directories and files.
emacsdir := $(HOME)/.emacs.d
mylispdir := $(emacsdir)/my
# Compatibility version.
COMPAT_VER := 1
COMPAT_FILE := $(emacsdir)/.emacs-ver
################################################################
# Build tool definition/switches.
# In order to byte-compile under Windows install Cygwin Emacs to PATH!
EMACS = emacs
RST2HTML = rst2html
ifeq '$(host_os)' 'windows'
RST2HTML = rst2html.py
endif
################################################################
# Proj dirs/files.
EL_FILES := $(wildcard *.el)
ELC_FILES := $(EL_FILES:.el=.elc)
RST_FILES := $(wildcard *.rst)
HTML_FILES := $(RST_FILES:.rst=.html)
################################################################
# Targets.
.PHONY: all
all: install
################################################################
# Deploy targets.
.PHONY: deploy
deploy: deploy2defun deploy2sf
DEFUN_USER ?= user
DEFUN_HG_SRV ?= hg.defun.work
DEFUN_HG_DIR ?= /srv/hg/dot-emacs
.PHONY: deploy2defun
deploy2defun: deploy2defun-src
.PHONY: deploy2defun-src
deploy2defun-src:
hg push ssh://$(DEFUN_USER)@$(DEFUN_HG_SRV)/$(DEFUN_HG_DIR) || [ $$? = 1 ]
SF_USER ?= gavenkoa
.PHONY: deploy2sf
deploy2sf: deploy2sf-src
.PHONY: deploy2sf-src
deploy2sf-src:
hg push ssh://$(SF_USER)@hg.code.sf.net/u/$(SF_USER)/dot-emacs || [ $$? = 1 ]
################################################################
# Install/uninstall targets.
.PHONY: check-install-comapt
check-install-comapt:
\
if [ -f ~/.emacs ]; then \
echo Old style install detected, run '"$(MAKE) upgrade"' first; \
false; \
fi
\
if [ -f $(emacsdir)/init.el ]; then \
if [ ! -f $(COMPAT_FILE) ]; then \
echo $(COMPAT_FILE) missing, run '"$(MAKE) upgrade"' first; \
exit 1; \
fi; \
fi
read ver <$(COMPAT_FILE); if [ "$$ver" -ne $(COMPAT_VER) ]; then echo "*** "Run '"$(MAKE) upgrade"' first" ***"; exit 1; fi
.PHONY: upgrade
upgrade:
\
if [ -f $(COMPAT_FILE) ]; then \
read ver <$(COMPAT_FILE); \
if [ "$$ver" -gt $(COMPAT_VER) ]; then \
echo "*** "Project is too old, downgrade is not possible..." ***"; \
exit 1; \
fi; \
else \
ver=0; \
fi; \
for ((i=ver+1; i <= $(COMPAT_VER); i++)); do \
$(SHELL) upgrade/$$i.bash $(emacsdir); \
done
$(MAKE) install
.PHONY: install-all
install-all: install
cp .emacs-pre $(emacsdir)/.emacs-pre
cp .emacs-post $(emacsdir)/.emacs-post
define cleanup_mylispdir
find $(mylispdir) -type f '(' -name '*.el' -o -name '*.elc' -o -name '*~' ')' -exec rm {} ';'
endef
.PHONY: install
install: check-install-comapt
mkdir -p $(mylispdir)
echo $(COMPAT_VER) >$(COMPAT_FILE)
$(cleanup_mylispdir)
for file in .emacs-pre .emacs-post; do \
[ -f $(emacsdir)/$$file ] || cp $$file $(emacsdir)/$$file; \
done
\
cp .emacs-defs init.el .emacs-my $(emacsdir)
\
mkdir -p $(emacsdir)/server $(HOME)/.gnus/scores; \
cp all.SCORE $(HOME)/.gnus/scores
\
cp -f $(EL_FILES) $(mylispdir); \
./.emacs-autogen.sh $(emacsdir)/.emacs-autogen; \
$(EMACS) --batch -Q --eval='(let ((generated-autoload-file "$(mylispdir)/loaddefs.el")) (update-directory-autoloads "$(mylispdir)"))'
\
$(EMACS) --batch --load "$(curdir)/.emacs-defs" -f 'my-load.add-my-loadpaths' --load "$(emacsdir)/.emacs-pre" \
--eval='(byte-compile-file "$(emacsdir)/.emacs-my")' --eval='(byte-force-recompile "$(mylispdir)")'
cp -r srecode/ $(HOME)/.emacs.d/
.PHONY: uninstall
uninstall:
rm -f $(patsubst %,$(emacsdir)/%, init.el .emacs-defs .emacs-my .emacs-autogen)
$(cleanup_mylispdir)
rm -f -r $(emacsdir)/srecode
.PHONY: tar
tar:
tar cf dot-emacs.tar .emacs .emacs-my
################################################################
# Check targets.
.PHONY: check
check: check-byte-compile
.PHONY: check-byte-compile
check-byte-compile:
\
$(EMACS) -f package-initialize --eval '(push "." load-path)' --batch -f batch-byte-compile $(filter-out init.el,$(EL_FILES)) || :
rm -f $(ELC_FILES)
################################################################
# Documentation targets.
.PHONY: html
html: $(HTML_FILES)
$(HTML_FILES): %.html: %.rst
$(RST2HTML) --stylesheet=rst.css $*.rst $@
################################################################
# Clean targets.
.PHONY: distclean
distclean: clean
.PHONY: clean
clean:
rm -f dot-emacs.tar $(HTML_FILES) $(ELC_FILES)