2019-11-28 10:02:40 +00:00
|
|
|
GIT_BIN=/usr/bin/git
|
|
|
|
PACKAGE=git
|
|
|
|
|
2019-11-28 10:10:46 +00:00
|
|
|
CUSTOM_BINS= $(wildcard bin/*)
|
|
|
|
|
2019-11-28 10:02:40 +00:00
|
|
|
GIT_CONFIG=config
|
|
|
|
GIT_CONFIG_OUT=$(HOME)/.config/git/config
|
|
|
|
GIT_GLOBAL_CONFIG=$(HOME)/.gitconfig
|
|
|
|
CONFIG_DIR=$(HOME)/.config/git
|
2019-11-28 10:10:46 +00:00
|
|
|
HOME_BIN_DIR=$(HOME)/bin
|
2019-11-28 10:02:40 +00:00
|
|
|
|
|
|
|
ROOT_APT=sudo aptitude
|
|
|
|
|
|
|
|
OUT=$(GIT_CONFIG_OUT)
|
|
|
|
|
|
|
|
.PHONY: clean_install
|
|
|
|
|
2019-11-28 10:10:46 +00:00
|
|
|
clean_install: clean install
|
|
|
|
install: $(GIT_BIN) install_bins config
|
|
|
|
clean: clean_config clean_package clean_bins
|
2019-11-28 10:02:40 +00:00
|
|
|
|
|
|
|
$(GIT_BIN):
|
|
|
|
$(ROOT_APT) install $(PACKAGE)
|
|
|
|
|
2019-11-28 10:10:46 +00:00
|
|
|
install_bins: $(HOME_BIN_DIR)
|
|
|
|
cp $(CUSTOM_BINS) $(HOME_BIN_DIR)
|
|
|
|
|
2019-11-28 10:02:40 +00:00
|
|
|
.ONESHELL:
|
|
|
|
config: $(CONFIG_DIR) $(GIT_BIN)
|
|
|
|
ifeq ("$(wildcard $(GIT_GLOBAL_CONFIG))","")
|
|
|
|
rm -f $(GIT_CONFIG_OUT)
|
|
|
|
echo "Please provide email address for git"
|
|
|
|
read EMAIL
|
|
|
|
git config --global user.email $${EMAIL}
|
|
|
|
endif
|
|
|
|
cp $(GIT_CONFIG) $(GIT_CONFIG_OUT)
|
|
|
|
|
|
|
|
$(CONFIG_DIR):
|
|
|
|
mkdir -p $(CONFIG_DIR)
|
|
|
|
|
2019-11-28 10:10:46 +00:00
|
|
|
$(HOME_BIN_DIR):
|
|
|
|
mkdir -p $(HOME_BIN_DIR)
|
|
|
|
|
2019-11-28 10:02:40 +00:00
|
|
|
clean_package:
|
|
|
|
$(ROOT_APT) purge $(PACKAGE)
|
|
|
|
|
|
|
|
clean_config:
|
|
|
|
rm -f $(GIT_CONFIG_OUT)
|
|
|
|
|
2019-11-28 10:10:46 +00:00
|
|
|
clean_bins:
|
|
|
|
rm -f $(CUSTOM_BINS:bin%=$(HOME_BIN_DIR)%)
|