-
Notifications
You must be signed in to change notification settings - Fork 30
/
Copy pathMakefile
47 lines (35 loc) · 1.14 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
EMACS := emacs
BATCH=$(EMACS) --batch --execute '(add-to-list (quote load-path) "$(shell pwd)")'
SRC=$(wildcard *.el)
ELC=$(SRC:.el=.elc)
.PHONY: src doc check clean
all: src doc
src: $(SRC)
$(BATCH) -f batch-byte-compile $^
doc:
$(MAKE) -C doc/
doc/web-server.info:
$(MAKE) -C doc/ web-server.info
doc/dir:
$(MAKE) -C doc/ dir
check: $(SRC)
$(BATCH) -l cl -l ert -l web-server-test -f ert-run-tests-batch-and-exit
clean:
rm -rf $(ELC) $(PACKAGE) $(PACKAGE).tar
$(MAKE) -C doc/ $(MAKECMDGOALS)
# Packaging
PARSE=grep "$(1):" web-server.el|sed 's/^.*$(1): //'
NAME=web-server
VERSION=$(shell $(call PARSE,Version))
DOC=$(shell head -1 web-server.el|sed 's/^.*--- //')
REQ=$(shell $(call PARSE,Package-Requires))
DEFPKG=(define-package "$(NAME)" "$(VERSION)"\n "$(DOC)"\n (quote $(REQ)))
PACKAGE=$(NAME)-$(VERSION)
$(PACKAGE): $(filter-out web-server-test.el, $(SRC)) doc/web-server.info doc/dir
mkdir -p $(PACKAGE)
cp $^ $(PACKAGE)
sed -n '/;;; Commentary:/,/;;; Code:/p' web-server.el|tail -n+3|head -n-2|cut -c4- >$(PACKAGE)/README
echo -e '$(DEFPKG)' > $(PACKAGE)/$(NAME)-pkg.el
$(PACKAGE).tar: $(PACKAGE)
tar cf $@ $<
package: $(PACKAGE).tar