summaryrefslogtreecommitdiff
path: root/Makefile
blob: 5e4fb21e59cce2a9f0836c8e81d8e4cff0a842a8 (plain)
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
SHELL = /bin/bash

NANO_BIN_PREFIX = $(patsubst %/bin/nano,%,$(shell which nano))
NANO_CHECK = $(HOME)/.prefix:$(HOME):/usr/local:/usr:$(NANO_BIN_PREFIX)
NANO_SHARE = $(firstword $(wildcard $(addsuffix /share/nano,$(subst :, ,$(NANO_CHECK)))))

targets=.nanorc .folders .crontab.cookie .git.info.exclude
all: $(targets)
clean:
	rm -f $(targets)

.config/nanorc: .config/nanorc.in $(NANO_SHARE)
	cat '$<' > '$@'
	for file in $(NANO_SHARE)/*.nanorc; do echo "include \"$$file\""; done >> '$@'

.folders: Maildir
	( echo '..'; find ~/Maildir -maxdepth 2 -type f -name "maildirfolder" -printf '%h\n'|sed -r 's@.*/(.*\.)(.*)@.\1\2@' )|sort>'$@'
.git.info.exclude: .git.info.exclude.in $(shell echo .??*/)
	( cat $<; find $^ -type f -name 'CACHEDIR.TAG' -printf '%h\n'|sed 's@^\./@/@' ) > $@

.cache/cron/cookie: .config/cron
	-(cat $^/*; echo) | crontab - 2>/dev/null
	mkdir -p '$(@D)'
	date > '$@'

Maildir:
	mkdir -p '$@'/{cur,new,tmp}
Maildir/%: | Maildir
	mkdir -p '$@'/{cur,new,tmp}
	touch '$@'/maildirfolder

.PHONY: FORCE PHONY
FORCE: ; 
PHONY: ;