Commit | Line | Data |
---|---|---|
67b1a15a MW |
1 | ## -*-makefile-*- |
2 | ||
3 | all:: | |
5e776d3c MW |
4 | .PHONY: all |
5 | ||
6 | clean:: | |
7 | .PHONY: clean | |
8 | ||
67b1a15a MW |
9 | .SECONDEXPANSION: #sorry |
10 | ||
11 | ###-------------------------------------------------------------------------- | |
12 | ### Utilities. | |
13 | ||
14 | ## | |
15 | quote = '$(subst ','\'',$1)'#' | |
16 | ||
17 | ## Suss out how to print stuff. | |
18 | print = printf "%s" $(call quote,$1) | |
19 | ||
20 | ## Looking configuration things up. | |
21 | mdw-conf = $(shell bin/mdw-conf "$1" "$2") | |
22 | ||
23 | ## Checking symlink targets. | |
24 | symlink-ok-p = $(shell \ | |
25 | case $$(readlink 2>/dev/null $1) in ($2) echo t ;; esac) | |
26 | ||
27 | ## Silent rules machinery. | |
28 | V = 0 | |
67b1a15a MW |
29 | V_AT = $(V_AT_$V) |
30 | V_AT_0 = @ | |
2e0a8012 | 31 | v_print = $(call v_print_$V,$1,$2) |
a811ce27 MW |
32 | v_print_0 = \ |
33 | printf " %-8s %s\n" "$1" $(call quote,$(patsubst $(HOME)/%,~/%,$2)); | |
2e0a8012 | 34 | v_tag = $(V_AT)$(call v_print_$V,$1,$@) |
67b1a15a MW |
35 | |
36 | ## Hack. | |
37 | relax = | |
38 | ||
39 | ###-------------------------------------------------------------------------- | |
40 | ### Configuration. | |
41 | ||
42 | ## Figure out where I am. | |
3337f511 | 43 | HERE := $(shell pwd) |
67b1a15a MW |
44 | |
45 | ## Decide on how to fetch things from URLs. | |
46 | ifeq ($(shell (curl >/dev/null 2>&1 --version || [ $$? -eq 2 ]) && echo t),t) | |
47 | get-url = curl -fs -o $1 $2 | |
48 | else | |
49 | get-url = wget -q -O $1 $2 | |
50 | endif | |
51 | ||
52 | ## Which Emacs should I use? | |
53 | EMACS := $(shell \ | |
54 | emacs=nil; \ | |
55 | for i in emacs24 emacs23 emacs22 emacs21 emacs; do \ | |
3337f511 MW |
56 | if type >/dev/null 2>&1 $$i; then emacs=$$i; break; fi; \ |
57 | done; \ | |
58 | echo $$emacs) | |
67b1a15a MW |
59 | |
60 | ## Whence to obtain externally hosted stuff. | |
61 | REPO = https://ftp.distorted.org.uk/u/mdw/profile | |
62 | ||
63 | ## Additional local configuration. | |
64 | -include local.mk | |
65 | ||
66 | ###-------------------------------------------------------------------------- | |
67 | ### Some utility rules. | |
68 | ||
69 | _force: | |
70 | .PHONY: _force | |
71 | ||
72 | ###-------------------------------------------------------------------------- | |
73 | ### Emacs. | |
74 | ||
967148ff MW |
75 | ifneq ($(EMACS),nil) |
76 | ||
67b1a15a MW |
77 | EMACSLIB = $(HOME)/lib/emacs |
78 | ||
486623cb | 79 | EMACS_VERSION := $(shell $(EMACS) 2>&1 -Q --batch --eval \ |
b2f6f110 MW |
80 | '(message "%s %s" emacs-major-version emacs-minor-version)' | \ |
81 | tail -n1) | |
486623cb MW |
82 | emacs-version-p = $(shell set -- $(EMACS_VERSION); \ |
83 | if [ $$1 -gt $1 ] || ([ $$1 -eq $1 ] && [ $$2 -ge $2 ]); then \ | |
84 | echo t; \ | |
85 | fi) | |
86 | ||
6369ae29 MW |
87 | ELISP += make-regexp ew-hols |
88 | ELISP += mdw-gnus-patch | |
89 | ELISP += mdw-multiple-cursors | |
90 | ELISP += git git-blame vc-git stgit quilt | |
486623cb MW |
91 | |
92 | ifeq ($(call emacs-version-p,24,3),t) | |
6369ae29 | 93 | ELISP += bracketed-paste |
486623cb | 94 | endif |
67b1a15a | 95 | |
3e441da6 MW |
96 | ELISP += dot-emacs |
97 | dot-emacs_DEPS = make-regexp | |
98 | ||
67b1a15a | 99 | SCRIPTLINKS += emacsclient-hack movemail-hack sendmail-hack |
cef9886f | 100 | SCRIPTLINKS += aspell-hack emerge-hack wakey.sh |
67b1a15a | 101 | |
3e441da6 | 102 | %.elc: %.el $$(foreach e, $$($$*_DEPS), $$(DEP_$$e)) |
83198952 MW |
103 | $(call v_tag,EMACS)if ! $(EMACS) >$*.build-log 2>&1 \ |
104 | -L el/ -L $(EMACSLIB) \ | |
67b1a15a | 105 | --batch --no-site-file \ |
83198952 MW |
106 | --eval '(byte-compile-file "$<")'; then \ |
107 | cat $*.build-log; exit 2; \ | |
108 | fi | |
67b1a15a | 109 | |
6369ae29 MW |
110 | LOCAL_ELISP = $(filter $(notdir $(wildcard el/*.el)), \ |
111 | $(addsuffix .el, $(ELISP))) | |
112 | $(foreach e, $(LOCAL_ELISP), \ | |
113 | $(eval DEP_$(basename $e) = $(EMACSLIB)/$(e:.el=.elc))) | |
67b1a15a MW |
114 | $(addprefix $(EMACSLIB)/, $(LOCAL_ELISP)): $(EMACSLIB)/%: el/% |
115 | $(call v_tag,SYMINK)mkdir -p $(EMACSLIB) && \ | |
116 | rm -f $@.new && \ | |
117 | ln -s $(HERE)/$< $@.new && \ | |
118 | mv $@.new $@ | |
119 | ||
120 | REMOTE_ELISP = $(filter-out $(notdir $(wildcard el/*.el)), \ | |
6369ae29 | 121 | $(addsuffix .el, $(ELISP))) |
67b1a15a | 122 | $(foreach e, $(REMOTE_ELISP), \ |
6369ae29 | 123 | $(eval DEP_$(basename $e) = $(if $(shell \ |
67b1a15a MW |
124 | if $(EMACS) >/dev/null 2>&1 --no-site-file -q --batch \ |
125 | --eval ' \ | |
126 | (progn \ | |
127 | (kill-emacs (condition-case nil \ | |
128 | (progn (load-library "$e") 0) \ | |
129 | (error 1))))'; then \ | |
130 | echo t; \ | |
131 | fi),, $(EMACSLIB)/$(e:.el=.elc)))) | |
132 | $(addprefix $(EMACSLIB)/, $(REMOTE_ELISP)): $(EMACSLIB)/%: | |
133 | $(call v_tag,FETCH)mkdir -p $(EMACSLIB) && \ | |
134 | $(call get-url,$@.new,$(REPO)/$*) && \ | |
135 | mv $@.new $@ | |
136 | ||
137 | DOTLINKS += .emacs .emacs-calc .vm .gnus.el .ercrc.el | |
138 | ||
139 | all:: $(foreach e, $(ELISP), $(DEP_$e)) | |
6369ae29 | 140 | $(foreach e, $(ELISP), $(eval _emacs.$e: $(EMACSLIB)/$e.elc)) |
67b1a15a | 141 | |
967148ff MW |
142 | endif |
143 | ||
67b1a15a MW |
144 | ###-------------------------------------------------------------------------- |
145 | ### Other simpler things. | |
146 | ||
147 | $(HOME)/.mdw.conf: | |
148 | $(call v_tag,COPY)cp mdw.conf $@.new && mv $@.new $@ | |
149 | ||
150 | ## Utility packages. | |
151 | PACKAGES += mlib checkpath | |
152 | mlib_CHECK = crc-mktab | |
153 | checkpath_CHECK = tmpdir | |
154 | checkpath_DEPS = mlib | |
155 | ||
156 | ## Packaging machinery. | |
157 | SCRIPTLINKS += mdw-build mdw-sbuild mdw-sbuild-server | |
158 | SCRIPTLINKS += update-buildable-branch | |
f0637893 MW |
159 | DOTLINKS += .config/mdw-build.conf |
160 | .config/mdw-build.conf_SRC = mdw-build.conf | |
67b1a15a MW |
161 | |
162 | ## Shells. | |
163 | DOTLINKS += .profile .shell-rc .shell-logout | |
a3857ab2 | 164 | DOTLINKS += .shrc |
9ba9bb2f MW |
165 | DOTLINKS += .zprofile .zshrc .zlogout .zshenv |
166 | DOTLINKS += .bash_profile .bash_completion .bash_logout | |
167 | DOTLINKS += .bashrc .inputrc | |
67b1a15a MW |
168 | .bash_profile_SRC = bash-profile |
169 | .bash_completion_SRC = bash-completion | |
9ba9bb2f MW |
170 | .bash_logout_SRC = shell-logout |
171 | .zlogout_SRC = shell-logout | |
67b1a15a | 172 | |
72123a3a MW |
173 | all:: |
174 | $(V_AT)if [ $(HOME)/.zcompdump -ot dot/zshrc ]; then \ | |
175 | $(call v_print,ZAP,$(HOME)/.zcompdump)rm -f $(HOME)/.zcompdump; \ | |
176 | fi | |
177 | ||
a3857ab2 MW |
178 | ## The Plan 9 `rc' shell. This needs special hacking, because the Linux port |
179 | ## and Plan 9 From User Space have incompatible syntax. | |
180 | DOTLINKS += lib/profile | |
181 | lib/profile_SRC = rcrc | |
182 | all:: $(HOME)/.rcrc | |
183 | $(HOME)/.rcrc: dot/rcrc | |
184 | $(call v_tag,SED)sed 's/; if not/else/' $< >$@.new && mv $@.new $@ | |
185 | ||
67b1a15a MW |
186 | ## Git. |
187 | DOTSUBST += .gitconfig | |
2e15741e | 188 | SCRIPTLINKS += git-copyright-dates |
67b1a15a MW |
189 | DOTLINKS += .cgrc .tigrc |
190 | .gitconfig_SUBSTS = \ | |
9ca6d190 MW |
191 | $(call substvar,releasekey,$(call mdw-conf,releasekey,481334C2)) \ |
192 | $(call substvar,email,$(call mdw-conf,email,mdw@distorted.org.uk)) | |
67b1a15a MW |
193 | $(HOME)/.gitconfig: $(HOME)/.mdw.conf |
194 | ||
195 | ## PulseAudio. | |
196 | DOTLINKS += .pulse/daemon.conf | |
197 | DOTSUBST += .pulse/default.pa | |
198 | .pulse/daemon.conf_SRC = pulse-daemon.conf | |
199 | .pulse/default.pa_SRC = pulse-default.pa.in | |
200 | ||
201 | ## Other editors. | |
202 | DOTLINKS += .vimrc .mg .zile | |
203 | ||
204 | ## Mail. | |
205 | DOTLINKS += .mailrc .signature .muttrc | |
206 | ||
207 | ## Lisp. | |
208 | DOTLINKS += .cmucl-init.lisp .sbclrc .clisprc.lisp .eclrc | |
209 | .cmucl-init.lisp_SRC = lisp-init.lisp | |
210 | .sbclrc_SRC = lisp-init.lisp | |
211 | .clisprc.lisp_SRC = lisp-init.lisp | |
212 | .eclrc_SRC = lisp-init.lisp | |
213 | DOTLINKS += .swank.lisp | |
214 | ||
215 | ## IPython. | |
216 | DOTLINKS += .ipython/profile_default/ipython_config.py | |
217 | DOTLINKS += .ipython/profile_default/startup/50-key-bindings.py | |
218 | .ipython/profile_default/ipython_config.py_SRC = ipython-config.py | |
219 | .ipython/profile_default/startup/50-key-bindings.py_SRC = ipython-key-bindings.py | |
220 | ||
221 | ## Other languages. | |
222 | DOTLINKS += .guile | |
223 | DOTLINKS += .tclshrc .wishrc | |
224 | .tclshrc_SRC = tclshrc | |
225 | .wishrc_SRC = tclshrc | |
226 | ||
8f3f3f67 | 227 | ## Jukebox things. |
94275284 MW |
228 | MISCLINKS += lib/perl/DisOrder.pm |
229 | lib/perl/DisOrder.pm_SRC = pl/DisOrder.pm | |
8f3f3f67 | 230 | SCRIPTLINKS += disorder-switch-config |
d22be3ab | 231 | SCRIPTLINKS += disorder-autoplay |
a1b30762 | 232 | SCRIPTLINKS += disorder-notify |
8f3f3f67 | 233 | |
67b1a15a MW |
234 | ## Random scripts. |
235 | SCRIPTLINKS += mdw-editor mdw-pager | |
236 | SCRIPTLINKS += mdw-conf | |
237 | SCRIPTLINKS += svnwrap | |
238 | SCRIPTLINKS += guest-console | |
239 | SCRIPTLINKS += hyperspec | |
310d0527 | 240 | SCRIPTLINKS += bdl |
878a38bd | 241 | SCRIPTLINKS += datasyms |
8945a62f | 242 | SCRIPTLINKS += fixsub |
01a5d0a6 | 243 | SCRIPTLINKS += check-debsyms |
a98bca79 | 244 | SCRIPTLINKS += check-blkdev-size |
67b1a15a MW |
245 | |
246 | ## Random odds and ends. | |
3f7369a9 | 247 | DOTLINKS += .infokey .sqliterc |
67b1a15a MW |
248 | DOTLINKS += .gdbinit .toprc .aspell.conf |
249 | DOTLINKS += .dircolors .colordiffrc .screenrc .tmux.conf | |
250 | DOTLINKS += .cvsrc .indent.pro .ditz-config | |
da526ba7 MW |
251 | DOTLINKS += .lftp/rc |
252 | .lftp/rc_SRC = lftp-rc | |
67b1a15a MW |
253 | DOTSUBST += .mykermrc |
254 | SCRIPTLINKS += lesspipe.sh | |
255 | ||
256 | SCRIPTLINKS += run-with-shell-env | |
257 | SCRIPTLINKS += start-ssh-agent start-ssh-pageant | |
258 | SCRIPTLINKS += add-ssh-keys | |
259 | SCRIPTLINKS += hacks/ssh/ssh | |
260 | hacks/ssh/ssh_SRC = hacks/ssh | |
261 | ||
262 | DOTLINKS += .w3m/config .elinks/elinks.conf | |
263 | .w3m/config_SRC = w3m-config | |
264 | .elinks/elinks.conf_SRC = elinks.conf | |
265 | ||
266 | DOTLINKS += .mc/ini .mc/panels.ini | |
267 | .mc/ini_SRC = mc-ini | |
268 | .mc/panels.ini_SRC = mc-panels.ini | |
269 | ||
e8f132bd | 270 | DOTLINKS += .parallel/config .parallel/sshloginfile |
67b1a15a | 271 | .parallel/config_SRC = parallel-config |
e8f132bd | 272 | .parallel/sshloginfile_SRC = parallel-hosts |
67b1a15a | 273 | |
3f7369a9 MW |
274 | all:: $(HOME)/.less |
275 | $(HOME)/.less: dot/lesskey | |
276 | $(V_AT)rm -f $(HOME)/.lesskey | |
277 | $(call v_tag,LESSKEY)lesskey -o$@ $< | |
278 | ||
67b1a15a MW |
279 | ###-------------------------------------------------------------------------- |
280 | ### X11 configuration. | |
281 | ||
282 | ifeq ($X,t) | |
283 | ||
284 | PACKAGES += xtoys | |
285 | xtoys_CHECK = xatom | |
286 | xtoys_DEPS = mlib | |
287 | ||
288 | DOTLINKS += .xinitrc .xsession .xmodmap .vncrc .vncsession | |
df4bcc77 MW |
289 | DOTLINKS += .config/fontconfig/fonts.conf |
290 | .config/fontconfig/fonts.conf_SRC = fonts.conf | |
67b1a15a MW |
291 | DOTLINKS += .stalonetrayrc |
292 | ||
67b1a15a MW |
293 | DOTLINKS += .config/gnome-session/sessions/mdw.session |
294 | .config/gnome-session/sessions/mdw.session_SRC = mdw.session | |
295 | ||
296 | DOTLINKS += .Eterm/themes/Eterm/theme.cfg | |
297 | DOTLINKS += .enlightenment/keybindings.cfg | |
298 | DOTLINKS += .enlightenment-vnc/keybindings.cfg | |
299 | DOTLINKS += .e16/bindings.cfg | |
300 | .Eterm/themes/Eterm/theme.cfg_SRC = eterm-theme.cfg | |
301 | .enlightenment/keybindings.cfg_SRC = e-keybindings.cfg | |
302 | .enlightenment-vnc/keybindings.cfg_SRC = evnc-keybindings.cfg | |
303 | .e16/bindings.cfg_SRC = e16-bindings | |
304 | ||
305 | DOTLINKS += .gtkrc-2.0 | |
306 | DOTLINKS += .config/gtk-3.0/gtk.css | |
307 | DOTLINKS += .config/gtk-3.0/settings.ini | |
308 | .config/gtk-3.0/gtk.css_SRC = gtk3.css | |
309 | .config/gtk-3.0/settings.ini_SRC = gtk3-settings.ini | |
310 | ||
a9d5edbf MW |
311 | DOTLINKS += .config/user-dirs.dirs .config/user-dirs.locale |
312 | .config/user-dirs.dirs_SRC = user-dirs.dirs | |
313 | .config/user-dirs.locale_SRC = user-dirs.locale | |
314 | ||
67b1a15a MW |
315 | SCRIPTLINKS += xinitcmd lock-screen xshutdown |
316 | SCRIPTLINKS += un-backslashify-selection | |
317 | SCRIPTLINKS += xpra-start-xdummy | |
5f9b345a | 318 | SCRIPTLINKS += play-rawk |
b3ee0533 | 319 | SCRIPTLINKS += xduplic-terminal |
67b1a15a MW |
320 | |
321 | DOTCPP += .Xdefaults | |
322 | Xdefaults_DEFS = -DEMACSWD=$(call mdw-conf,emacs-width,77) | |
57a9b0cd | 323 | $(HOME)/.Xdefaults: $(HOME)/.mdw.conf dot/Xdefaults.pterm |
67b1a15a | 324 | |
ddc97f65 MW |
325 | ifeq ($(shell case $${DISPLAY-nil} in (:[0-9]*) echo t ;; (*) echo nil ;; esac),t) |
326 | dotfile-hook/.Xdefaults = \ | |
327 | $(call v_tag,XRDB)xrdb -override $< | |
328 | endif | |
329 | ||
67b1a15a MW |
330 | endif |
331 | ||
53ad55a5 MW |
332 | ###-------------------------------------------------------------------------- |
333 | ### Firefox things. | |
334 | ||
335 | ifeq ($(FIREFOX),t) | |
336 | ||
337 | out/: | |
338 | $(call v_tag,MKDIR)mkdir $@ | |
339 | ||
340 | out/firefox/: | out/ | |
341 | $(call v_tag,MKDIR)mkdir $@ | |
342 | ||
343 | clean::; rm -rf out/ | |
344 | ||
345 | all:: out/firefox/smartup-gestures.config | |
346 | out/firefox/smartup-gestures.config: firefox/smartup-gestures.json | out/firefox/ | |
347 | $(call v_tag,BLOB)\ | |
348 | jq -c . $< | bincode base64 >$@.new && mv $@.new $@ | |
349 | ||
350 | all:: out/firefox/stylus.json | |
351 | out/firefox/stylus.json: firefox/stylus/ firefox/stylus/*.css | out/firefox/ | |
352 | $(call v_tag,IMPLODE)\ | |
353 | firefox/implode-stylus firefox/stylus/ >$@.new && \ | |
354 | mv $@.new $@ | |
355 | endif | |
356 | ||
9c72b1b3 MW |
357 | ###-------------------------------------------------------------------------- |
358 | ### General symlinking. | |
359 | ||
360 | misclink-source = $(HERE)/$(or $($1_SRC), $1) | |
361 | ||
362 | all:: $(addprefix $(HOME)/, $(MISCLINKS)) | |
363 | misclink-ok-p = \ | |
364 | $(call symlink-ok-p,$(HOME)/$1,$(call misclink-source,$1)) | |
365 | $(addprefix $(HOME)/, $(subst %,\%,$(MISCLINKS))): $(HOME)/%: \ | |
366 | $$(if $$(call misclink-ok-p,$$*),,_force) | |
367 | $(call v_tag,SYMLINK)mkdir -p $(dir $@) && \ | |
368 | rm -f $@.new && \ | |
369 | ln -s $(call misclink-source,$*) $@.new && \ | |
370 | mv $@.new $@ | |
371 | $(symlink-hook/$*) | |
372 | ||
67b1a15a MW |
373 | ###-------------------------------------------------------------------------- |
374 | ### Processing dotfiles. | |
375 | ||
376 | dotfile-source = $(HERE)/dot/$(or $($1_SRC), $(1:.%=%)$2) | |
377 | ||
4937ba2d | 378 | ## Easiest: just make symlinks. |
67b1a15a MW |
379 | dotlink-ok-p = \ |
380 | $(call symlink-ok-p,$(HOME)/$1,$(call dotfile-source,$1)) | |
381 | all:: $(addprefix $(HOME)/, $(DOTLINKS)) | |
382 | $(addprefix $(HOME)/, $(subst %,\%,$(DOTLINKS))): $(HOME)/%: \ | |
383 | $$(if $$(call dotlink-ok-p,$$*),,_force) | |
384 | $(call v_tag,SYMLINK)mkdir -p $(dir $@) && \ | |
385 | rm -f $@.new && \ | |
386 | ln -s $(call dotfile-source,$*) $@.new && \ | |
387 | mv $@.new $@ | |
f6c3a80b | 388 | $(dotfile-hook/$*) |
67b1a15a MW |
389 | |
390 | ## Hack with the C preprocessor. | |
391 | all:: $(addprefix $(HOME)/, $(DOTCPP)) | |
392 | $(addprefix $(HOME)/, $(subst %,\%,$(DOTCPP))): $(HOME)/%: \ | |
393 | $$(call dotfile-source,$$*) Makefile | |
394 | $(call v_tag,CPP)mkdir -p $(dir $@) && \ | |
395 | rm -f $@.new && \ | |
396 | cpp -P -o$@.new $($*_DEFS) $< && \ | |
397 | mv $@.new $@ | |
f6c3a80b | 398 | $(dotfile-hook/$*) |
67b1a15a MW |
399 | |
400 | ## Hack by making simple substitutions. | |
401 | substvar = -e $(call quote,s\a@$1@\a$2\ag) | |
402 | SUBSTS += $(call substvar,home,$(HOME)) | |
403 | SUBSTS += $(call substvar,profile,$(HERE)) | |
404 | all:: $(addprefix $(HOME)/, $(DOTSUBST)) | |
405 | $(addprefix $(HOME)/, $(subst %,\%,$(DOTSUBST))): $(HOME)/%: \ | |
33271a96 | 406 | $$(call dotfile-source,$$*,.in) Makefile |
67b1a15a MW |
407 | $(call v_tag,SUBST)mkdir -p $(dir $@) && \ |
408 | rm -f $@.new && \ | |
409 | sed -e "1i\ | |
410 | $(relax)### generated by $(HERE)/Makefile; do not edit!" \ | |
411 | $(SUBSTS) $($*_SUBSTS) \ | |
412 | $(call dotfile-source,$*,.in) >$@.new && \ | |
413 | mv $@.new $@ | |
f6c3a80b | 414 | $(dotfile-hook/$*) |
67b1a15a MW |
415 | |
416 | ###-------------------------------------------------------------------------- | |
417 | ### Processing script links. | |
418 | ||
419 | script-source = $(HERE)/bin/$(or $($1_SRC), $1) | |
0cd3b798 MW |
420 | |
421 | ifeq ($(prefix-shebang-p),t) | |
422 | all:: $(addprefix $(HOME)/bin/, $(SCRIPTLINKS)) | |
423 | $(addprefix $(HOME)/bin/, $(SCRIPTLINKS)): $(HOME)/bin/%: \ | |
424 | $$(call script-source,$$*) Makefile | |
425 | $(call v_tag,SHEBANG)mkdir -p $(dir $@) && \ | |
426 | rm -f $@.new && \ | |
427 | sed "1s\a\(#! *\)/\a\1$(SHEBANG_PREFIX)/\a" \ | |
428 | $(call script-source,$*) >$@.new && \ | |
429 | chmod --reference=$(call script-source,$*) $@.new && \ | |
430 | mv $@.new $@ | |
431 | $(script-hook/$*) | |
432 | else | |
67b1a15a MW |
433 | scriptlink-ok-p = \ |
434 | $(call symlink-ok-p,$(HOME)/bin/$1,$(call script-source,$1)) | |
435 | all:: $(addprefix $(HOME)/bin/, $(SCRIPTLINKS)) | |
436 | $(addprefix $(HOME)/bin/, $(SCRIPTLINKS)): $(HOME)/bin/%: \ | |
437 | $$(if $$(call scriptlink-ok-p,$$*),,_force) | |
438 | $(call v_tag,SYMLINK)mkdir -p $(dir $@) && \ | |
439 | rm -f $@.new && \ | |
440 | ln -s $(call script-source,$*) $@.new && \ | |
441 | mv $@.new $@ | |
f6c3a80b | 442 | $(script-hook/$*) |
0cd3b798 | 443 | endif |
67b1a15a MW |
444 | |
445 | all:: $(addprefix $(HOME)/bin/, $(SCRIPTLINKS)) | |
446 | ||
447 | ###-------------------------------------------------------------------------- | |
448 | ### Building packages from source tarballs. | |
449 | ||
450 | SRCDIR = $(HOME)/src/profile | |
451 | ||
452 | pkg-builddir = $(SRCDIR)/$1/build | |
453 | pkg-stamp = $(call pkg-builddir,$1)/$2-stamp | |
454 | ||
455 | $(foreach p, $(PACKAGES), $(eval DEP_$p = $(if $(shell \ | |
456 | if $($p_CHECK) >/dev/null 2>&1 --version; then echo t; fi),, \ | |
457 | $(call pkg-stamp,$p,install)))) | |
458 | ||
459 | $(PACKAGES:%=$(SRCDIR)/%.tar.gz): $(SRCDIR)/%.tar.gz: | |
460 | $(call v_tag,FETCH)mkdir -p $(SRCDIR) && \ | |
461 | rm -f $@.new && \ | |
462 | $(call get-url,$@.new,$(REPO)/$*.tar.gz) && \ | |
463 | mv $@.new $@ | |
464 | ||
465 | $(foreach p, $(PACKAGES), $(call pkg-stamp,$p,unpack)): \ | |
466 | $(call pkg-stamp,%,unpack): $(SRCDIR)/%.tar.gz | |
467 | $(call v_tag,EXTRACT)rm -rf $(SRCDIR)/$* && \ | |
468 | mkdir $(SRCDIR)/$*.tmp-unpack && \ | |
469 | cd $(SRCDIR)/$*.tmp-unpack && \ | |
470 | gzip -cd ../$*.tar.gz | tar xf - && \ | |
471 | mv * ../$* && \ | |
472 | cd .. && \ | |
473 | rmdir $*.tmp-unpack && \ | |
474 | mkdir $*/build && \ | |
475 | touch $*/build/unpack-stamp | |
476 | ||
477 | $(foreach p, $(PACKAGES), $(call pkg-stamp,$p,configure)): \ | |
478 | $(call pkg-stamp,%,configure): \ | |
479 | $(call pkg-stamp,%,unpack) \ | |
480 | $$(foreach p, $$($$*_DEPS), $$(DEP_$$p)) | |
481 | $(call v_tag,CONFIG)cd $(dir $@) && \ | |
482 | ../configure --prefix=$(HOME) \ | |
483 | PKG_CONFIG_PATH=$(HOME)/lib/pkgconfig \ | |
484 | $($*_CONFIG) >>buildlog 2>&1 && \ | |
485 | touch configure-stamp | |
486 | ||
487 | $(foreach p, $(PACKAGES), $(call pkg-stamp,$p,build)): \ | |
488 | $(call pkg-stamp,%,build): \ | |
489 | $(call pkg-stamp,%,configure) | |
490 | $(call v_tag,BUILD)cd $(dir $@) && \ | |
491 | $(MAKE) $($*_MAKEFLAGS) >>buildlog 2>&1 && \ | |
492 | touch build-stamp | |
493 | ||
494 | $(foreach p, $(PACKAGES), $(call pkg-stamp,$p,install)): \ | |
495 | $(call pkg-stamp,%,install): \ | |
496 | $(call pkg-stamp,%,build) | |
497 | $(call v_tag,INSTALL)cd $(dir $@) && \ | |
498 | $(MAKE) $($*_MAKEFLAGS) install >>buildlog 2>&1 && \ | |
499 | touch install-stamp | |
f6c3a80b | 500 | $(package-hook/$*) |
67b1a15a MW |
501 | |
502 | all:: $(foreach p, $(PACKAGES), $(DEP_$p)) | |
503 | $(foreach p, $(PACKAGES), $(eval _pkg.$p: $(call pkg-stamp,$p,install))) | |
504 | ||
505 | ###----- That's all, folks -------------------------------------------------- |