MAKEFLAGS := --no-builtin-rules
+SHELL := /bin/bash
DEPS := $(wildcard deps/*)
ifeq ($(shell uname),Darwin)
+ GREP := ggrep
SED := gsed
DIFF := $(shell gls -t1 /usr/local/Cellar/diffutils/*/bin/diff | head -1)
else
+ GREP := grep
SED := sed
DIFF := diff
endif
home \
diff \
pull \
- mpdconf \
+ push \
+ dirs \
+ pkgs_void \
+ pkgs_void_update \
pkgs_brew_cask_install \
pkgs_brew_install \
pkgs_cargo \
@echo '================================================================================'
@exit 1
-home: mpdconf compiled
+home: compiled dirs
cp -Rp bin $(HOME)/
- # Limit depth because directories are copied recursively:
- find home -maxdepth 1 -print0 \
- | grep -zv '^home$$' \
- | xargs -0 -I% cp -Rp % ~
-
-mpdconf:
- @mkdir -p ~/Archives/Audio
- @mkdir -p ~/var/lib/mpd/playlists
- @mkdir -p ~/var/log/mpd
- @mkdir -p ~/var/run/mpd
- @cp home/.mpdconf $(HOME)/
+ $(MAKE) push
+ xdg-user-dirs-update
+
+dirs:
+ mkdir -p ~/arc/aud
+ mkdir -p ~/arc/img
+ mkdir -p ~/arc/vid
+ mkdir -p ~/dl
+ mkdir -p ~/doc
+ mkdir -p ~/proj/{pub,priv}
+ mkdir -p ~/var/lib/mpd/playlists
+ mkdir -p ~/var/log/mpd
+ mkdir -p ~/var/run/mpd
compiled:
mkdir -p bin
mv src/clockloop bin/
font_cache:
- @fc-cache -fv
+ fc-cache -fv
+
+#
+# Void Linux
+#
+
+pkgs_void:
+ sudo xbps-install $(shell ./list pkgs-void.list)
+
+pkgs_void_update:
+ xbps-query -m | awk -F - '{sub("-" $$NF "$$", ""); print}' | sort -u | grep -vf <(./list -v sep='\n' -v end='\n' pkgs-void-src.list) > pkgs-void.list
+ (echo '#'; ./patch-comments pkgs-void.list.comments pkgs-void.list) | sponge pkgs-void.list
#
# Golang
#
pkgs_golang: list pkgs-golang.list
- go get $(shell ./list pkgs-golang.list)
+ go get -u $(shell ./list pkgs-golang.list)
#
# Ubuntu
# PIP
#
pkgs_pip_install:
- pip3 install --user $(shell ./list pkgs-pip.list)
+ pip install --user $(shell ./list pkgs-pip.list)
pkgs_pip_upgrade:
- pip3 install --user --upgrade $(shell ./list pkgs-pip.list)
+ pip install --user --upgrade $(shell ./list pkgs-pip.list)
#
# Rust (cargo)
diff:
find home -type f -print0 \
| $(SED) -z 's/^home\///g' \
- | xargs -0 -I% sh -c 'echo %; $(DIFF) --color=always ~/% home/%'
+ | sort -zr \
+ | xargs -0 -I% sh -c 'echo %; $(DIFF) --color=auto ~/% home/%'
pull:
find home -type f -print0 \
| $(SED) -z 's/^home\///g' \
| xargs -0 -I% sh -c '$(DIFF) -q ~/% home/% > /dev/null || cp ~/% home/%'
+push:
+ # TODO Backup files before replacing.
+ # But - recursive copy is not a good strategy for this.
+ # Need to do a file by file pass, like the diff recipe.
+ #
+ # Limit depth because directories are copied recursively:
+ find home -maxdepth 1 -print0 \
+ | $(GREP) -zv '^home$$' \
+ | xargs -0 -I% cp -Rp % ~
+
clean:
rm -rf ./debfiles
cd src && make clean