-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
130 lines (110 loc) · 3.33 KB
/
Makefile
File metadata and controls
130 lines (110 loc) · 3.33 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
119
120
121
122
123
124
125
126
127
128
129
130
SHELL = /bin/sh
ifeq ($(PREFIX),)
PREFIX := /usr/local
endif
MANPREFIX := $(PREFIX)/share/man
QUICKLISP_DIR := ~/quicklisp
define SYSTEMD_SERVICE_CONTENTS
[Unit]
Description=thinklucent service
StartLimitIntervalSec=0
[Service]
Type=simple
Restart=always
RestartSec=1
User=root
ExecStart=$(PREFIX)/bin/thinklucent
[Install]
WantedBy=multi-user.target
endef
export SYSTEMD_SERVICE_CONTENTS
help:
@echo "Use one of the following options:"
@echo " - install"
@echo " - uninstall"
@echo " - reinstall"
@echo " - update"
crater-get:
@echo "Setting up Crater for temporary use..."
git clone https://github.com/crater-space/cli /tmp/crater-cli
primary-deps:
@echo "Making sure SBCL is installed..."
ifneq ($(shell command -v sbcl),)
@echo "SBCL found."
else
@echo "SBCL not found!"
@echo "Attempting to install SBCL using Crater..."
/tmp/crater-cli/crater install sbcl
endif
secondary-deps:
@echo "Looking for 'libfixposix'..."
ifneq ($(shell command -v libfixposix),)
@echo "'libfixposix' found."
else
@echo "'libfixposix' not found!"
@echo "Attempting to install 'libfixposix' using Crater..."
/tmp/crater-cli/crater install libfixposix
endif
crater-remove:
@echo "Removing Crater..."
rm -rf /tmp/crater-cli
req: crater-get primary-deps secondary-deps crater-remove
quicklisp:
ifeq ("$(wildcard $(QUICKLISP_DIR))", "")
@echo "Setting up Quicklisp..."
curl https://beta.quicklisp.org/quicklisp.lisp -o /tmp/quicklisp.lisp
sbcl --load /tmp/quicklisp.lisp --non-interactive --eval "(quicklisp-quickstart:install)"
sbcl --load ~/quicklisp/setup.lisp --non-interactive --eval "(ql:add-to-init-file)"
else
@echo "Quicklisp found."
endif
binary:
@echo "Generating binary..."
sbcl --non-interactive --load build.lisp
@echo "Binary generated."
place:
@echo "Installing binary..."
sudo install ./thinklucent-bin $(PREFIX)/bin/thinklucent
sudo install ./scripts/* $(PREFIX)/bin/
@echo "Binary installed."
manpage:
@echo "Creating manpage..."
sudo mkdir -p $(MANPREFIX)/man1
sudo cp ./man/thinklucent.1 $(MANPREFIX)/man1/
@echo "Manpage created."
service:
@echo "Looking for a known init system..."
ifneq ($(shell command -v runit),)
@echo "'Runit' found. Attempting to create a service..."
sudo mkdir /etc/sv/thinklucent
sudo ln -s $(PREFIX)/bin/thinklucent /etc/sv/thinklucent/run
sudo ln -s /etc/sv/thinklucent /var/service
@echo "Runit service created and started."
else ifneq ($(shell command -v systemctl),)
@echo "'SystemD' found. Attempting to create a service..."
@echo "$$SYSTEMD_SERVICE_CONTENTS" | sudo tee /etc/systemd/system/thinklucent.service
systemctl enable thinklucent.service
systemctl start thinklucent.service
@echo "SystemD service created and started."
else
@echo "No known init system found."
endif
install: req quicklisp binary place manpage service
@echo "thinklucent is now installed."
uninstall:
@echo "Uninstalling thinklucent..."
sudo rm $(PREFIX)/bin/thinklucent*
sudo rm $(MANPREFIX)/man1/thinklucent.1
ifneq ($(shell command -v runit),)
sudo rm -rf /var/service/thinklucent
sudo rm -rf /etc/sv/thinklucent
else ifneq ($(shell command -v systemctl),)
systemctl stop thinklucent.service
systemctl disable thinklucent.service
sudo rm -rf /etc/systemd/system/thinklucent.service
endif
@echo "thinklucent has been uninstalled."
reinstall: uninstall install
get-latest:
git pull origin main
update: get-latest reinstall