-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
36 lines (28 loc) · 1.23 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
# ----------------------------------------------------------------------- #
# Abdó Roig-Maranges <[email protected]> #
# #
# Makefile to compile my dotfiles directory for github. Merges changes #
# from several locar repos on my machine into a single dotfiles repo #
# using the git merge -s subtree. #
# ----------------------------------------------------------------------- #
REMOTES=awesome compton desktop shell spacemacs systemd vim vifm zathura sway termite
# shell settings
SHELL := /usr/bin/bash
.SHELLFLAGS := -e -u -c
.ONESHELL:
# So we can use $$(variable) on the prerequisites, that expand at matching time.
.SECONDEXPANSION:
.PHONY: all merge $(REMOTES)
all: merge
merge: $(REMOTES)
$(REMOTES): %:
@git fetch "$@"
remote="$@/master"
path="$@"
echo "subtree merging into '$$path'"
if [ ! -d "$$path" ]; then
git merge -s ours --allow-unrelated-histories --no-commit "$$remote"
git read-tree --prefix="$$path" -u "$$remote"
git commit -m "Initialize subtree at '$$path'"
fi
git merge -s recursive -X subtree="$$path" -m "Merge subtree '$$remote'" "$$remote"