-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
33 lines (32 loc) · 1.36 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
VERSION := $(shell git describe --tags --always --match='v*')
version := $(shell echo $(VERSION) |grep -Eo '[0-9]+\.[0-9]+\.[0-9]')
run:
go run cmd/tokamakd/main.go -c configs/config.yaml
build:
mkdir build && go build -o build/tokamakd cmd/tokamakd/main.go
install:
mkdir /etc/tokamak
cp -r build/tokamakd /usr/sbin/
cp -r configs/config.yaml /etc/tokamak/
cp -r scripts/tokamakd.service /usr/lib/systemd/system/
systemctl start tokamakd && systemctl enable tokamakd
uninstall:
systemctl stop tokamakd && systemctl disable tokamakd
rm -f /usr/sbin/tokamakd
rm -rf /etc/tokamak
rm -f /usr/lib/systemd/system/tokamakd.service
rpm:
rm -rf ~/rpmbuild/SOURCES/tokamakd-$(version)*
rm -f ~/rpmbuild/SPECS/tokamakd.spec
mkdir -p ~/rpmbuild/SOURCES/tokamakd-$(version)
go build -o ~/rpmbuild/SOURCES/tokamakd-$(version)/tokamakd cmd/tokamakd/main.go
cp -r scripts/tokamakd.service ~/rpmbuild/SOURCES/tokamakd-$(version)/
cp -r configs/config.yaml ~/rpmbuild/SOURCES/tokamakd-$(version)/
cd ~/rpmbuild/SOURCES;tar -cvzf tokamakd-$(version).tar.gz tokamakd-$(version)/;rm -rf tokamakd-$(version)/
cp -r scripts/tokamakd.spec ~/rpmbuild/SPECS/
sed -i 's/1.0.0/$(version)/g' ~/rpmbuild/SPECS/tokamakd.spec
rpmbuild -bb ~/rpmbuild/SPECS/tokamakd.spec
clean:
rm -rf ~/rpmbuild/SOURCES/tokamakd-$(version)*
rm -f ~/rpmbuild/SPECS/tokamakd.spec
rm -f ~/rpmbuild/RPMS/x86_64/tokamakd-*