aboutsummaryrefslogtreecommitdiffstats
path: root/GNUmakefile
blob: d63de980cc44d3c36beb3fda3205f3ee496186d7 (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
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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
MODULES=xmodmap emacs xdg shepherd

STOW = stow
EMACS = emacs
SCHEME_IMPLEMENTATION = guile

define tangle =
	@echo -e "\e[35mOBT\e[0m" $<
	@$(EMACS) -quick -batch \
        -eval "(package-initialize)" \
        -load ob-tangle \
        -eval "(setq sh-make-vars-local nil)" \
        -eval "(setq geiser-default-implementation '$(SCHEME_IMPLEMENTATION))" \
        -eval "(org-babel-tangle-file \"$<\" \"$(PWD)/$@\" \"$(1)\")"
endef

.PHONY: all clean $(MODULES) zsh

all: $(MODULES)

install:
	cp --recursive --verbose build/. ~/

clean:
	rm -r build

zsh:
	$(MAKE) -C $@

before-%-install:				# Dummy recipe
	@true

%-stow: % before-%-install
	$(STOW) $<

%-install: %-stow				# Dummy recipe
	@true

%-uninstall:
	$(STOW) -D $(subst -uninstall,,$@)

# Picom

picom: picom/.config/picom.conf

picom/.config/picom.conf: picom/.config/picom.org
	$(call tangle,conf)

picom-clean:
	rm -f picom/.config/picom.conf

#########
# Emacs #
#########

emacs: build/.config/shepherd/init.d/ build/.config/shepherd/init.d/emacs.scm \
       emacs/.config/emacs/init.elc

build/.config/shepherd/init.d/emacs.scm: emacs/.config/shepherd/init.d/emacs.org
	$(call tangle)

###########
# Xmodmap #
###########

xmodmap: build/ build/.Xmodmap

build/.Xmodmap: xmodmap/Xmodmap.org
	$(call tangle,fundamental)

xmodmap-clean:
	rm -f build/.Xmodmap

#########
# Cower #
#########

cower: cower/.config/cower/config

cower/.config/cower/config: cower/.config/cower/config.org
	$(call tangle,conf-unix)

cower-clean:
	rm -f cower/.config/cower/config

#############
# Mowedline #
#############

mowedline: mowedline/.config/mowedline/init.scm

mowedline/.config/mowedline/init.scm: SCHEME_IMPLEMENTATION = chicken
mowedline/.config/mowedline/init.scm: mowedline/.config/mowedline/init.org
	$(call tangle,scheme)

mowedline-clean:
	rm -f mowedline/.config/mowedline/init.scm

#########
# Dunst #
#########

dunst: dunst/.config/dunst/dunstrc

dunst/.config/dunst/dunstrc: dunst/.config/dunst/dunstrc.org
	$(call tangle,conf-unix)

dunst-clean:
	rm -f dunst/.config/dunst/dunstrc

# X11

x11-install: lib-install x11/dot-x11-0-1-any.pkg.tar.xz

x11/dot-x11-0-1-any.pkg.tar.xz: x11/PKGBUILD
	cd x11 && makepkg -sicf

#######
# XDG #
#######

xdg: build/.config/ build/.config/mimeapps.list build/.config/user-dirs.dirs \
     build/.config/user-dirs.locale

build/.config/mimeapps.list: xdg/.config/mimeapps.list.org
	$(call tangle)

build/.config/user-dirs.dirs: xdg/.config/user-dirs.dirs.org
	$(call tangle)

build/.config/user-dirs.locale: xdg/.config/user-dirs.locale.org
	$(call tangle)

# Shepherd

shepherd: build/.config/shepherd/ build/.config/shepherd/init.scm

build/.config/shepherd/init.scm: shepherd/.config/shepherd/init.org
	$(call tangle)

# Helper

%.el: %.org
	$(call tangle,emacs-lisp)

%.elc: %.el
	@echo -e "\e[36mELC\e[0m" $<
	$(EMACS) -batch -f batch-byte-compile $<

%: %.org
	$(call tangle)

%/:
	mkdir -p $@