-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathMakefile
More file actions
118 lines (97 loc) · 3.11 KB
/
Makefile
File metadata and controls
118 lines (97 loc) · 3.11 KB
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
# If you have no idea what you're looking at,
# https://lunarwatcher.github.io/posts/2024/01/06/how-to-set-up-a-makefile-for-managing-dotfiles-and-system-configurations.html
# might help
help:
@echo "Supported targets:"
@echo "dotfiles - install dotfiles only"
@echo "common - install dotfiles and system deps"
@echo "home - same as common with additional software"
@echo "server - same as common with additional software"
@echo "secrets - used alongside the other options to source secrets"
ifeq ($(OS),Windows_NT)
currOs := win
else
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Linux)
currOs := linux
# The distribution should be able to be portably extracted by using
# /etc/os-release
# Note that there are more steps than just parsing this file on certain
# distributions. See
# https://gist.github.com/natefoo/814c5bf936922dad97ff
# for more details and alternatives
currDist := $(shell cat /etc/os-release | sed -n 's/^ID=\(.*\)$$/\1/p')
isWSL := $(shell uname -r | grep -q "WSL2" && echo "WSL2" || echo "NO")
$(info -- WSL detected? $(isWSL))
endif
ifeq ($(UNAME_S),Darwin)
currOs := macos
endif
endif
host := $(shell hostname)
$(info -- Running on host $(host))
$(info -- Detected OS $(currOs))
$(info -- Detected distribution $(currDist))
DEPENDENCY_TARGETS =
DOTFILE_TARGETS =
SOFTWARE_TARGETS =
CLEANUP_TARGETS =
# Group vars
HOME_TARGETS =
SERVER_TARGETS =
WORK_TARGETS =
NON_SERVER_TARGETS =
ifeq ($(isWSL),WSL2)
$(info -- Loading WSL shit)
include make/special/wsl2.mk
endif
# First, check the OS
ifeq ($(currOs),linux)
$(info -- Linux identified)
# On Linux, we pay more attention to the distro than the OS
# Note that this is, strictly speaking, an implementation detail
ifeq ($(currDist),linuxmint)
$(info -- Loading Mint-specific stuff)
include make/distros/mint.mk
# TODO: maybe worth setting this up to load anywhere with flatpak?
include make/packages/flatpak.mk
endif # mint
ifeq ($(currDist),debian)
$(info -- Loading Debian (non-derivative\)-specific stuff)
include make/distros/debian.mk
endif # debian
ifeq ($(currDist),ubuntu)
$(info -- Loading ubuntu-specific stuff)
include make/distros/ubuntu.mk
endif # ubuntu
ifeq ($(currDist),arch)
$(info -- Loading arch-specific stuff)
include make/distros/arch.mk
endif #arch
endif # linux
ifeq ($(currOs),win)
endif
ifeq ($(currOs),macos)
endif
-include make/hosts/$(host).mk
common-dotfiles:
ln -sf ${PWD}/.emacs ${HOME}/.emacs
ln -sf ${PWD}/.condarc ${HOME}/.condarc
mkdir -p ~/.config/zellij
ln -sf ${PWD}/config/zellij/config.kdl ${HOME}/.config/zellij/config.kdl
dependencies: $(DEPENDENCY_TARGETS);
dotfiles: common-dotfiles $(DOTFILE_TARGETS);
software: $(SOFTWARE_TARGETS);
cleanup: $(CLEANUP_TARGETS);
core: dependencies dotfiles software
common: core cleanup
home: core $(HOME_TARGETS) $(NON_SERVER_TARGETS) cleanup
server: core $(SERVER_TARGETS) cleanup
work: core $(WORK_TARGETS) $(NON_SERVER_TARGETS) cleanup
secrets:
git clone git@nova.git:LunarWatcher/secrets
./secrets/bootstrap.sh
include make/packages/intellij.mk
java: jetbrains-toolbox
.PHONY: home server common core cleanup software dotfiles dependencies
# vim:autoindent:noexpandtab:tabstop=4:shiftwidth=4