Check if platform is supported

This commit is contained in:
Mylloon 2023-03-19 19:56:45 +01:00
parent b9d8a7064e
commit 2c3cb2a53f
Signed by: Anri
GPG key ID: A82D63DFF8D1317F

View file

@ -5,6 +5,10 @@ VC = git
WGET = wget -q --show-progress WGET = wget -q --show-progress
CURL = curl -s CURL = curl -s
# Checkers
ARCH = $(shell grep -c "archlinux" /proc/version)
WSL = $(shell grep -c "WSL2" /proc/version)
# Hide some verbose messages from Make # Hide some verbose messages from Make
MAKEFLAGS += --no-print-directory MAKEFLAGS += --no-print-directory
@ -21,6 +25,8 @@ full-sync:
@$(MAKE) refresh @$(MAKE) refresh
@$(MAKE) sync @$(MAKE) sync
# === All platforms == # === All platforms ==
# .config # .config
@ -51,12 +57,6 @@ sync-emacs:
@echo Emacs config synced! @echo Emacs config synced!
@echo @echo
# .mozilla
sync-mozilla:
# END
@echo Firefox config synced!
@echo
# .dotfiles # .dotfiles
sync-dotfiles: sync-dotfiles:
# .gitconfig # .gitconfig
@ -72,24 +72,39 @@ sync-dotfiles:
@echo dotfiles synced! @echo dotfiles synced!
@echo @echo
# === Specific platforms == # === Specific platforms ==
sync: 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-dotconfig
@$(MAKE) sync-dotfiles @$(MAKE) sync-dotfiles
@$(MAKE) sync-emacs @$(MAKE) sync-emacs
ifeq ($(shell grep -c "archlinux" /proc/version), 1)
# Arch
@$(MAKE) sync-mozilla # Specific to Arch
else ifeq ($(shell grep -c "WSL" /proc/version), 1) ifeq ($(ARCH), 1)
# WSL # 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 @mkdir -p $(HOME)/.unison
@$(WGET) https://git.mylloon.fr/Anri/confOS/raw/branch/main/.unison/default.prf -O $(HOME)/.unison/default.prf @$(WGET) https://git.mylloon.fr/Anri/confOS/raw/branch/main/.unison/default.prf -O $(HOME)/.unison/default.prf
# Specific
@$(WGET) https://git.mylloon.fr/Anri/confOS/raw/branch/main/.config/fish/config_wsl.fish -O $(HOME)/.config/fish/config.fish_prompt
@$(CURL) https://git.mylloon.fr/Anri/confOS/raw/branch/main/.config/fish/conf.d/abbr_wsl.fish >> $(HOME)/.config/fish/conf.d/abbr.fish
endif endif
# END # END
@echo 🎉 Sync complete! @echo 🎉 Sync complete!
endif