-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
49 lines (35 loc) · 1.34 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
SHELL = /bin/bash
DOTFILES_DIR := $(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
PATH := $(DOTFILES_DIR)/scripts/dot-bin:$(PATH)
PACKAGES = $(shell find $(DOTFILES_DIR) \
! -path $(DOTFILES_DIR) ! -path $(DOTFILES_DIR)/.git \
-maxdepth 1 -type d -exec basename {} +)
.PHONY: $(PACKAGES)
ifeq ($(shell uname),Darwin)
OS := macos
else
OS := linux
endif
install: link-all setup-neovim setup-devenv
link-all: stow-$(OS) $(addprefix link-,$(PACKAGES))
unlink-all: stow-$(OS) $(addprefix unlink-,$(PACKAGES))
$(addprefix link-,$(PACKAGES)): stow-$(OS)
stow --target $(HOME) --dotfiles $(@:link-%=%)
$(addprefix unlink-,$(PACKAGES)): stow-$(OS)
stow --target $(HOME) --delete --dotfiles $(@:unlink-%=%)
setup-devenv: compose_path = /usr/local/etc/devenv
setup-devenv:
[ -d $(compose_path) ] || mkdir $(compose_path)
[ -L $(compose_path)/docker-compose.yml ] && echo "devenv already configured" || \
ln -s $(DOTFILES_DIR)/docker-compose.yml $(compose_path)/docker-compose.yml
setup-neovim:
is-executable nvim && nvim +PlugInstall +qall || echo "Neovim is not installed"
stow-macos: brew
is-executable stow || brew install stow
stow-linux: apt
is-executable stow || apt-get -y install stow
brew:
is-executable brew || curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh | bash
apt:
apt-get update
apt-get upgrade -y