aboutsummaryrefslogtreecommitdiff
path: root/emacsen/Makefile
blob: 7ebb4c1e3a469521d9dc98b18334371346b393f1 (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
ROOT=$(shell pwd)/..
export ROOT
EMACSD=$(ROOT)/build/.emacs.d/
export ELISPDIR
EMACSEN=$(ROOT)/emacsen

SUBDIRS = dictem

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

all: subdirs

subdirs: $(MAKEDIRS)

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

install: $(INSTALLDIRS)
	[ ! -d $(EMACSD)/share/info ] || 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-dictem:
	touch $@

clean-dictem:
	echo $@

install-dictem:
	-mkdir -p $(EMACSD)/$(@:install-%=%)
	install -m 644 $(@:install-%=%)/*.el $(EMACSD)/$(@:install-%=%)

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