-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
67 lines (48 loc) · 1.4 KB
/
Makefile
File metadata and controls
67 lines (48 loc) · 1.4 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
BINARY_NAME=pikafileservice
MAIN_FILE=Main.go
SERVICE_NAME=pikafileservice
.PHONY: build clean install test run build-tools service-install service-uninstall service-start service-stop service-restart service-status service-logs
# Build targets
build:
go build -o ${BINARY_NAME}
build-release:
CGO_ENABLED=0 GOOS=linux go build -a -ldflags '-extldflags "-static"' -o ${BINARY_NAME}
build-tools:
cd tools && go build -o test_pikacloud test_pikacloud.go
clean:
go clean
rm -f ${BINARY_NAME}
rm -f tools/test_pikacloud
test:
go test ./...
run:
go run ${MAIN_FILE}
# Service management targets
service-install: build
sudo ./install_service.sh
service-uninstall:
sudo ./uninstall_service.sh
service-start:
sudo systemctl start ${SERVICE_NAME}
service-stop:
sudo systemctl stop ${SERVICE_NAME}
service-restart:
sudo systemctl restart ${SERVICE_NAME}
service-status:
sudo systemctl status ${SERVICE_NAME} --no-pager
service-logs:
sudo journalctl -u ${SERVICE_NAME} -f
service-enable:
sudo systemctl enable ${SERVICE_NAME}
service-disable:
sudo systemctl disable ${SERVICE_NAME}
# Combined targets
install: build service-install service-enable
@echo "PikaFileService installed and enabled!"
uninstall: service-stop service-disable service-uninstall
@echo "PikaFileService uninstalled!"
# Make scripts executable
setup:
chmod +x install_service.sh
chmod +x uninstall_service.sh
chmod +x manage_service.sh