X-Git-Url: https://git.xandkar.net/?a=blobdiff_plain;f=Makefile;h=6f97234cf92cad295ea2550a9fcbfebbdf4b02f5;hb=5bf7b45d8c7d084400907dc26c53c5acbe5d34c6;hp=c47c4ead516b71fd9ed3e4b45ea65073f156e6bb;hpb=d101fbe94d6abb5e08fe4df7dfc99b6380025da6;p=khome.git diff --git a/Makefile b/Makefile index c47c4ea..6f97234 100644 --- a/Makefile +++ b/Makefile @@ -1,28 +1,134 @@ MAKEFLAGS := --no-builtin-rules -DPKG_SELECTIONS := system/debian/dpkg-selections -APT_SOURCES := system/debian/apt-sources.list - -.PHONY: update install install_packages - -install: - @cp -Rp home/bin $(HOME)/ - @cp -Rp home/lib $(HOME)/ - @cp -Rp home/.config/ $(HOME)/ - @cp home/.profile $(HOME)/ - @cp home/.fonts.conf $(HOME)/ - @fc-cache $(HOME)/.fonts - @cp home/.xbindkeysrc $(HOME)/ - -# May still need to run: -# 1. dselect update -# 2. interactive dselect with install, -# 3. apt update -# 4. apt upgrade -install_packages: $(DPKG_SELECTIONS) - @dpkg --set-selections < $< - @apt-get -u dselect-upgrade - -update: - @dpkg --get-selections > $(DPKG_SELECTIONS) - @cp /etc/apt/sources.list $(APT_SOURCES) +DEPS := $(wildcard deps/*) + +.PHONY: \ + default \ + $(DEPS) \ + deps \ + home \ + mpdconf \ + pkgs_brew_cask_install \ + pkgs_brew_install \ + pkgs_deb_install \ + pkgs_deb_purge \ + pkgs_debian \ + pkgs_mac \ + pkgs_pip \ + pkgs_snap_classic \ + pkgs_snap_strict + +default: + @echo '================================================================================' + @echo '| Default target disabled. Specify a concrete one.' + @echo '================================================================================' + @exit 1 + +home: mpdconf + @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)/ + @fc-cache -fv + @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)/ + +# +# Golang +# +pkgs_golang: list pkgs-golang.list + go get $(shell ./list pkgs-golang.list) + +# +# Ubuntu +# +pkgs_ubuntu: list pkgs-ubuntu.list + sudo apt install $(shell ./list pkgs-ubuntu.list) + +# +# PIP +# +pkgs_pip: + sudo pip3 install $(shell ./list pkgs-pip.list) + +# +# Homebrew/Mac +# + +pkgs_mac: + $(MAKE) pkgs_brew_install + $(MAKE) pkgs_brew_cask_install + +# TODO: Test pkgs_brew_tap when list contains multiple items +pkgs_brew_tap: list pkgs-brew-tap.list + brew tap $(shell ./list pkgs-brew-tap.list) + +pkgs_brew_install: list pkgs-brew-install.list + brew install $(shell ./list pkgs-brew-install.list) + +pkgs_brew_cask_install: list pkgs-brew-cask-install.list + brew cask install $(shell ./list pkgs-brew-cask-install.list) + +# +# Debian +# +pkgs_deb_install: list pkgs-deb-install.list + sudo apt install $(shell ./list pkgs-deb-install.list) + +pkgs_deb_purge: list pkgs-deb-purge.list + sudo apt purge $(shell ./list pkgs-deb-purge.list) + +# +# Snap +# +pkgs_snap_classic: list pkgs-snap-classic.list + @$(MAKE) $(foreach p,$(shell ./list pkgs-snap-classic.list),pkg_snap_classic_$(p)) + +pkgs_snap_strict: list pkgs-snap-strict.list + @$(MAKE) $(foreach p,$(shell ./list pkgs-snap-strict.list),pkg_snap_strict_$(p)) + +# 'snap' command comes from 'snapd' deb pkg +pkg_snap_classic_%: + sudo snap install --classic $* +pkg_snap_strict_%: + sudo snap install $* + +deps: $(DEPS) + +define GEN_DEP_RULE +$(1): + cd $1 && make +endef + +$(foreach d,$(DEPS),$(eval $(call GEN_DEP_RULE,$(d)))) + +diff: + diff $(HOME)/.Rprofile home/.Rprofile || true + diff $(HOME)/.compton.conf home/.compton.conf || true + diff $(HOME)/.config/dunst/dunstrc home/.config/dunst/dunstrc || true + diff $(HOME)/.config/mimeapps.list home/.config/mimeapps.list || true + diff $(HOME)/.config/neofetch/config.conf home/.config/neofetch/config.conf || true + diff $(HOME)/.config/ranger/rc.conf home/.config/ranger/rc.conf || true + diff $(HOME)/.config/screengrab/screengrab.conf home/.config/screengrab/screengrab.conf || true + diff $(HOME)/.fonts.conf home/.fonts.conf || true + diff $(HOME)/.mpdconf home/.mpdconf || true + diff $(HOME)/.newsboat/config home/.newsboat/config || true + diff $(HOME)/.profile home/.profile || true + diff $(HOME)/.tmux.conf home/.tmux.conf || true + diff $(HOME)/.xbindkeysrc home/.xbindkeysrc || true + diff $(HOME)/lib/login_aliases.sh home/lib/login_aliases.sh || true + diff $(HOME)/lib/login_functions.sh home/lib/login_functions.sh || true + diff $(HOME)/lib/login_variables.sh home/lib/login_variables.sh || true + diff $(HOME)/lib/login_variables_dpi_high.sh home/lib/login_variables_dpi_high.sh || true + diff $(HOME)/lib/login_variables_dpi_norm.sh home/lib/login_variables_dpi_norm.sh || true