-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
131 lines (111 loc) · 4.65 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
# Copyright 2019-2020 Felix Soubelet <[email protected]>
# MIT License
# Documentation for most of what you will see here can be found at the following links:
# for the GNU make special targets: https://www.gnu.org/software/make/manual/html_node/Special-Targets.html
# ANSI escape sequences for bold, cyan, dark blue, end, pink and red.
B = \033[1m
C = \033[96m
D = \033[34m
E = \033[0m
P = \033[95m
R = \033[31m
BAT_CONFIG := $(shell bat --config-file)
DOTFILES_DIR := $(shell pwd)
UNAME := $(shell uname -s)
ifeq ($(UNAME), Darwin)
OS := macos
else ifeq ($(UNAME), Linux)
OS := linux
endif
all: install
install: $(OS)
.PHONY: help miniforge brew defaults link linux macos unlink zsh
help:
@echo "Dotfiles Makefile. Please use 'make $(R)<target>$(E)' where $(R)<target>$(E) is one of:"
@echo " $(R) $(OS) $(E) to run all installation steps."
@echo " $(R) link $(E) to create symbolic links for configuration files."
@echo " $(R) unlink $(E) to remove symbolic links created by 'make link'."
@echo " $(R) brew $(E) to install Homebrew if not present already, and install packages listed in the Brewfile."
@echo " $(R) defaults $(E) to change macos defaults as specified in 'macos/macos_defaults.sh'."
@echo " $(R) miniforge $(E) to install the latest miniforge distribution."
# @echo " $(R) omz $(E) to install oh-my-zsh and required plugin files if not present already."
@echo " $(R) unlink $(E) to remove symlink to configuration files."
@echo " $(R) zsh $(E) to switch to the Z shell."
linux:
@echo "This is not yet implemented."
macos:
@echo "Installing Xcode command-line tools."
@xcode-select --install
@softwareupdate -ai
@make cargo
@make brew
@make miniforge
@make zsh
# @make omz
@make link
miniforge:
@echo "$(B)Downloading native miniforge distribution.$(E)"
@curl -L -O "https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-$(uname)-$(uname -m).sh"
@echo "$(B)Installing miniforge distribution.$(E)"
@bash bash Miniforge3-$(uname)-$(uname -m).sh -b -p $(HOME)/.miniforge # batch install mode, specify prefix
@echo "$(B)Removing installer from disk.$(E)"
@rm -rf bash Miniforge3-$(uname)-$(uname -m).sh
brew:
@echo "$(B)Checking valid Homebrew installation.$(E)"
@bash ${DOTFILES_DIR}/macos/homebrew_install.sh
@brew analytics off
@echo "$(B)Installing Homebrew packages from Brewfile.$(E)"
@cd $(DOTFILES_DIR)/macos; brew bundle; cd $(DOTFILES_DIR)
@rm -rf $(DOTFILES_DIR)/macos/Brewfile.lock.json
@sudo gem install colorls
cargo:
@echo "$(B)Installing Rust and Cargo.$(E)"
@curl https://sh.rustup.rs -sSf | sh
@echo "$(B)Installing relevant packages from Cargo.$(E)"
@cargo install bat exa tealdeer artem difftastic
defaults:
@echo "Changing some macos defaults according to configuration file."
@echo "Make sure you customize this file to your needs.$(E)."
@bash $(DOTFILES_DIR)/macos/defaults.sh
link:
@echo "Linking tmux configuration file to home folder."
@ln -nfs ${DOTFILES_DIR}/tmux.conf $(HOME)/.tmux.conf
@echo "Linking .zshrc to home folder."
@ln -nfs ${DOTFILES_DIR}/zsh/zshrc $(HOME)/.zshrc
@echo "Linking zsh plugins file to home folder."
@ln -nfs ${DOTFILES_DIR}/zsh/plugins.zsh $(HOME)/.zsh_plugins.txt
@echo "Linking git configuration files to home folder."
@ln -nfs ${DOTFILES_DIR}/git/gitconfig $(HOME)/.gitconfig
@ln -nfs ${DOTFILES_DIR}/git/gitignore_global $(HOME)/.gitignore_global
@echo "Linking .vimrc to home folder."
@ln -nfs ${DOTFILES_DIR}/vim/vimrc $(HOME)/.vimrc
@mkdir -p $(HOME)/.config/nvim
@ln -nfs ${DOTFILES_DIR}/vim/init.vim $(HOME)/.config/nvim/init.vim
@echo "Linking Brewfile to home folder."
@ln -nfs ${DOTFILES_DIR}/macos/Brewfile $(HOME)/.Brewfile
@echo "Linking SSH config file."
@ln -nfs ${DOTFILES_DIR}/configs/ssh_config $(HOME)/.ssh/config
@echo "Linking configuration files."
@ln -nfs ${DOTFILES_DIR}/configs/bat_config $(shell bat --config-file)
@ln -nfs ${DOTFILES_DIR}/configs/htoprc $(HOME)/.config/htop/htoprc
@ln -nfs ${DOTFILES_DIR}/configs/starship.toml $(HOME)/.config/starship.toml
# omz:
# @echo "$(B)Checking valid oh-my-zsh installation.$(E)"
# @bash ${DOTFILES_DIR}/zsh/omz_install.sh
# @echo "$(B)Installing required plugins.$(E)"
# @bash ${DOTFILES_DIR}/zsh/omz_plugins.sh
unlink:
@echo "$(B)Removing symlinks.$(E)"
@unlink $(HOME)/.tmux.conf
@unlink $(HOME)/.zshrc
@unlink $(HOME)/.zsh_plugins.txt
@unlink $(HOME)/.gitconfig
@unlink $(HOME)/.gitignore_global
@unlink $(HOME)/.vimrc
@unlink $(HOME)/.Brewfile
@unlink $(HOME)/.ssh/config
@unlink $(HOME)/.config/bat/config
zsh:
@echo "$(B)Switching to the Z shell.$(E)"
@sudo sh -c "echo $(which zsh) >> /etc/shells"
@chsh -s $(which zsh)