sys-exporter/Makefile

35 lines
1.3 KiB
Makefile
Raw Normal View History

2024-11-25 17:46:11 +00:00
.PHONY: all client server
2024-12-03 13:11:19 +00:00
BUILDDIR?=./build
VERSION?=$(shell echo "$$(date +'%Y%m%d')-$$(git rev-parse --short=8 HEAD)")
2024-11-25 17:46:11 +00:00
all: client server
clean:
2024-12-03 13:11:19 +00:00
rm -rf $(BUILDDIR)
2024-11-25 17:46:11 +00:00
client:
2024-12-03 13:11:19 +00:00
go build -o $(BUILDDIR)/client ./cmd/client
2024-11-25 17:46:11 +00:00
server:
2024-12-03 13:11:19 +00:00
go build -o $(BUILDDIR)/server ./cmd/server
2024-12-03 12:12:43 +00:00
test:
go test -v ./...
2024-12-03 13:11:19 +00:00
debpkg_server_prepare: server
rm -rf $(BUILDDIR)/debpkg
mkdir -p $(BUILDDIR)/debpkg/usr/bin $(BUILDDIR)/debpkg/DEBIAN $(BUILDDIR)/debpkg/etc/systemd/system $(BUILDDIR)/debpkg/etc/sys-exporter
install -m 755 -o root -g root $(BUILDDIR)/server $(BUILDDIR)/debpkg/usr/bin/
install -m 644 -o root -g root debian/sys-exporter/etc/systemd/system/sys-exporter.service $(BUILDDIR)/debpkg/etc/systemd/system/
install -m 644 -o root -g root debian/sys-exporter/etc/sys-exporter/config.yml $(BUILDDIR)/debpkg/etc/sys-exporter/
install -m 644 -o root -g root debian/sys-exporter/control $(BUILDDIR)/debpkg/DEBIAN/control
install -m 755 -o root -g root debian/sys-exporter/postinst $(BUILDDIR)/debpkg/DEBIAN/postinst
debpkg_server: debpkg_server_prepare
dpkg-deb --build $(BUILDDIR)/debpkg/ $(BUILDDIR)/sys-exporter.deb
debpkg_server_docker: server
docker build -t debian-builder ./debian/tools
docker run -t -e PACKAGE_VERSION="$(VERSION)" -v $(BUILDDIR):/build/ -v ./debian:/debian debian-builder