From 2c3cb2a53f4788160927ab186044f07c7faada2b Mon Sep 17 00:00:00 2001 From: Mylloon Date: Sun, 19 Mar 2023 19:56:45 +0100 Subject: [PATCH] Check if platform is supported --- Makefile | 45 ++++++++++++++++++++++++++++++--------------- 1 file changed, 30 insertions(+), 15 deletions(-) diff --git a/Makefile b/Makefile index cee0027..ff3ad4e 100644 --- a/Makefile +++ b/Makefile @@ -5,6 +5,10 @@ VC = git 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 @@ -21,6 +25,8 @@ full-sync: @$(MAKE) refresh @$(MAKE) sync + + # === All platforms == # .config @@ -51,12 +57,6 @@ sync-emacs: @echo Emacs config synced! @echo -# .mozilla -sync-mozilla: -# END - @echo Firefox config synced! - @echo - # .dotfiles sync-dotfiles: # .gitconfig @@ -72,24 +72,39 @@ sync-dotfiles: @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 -ifeq ($(shell grep -c "archlinux" /proc/version), 1) -# Arch - @$(MAKE) sync-mozilla -else ifeq ($(shell grep -c "WSL" /proc/version), 1) -# WSL + + +# 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 - -# 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 # END @echo 🎉 Sync complete! +endif