From c202622d7cc968a13fa9ddc4c0cd93def0b569b7 Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Wed, 11 Feb 2015 02:04:08 +0900 Subject: [PATCH] Makefile: Do not clone repository if currently in that repository --- Makefile | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 67d1e43..faf1e21 100644 --- a/Makefile +++ b/Makefile @@ -10,16 +10,25 @@ use_git ?= t dotfiles_git := git@github.com:10sr/dotfiles.git +current_origin_url := $(shell git config remote.origin.url) + +ifeq ($(current_origin_url), $(dotfiles_git)) +$(warning Currently in dotfiles repository) +dotfiles_dir := $(PWD) +else ifeq (,$(dotfiles_dir)) ifeq (,$(DOTFILES_DIR)) -$(warning Neigher DOTFILES_DIR nor dotfiles_dir not defined.) -$(warning Use $(home)/10sr_dotfiles for default.) +$(warning Neigher DOTFILES_DIR nor dotfiles_dir not defined) +$(warning Use default value) dotfiles_dir := $(home)/10sr_dotfiles else -$(warning dotfiles_dir is set from DOTFILES_DIR: $(DOTFILES_DIR)) +$(warning dotfiles_dir is set from DOTFILES_DIR) dotfiles_dir := $(DOTFILES_DIR) endif endif +endif + +$(warning dotfiles_dir: $(dotfiles_dir)) localdir := $(home)/.local