blob: 214fad146b207a2d809114a0cc520029f9105d9d (
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
ifndef HOME
$(error "$$HOME" must be defined)
endif
.DEFAULT_GOAL = simulate-install
SOURCES := $(shell find dot \( -type f -o -type l \) -not -name '.*')
DESTINATIONS = $(SOURCES:dot/%=${HOME}/.%)
${HOME}/.gitconfig:
./src/gitconfig.sh
EXECUTABLES = $(filter dot/local/bin/%, $(SOURCES))
ifndef REVERSE
$(HOME)/.%: dot/%
install -D -m $(if $(filter $<, $(EXECUTABLES)), 0755, 0644) $< $@
endif
.PHONY: install simulate-install diff
diff:
$(MAKE) REVERSE=y reverse-all | less -E
help:
@echo 'To see all files changed outside the source tree:'
@echo
@echo ' make diff'
@echo
@echo 'To show the diff of one file (e.g. .xinitrc):'
@echo
@echo ' make REVERSE=y dot/xinitrc'
@echo
@echo 'To _copy_ from $$HOME/.xinitrc into the source tree:'
@echo
@echo ' make REVERSE=y WRITE_REVERSE=y dot/xinitrc'
@echo
ifdef REVERSE
.PHONY: reverse-all
reverse-all: $(SOURCES)
.FORCE:
$(SOURCES): .FORCE
@diff -u3 $@ $(@:dot/%=$(HOME)/.%) || rsync $(if $(WRITE_REVERSE),,-n) -ui $(@:dot/%=$(HOME)/.%) $@
endif
install: $(DESTINATIONS)
simulate-install:
@echo
@echo \#\# SIMULATED INSTALL \#\#
@echo
@echo run \'make install\' to execute the install commands shown below
@echo
@$(MAKE) -n install
|