confOS/Makefile

110 lines
2.7 KiB
Makefile

# Version control
VC = git
# Downloaders
WGET = wget -q --show-progress
CURL = curl -s
# Checkers
ARCH = $(shell grep -c "archlinux" /proc/version)
WSL = $(shell grep -c "WSL2" /proc/version)
# Hide some verbose messages from Make
MAKEFLAGS += --no-print-directory
all: full-sync
# Pull latest changes
refresh:
@echo Pull latest changes from repository...
@$(VC) pull
@echo
# Pull and sync
full-sync:
@$(MAKE) refresh
@$(MAKE) sync
# === All platforms ==
# .config
sync-dotconfig:
# Fish
@mkdir -p $(HOME)/.config/fish/conf.d
@mkdir -p $(HOME)/.config/fish/functions
@$(WGET) https://git.mylloon.fr/Anri/confOS/raw/branch/main/.config/fish/functions/fish_prompt.fish -O $(HOME)/.config/fish/functions/fish_prompt.fish
@$(WGET) https://git.mylloon.fr/Anri/confOS/raw/branch/main/.config/fish/conf.d/promp_color.fish -O $(HOME)/.config/fish/conf.d/promp_color.fish
@$(WGET) https://git.mylloon.fr/Anri/confOS/raw/branch/main/.config/fish/conf.d/abbr.fish -O $(HOME)/.config/fish/conf.d/abbr.fish
# Micro
@$(WGET) https://git.mylloon.fr/Anri/confOS/raw/branch/main/.config/micro/settings.json -O $(HOME)/.config/micro/settings.json
# END
@echo .config directory synced!
@echo
# .emacs.d
sync-emacs:
@mkdir -p $(HOME)/.emacs.d
@$(WGET) https://git.mylloon.fr/Anri/confOS/raw/branch/main/.emacs.d/init.el -O $(HOME)/.emacs.d/init.el
# END
@echo Emacs config synced!
@echo
# .dotfiles
sync-dotfiles:
# .gitconfig
@$(WGET) https://git.mylloon.fr/Anri/confOS/raw/branch/main/dotfiles/.gitconfig -O $(HOME)/.gitconfig
# .ocamlformat
@$(WGET) https://git.mylloon.fr/Anri/confOS/raw/branch/main/dotfiles/.ocamlformat -O $(HOME)/.ocamlformat
# .clang-format
@$(WGET) https://git.mylloon.fr/Anri/confOS/raw/branch/main/dotfiles/.clang-format -O $(HOME)/.clang-format
# End
@echo dotfiles synced!
@echo
# === Specific platforms ==
sync:
# Check if at least the platform is supported
ifneq (1, $(filter 1, $(ARCH) $(WSL)))
@echo Unsupported platform
else
# Call target of compatible with all supported platforms
@$(MAKE) sync-dotconfig
@$(MAKE) sync-dotfiles
@$(MAKE) sync-emacs
# Specific to Arch
ifeq ($(ARCH), 1)
# Fish
@$(WGET) https://git.mylloon.fr/Anri/confOS/raw/branch/main/.config/fish/config_wsl.fish -O $(HOME)/.config/fish/config.fish
# Specific to WSL
else ifeq ($(WSL), 1)
# Fish
@$(WGET) https://git.mylloon.fr/Anri/confOS/raw/branch/main/.config/fish/config_wsl.fish -O $(HOME)/.config/fish/config.fish
@$(CURL) https://git.mylloon.fr/Anri/confOS/raw/branch/main/.config/fish/conf.d/abbr_wsl.fish >> $(HOME)/.config/fish/conf.d/abbr.fish
# Unison
@mkdir -p $(HOME)/.unison
@$(WGET) https://git.mylloon.fr/Anri/confOS/raw/branch/main/.unison/default.prf -O $(HOME)/.unison/default.prf
endif
# END
@echo 🎉 Sync complete!
endif