aboutsummaryrefslogtreecommitdiff
path: root/emacsen/Makefile
blob: 19702dabe7f643d5073999fffaae6f8ef11049cc (plain) (blame)
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
ROOT=$(shell pwd)/..
export ROOT
EMACSD=$(ROOT)/build/.emacs.d/
export ELISPDIR
EMACSEN=$(ROOT)/emacsen

SUBDIRS = auto-complete \
	  auto-indent-mode \
	  bbdb \
	  dictem \
	  dtrt-indent \
	  haskell-mode \
	  magit \
	  markdown-mode \
	  popup \
	  proofgeneral \
	  vm
#	  color-theme-6.6.0 \

MAKEDIRS = $(SUBDIRS:%=make-%)
INSTALLDIRS = $(SUBDIRS:%=install-%)
CLEANDIRS = $(SUBDIRS:%=clean-%)

all: subdirs

subdirs: $(MAKEDIRS)

$(MAKEDIRS):
	$(MAKE) -C $(@:make-%=%)
	touch $@

install: $(INSTALLDIRS)
	install-info $(EMACSD)/share/info/*.info $(EMACSD)/share/info/dir

install-% : make-%
$(INSTALLDIRS):
	-mkdir -p $(EMACSD)/$(@:install-%=%)
	$(MAKE) -C $(@:install-%=%) install DIR=$(EMACSD)/$(@:install-%=%)

clean: $(CLEANDIRS)
	rm -f make-*

$(CLEANDIRS):
	[ ! -f $(@:clean-%=%)/Makefile ] || $(MAKE) -C $(@:clean-%=%) clean

# Manual overrides:
make-auto-indent-mode make-markdown-mode make-popup make-dictem make-dtrt-indent:
	touch $@

clean-auto-indent-mode clean-markdown-mode clean-popup clean-dictem:
	echo $@

make-auto-complete:
	$(MAKE) -C $(@:make-%=%) -e EMACS="emacs -L lib/popup/"
	touch $@

make-bbdb: make-vm
	cd $(@:make-%=%) && autoconf && ./configure --prefix=$(EMACSD) --without-tex-dir \
	    --with-vm-dir=$(EMACSEN)/vm/lisp \
	    --with-lispdir=$(EMACSD)bbdb
	$(MAKE) -C $(@:make-%=%)
	touch $@

make-haskell-mode:
	$(MAKE) -C $(@:make-%=%) compile
	touch $@

make-proofgeneral:
	$(MAKE) -C $(@:make-%=%) compile
	touch $@

make-vm:
	# info file is broken in vm at the moment.
	echo '%s/^all: info/all:/g\n%s/^info:.*/info:/g\nw' | ed vm/info/Makefile.in
	cd $(@:make-%=%) && autoconf && ./configure --prefix=$(EMACSD) --with-other-dirs=$(EMACSEN)/bbdb/lisp
	$(MAKE) -C $(@:make-%=%)
	touch $@

install-auto-complete:
	-mkdir -p $(EMACSD)/$(@:install-%=%)
	$(MAKE) -C $(@:install-%=%) -e DIR=$(EMACSD)/$(@:install-%=%) \
				    -e EMACS="emacs -L lib/popup/" install

install-bbdb:
	-mkdir -p $(EMACSD)/$(@:install-%=%)
	$(MAKE) -C $(@:install-%=%) -e lispdir=$(EMACSD)/$(@:install-%=%) install

install-auto-indent-mode install-dictem install-dtrt-indent install-markdown-mode install-popup:
	-mkdir -p $(EMACSD)/$(@:install-%=%)
	install -m 644 $(@:install-%=%)/*.el $(EMACSD)/$(@:install-%=%)
	
install-color-theme-6.6.0:
	-mkdir -p $(EMACSD)/$(@:install-%=%)
	$(MAKE) -C $(@:install-%=%) -e ELISPDIR=$(EMACSD)/$(@:install-%=%) install

install-haskell-mode: make-haskell-mode
	-mkdir -p $(EMACSD)/$(@:install-%=%)
	install -m 644 $(@:install-%=%)/*.elc $(EMACSD)/$(@:install-%=%)

install-magit:
	-mkdir -p $(EMACSD)/$(@:install-%=%)
	$(MAKE) -C $(@:install-%=%) -e PREFIX="" -e DESTDIR=$(EMACSD) \
		-e SYSCONFDIR="" -e ELISP_INSTALL_DIR=$(EMACSD)/$(@:install-%=%) install

install-proofgeneral:
	-mkdir -p $(EMACSD)/$(@:install-%=%)
	$(MAKE) -C $(@:install-%=%) -e ELISP=$(EMACSD)/$(@:install-%=%) install-el install-elc

install-vm:
	-mkdir -p $(EMACSD)/$(@:install-%=%)
	$(MAKE) -C $(@:install-%=%) -e lispdir=$(EMACSD)/$(@:install-%=%) install

clean-vm:
	[ ! -f $(@:clean-%=%)/Makefile ] || $(MAKE) -C $(@:clean-%=%) distclean

clobber:
	for dir in $(SUBDIRS); do \
	    git --git-dir=$${dir}/.git reset --hard HEAD; \
	    git --git-dir=$${dir}/.git clean -qxdf; \
	done

.PHONY: all install clean $(CLEANDIRS) clobber