-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
58 lines (41 loc) · 1.3 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
# Set config folder path
SRC_DIR=$(shell pwd)
# Source file
SRC_FILE=$(SRC_DIR)/emacs.org
# Destination file
DEST_FILE=$(SRC_DIR)/emacs.el
# Destination directory
DEST_DIR=$(SRC_DIR)/lisp
# EMACS_BINARY should point to your installation of GNU emacs. I compile from dev builds.
EMACS_BINARY=/usr/local/bin/emacs
# The following will compile emacs.org to emacs.el
EMACS=$(shell $(EMACS_BINARY) -nw --batch --eval "(require 'org)" --eval "(org-babel-load-file \"emacs.org\")")
.PHONY: test build clean help install
## help: Output this message and exit
help:
@fgrep -h '##' $(MAKEFILE_LIST) | fgrep -v fgrep | column -t -s ':' | sed -e 's/## //'
## all: Main Rule
all: build
setup-dest-dir:
mkdir -p $(DEST_DIR)
## build: Generate and compile lisp
build: setup-dest-dir |
$(EMACS)
## test: Test init file
test: build;
$(shell $(EMACS_BINARY) -nw -Q -l $(DEST_FILE))
## test: Test init file
print-test:
echo $(EMACS_BINARY) -nw -Q -l $(DEST_FILE)
## test-gui: Test gui version (if installed)
test-gui:
$(shell $(EMACS_BINARY) -Q -l $(DEST_FILE))
## clean: Clean up
clean:
rm -rf $(DEST_DIR) $(DEST_FILE)
## install: Move files to .emacs.d
install:
cp $(SRC_FILE) $(HOME)/.emacs.d
cp $(SRC_DIR)/Makefile $(HOME)/.emacs.d
cd $(HOME)/.emacs.d && make build
mv $(HOME)/.emacs.d/emacs.el $(HOME)/.emacs.d/init.el