X-Git-Url: https://git.xandkar.net/?p=khome.git;a=blobdiff_plain;f=Makefile;h=563f6f4ac688506a17f6cf378b22e5e6da513eb1;hp=e576ff79dc25e1b362d5b433b0527124727a09f9;hb=HEAD;hpb=dee031b5392c3b1bcf0e5555c7e65e061751415e diff --git a/Makefile b/Makefile index e576ff7..7a32ec4 100644 --- a/Makefile +++ b/Makefile @@ -1,11 +1,14 @@ 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 @@ -18,7 +21,10 @@ endif home \ diff \ pull \ - mpdconf \ + push \ + dirs \ + pkgs_void \ + pkgs_void_update \ pkgs_brew_cask_install \ pkgs_brew_install \ pkgs_cargo \ @@ -26,7 +32,8 @@ endif pkgs_deb_purge \ pkgs_debian \ pkgs_mac \ - pkgs_pip \ + pkgs_pip_install \ + pkgs_pip_upgrade \ pkgs_snap_classic \ pkgs_snap_strict @@ -36,25 +43,13 @@ default: @echo '================================================================================' @exit 1 -home: mpdconf compiled - @cp -Rp bin $(HOME)/ - @cp -Rp home/bin $(HOME)/ - @cp -Rp home/lib $(HOME)/ - @cp home/.compton.conf $(HOME)/ - @cp -Rp home/.config/ $(HOME)/ - @cp -Rp home/.newsboat/ $(HOME)/ - @cp home/.profile $(HOME)/ - @cp home/.fonts.conf $(HOME)/ - @cp home/.Rprofile $(HOME)/ - @cp home/.tmux.conf $(HOME)/ - @cp home/.xbindkeysrc $(HOME)/ - -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)/ +home: compiled dirs + cp -Rp bin $(HOME)/ + $(MAKE) push + xdg-user-dirs-update + +dirs: + mkdir -p $(shell ./list dirs) compiled: mkdir -p bin @@ -62,13 +57,32 @@ compiled: mv src/clockloop bin/ font_cache: - @fc-cache -fv + fc-cache -fv + +# +# Void Linux +# + +pkgs_void: + sudo xbps-install $(shell ./list pkgs-void.list) + +# Mark $pkg as manually-installed: +# +# sudo xbps-pkgdb -m manual $pkg +# +# List manually-installed packages: +# +# xbps-query -m +# +pkgs_void_update: + xbps-query -m | awk -F - '{sub("-" $$NF "$$", ""); print}' | sort -fu | 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 install $(shell ./list pkgs-golang.list) # # Ubuntu @@ -82,8 +96,11 @@ pkgs_ubuntu_debfiles: list pkgs-ubuntu-debfiles.list # # PIP # -pkgs_pip: - sudo pip3 install $(shell ./list pkgs-pip.list) +pkgs_pip_install: + pip install --user $(shell ./list pkgs-pip.list) + +pkgs_pip_upgrade: + pip install --user --upgrade $(shell ./list pkgs-pip.list) # # Rust (cargo) @@ -146,13 +163,28 @@ $(foreach d,$(DEPS),$(eval $(call GEN_DEP_RULE,$(d)))) 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/%' + +.PHONY: diff_bins_untracked +diff_bins_untracked: + ls -1 ~/bin | sort | grep -vf <(ls -1 home/bin | sort) 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