-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
64 lines (49 loc) · 1.58 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
EMACS := emacs
PORT ?= 9090
SERVER ?= localhost
SRCDIR ?= ~/.emacs.d/elpa/
BATCH_EMACS=$(EMACS) --batch \
--execute '(add-to-list (quote load-path) "$(shell pwd)")' \
--execute \
'(mapc (lambda (dir) (add-to-list (quote load-path) dir)) \
`(,@(mapcar (lambda (p) (expand-file-name p "$(SRCDIR)")) \
(directory-files "$(SRCDIR)"))))'
ifneq ($(THEME),)
SET_THEME=--eval '(load-theme (quote $(THEME)) t)'
endif
ifneq ($(DOCROOT),)
SET_DOCROOT=--eval '(setq el-sprunge-docroot "$(DOCROOT)")'
endif
# Package variables
NAME=el-sprunge
VERSION=0.$(shell date +%Y%m%d)
DOC="Emacs powered sprunge server"
REQ=((web-server \"20130416.826\") (htmlize \"20130207\"))
DEFPKG="(define-package \"$(NAME)\" \"$(VERSION)\" \n \"$(DOC)\" \n '$(REQ))"
PACKAGE=$(NAME)-$(VERSION)
.PHONY: all src start package clean
SRC=$(wildcard *.el)
all: src
show-path:
$(BATCH_EMACS) --eval "(mapc (lambda (p) (message \"%S\" p)) load-path)"
src: $(SRC)
$(BATCH_EMACS) -f batch-byte-compile $^
%.txt: %
$(BATCH_EMACS) $< -f org-ascii-export-to-ascii
%.html: %
$(BATCH_EMACS) $< -f org-html-export-to-html
$(PACKAGE).tar: $(SRC) README.txt
mkdir $(PACKAGE); \
cp $^ $(PACKAGE); \
mv $(PACKAGE)/README.txt $(PACKAGE)/README; \
echo -e $(DEFPKG) > $(PACKAGE)/$(NAME)-pkg.el; \
tar cf $(PACKAGE).tar $(PACKAGE); \
rm -r $(PACKAGE)
package: $(PACKAGE).tar
start: $(SRC)
$(filter-out --batch, $(BATCH_EMACS)) -Q -l $< \
$(SET_THEME) $(SET_DOCROOT) \
--eval '(setq el-sprunge-servername "$(SERVER)")' \
--eval '(ws-start el-sprunge-handler $(PORT))'
clean:
rm -f $(SRC:.el=.elc) $(NAME)-*.tar