34 lines
1.3 KiB
Makefile
34 lines
1.3 KiB
Makefile
.PHONY: all client server
|
|
|
|
BUILDDIR?=./build
|
|
VERSION?=$(shell echo "$$(date +'%Y%m%d')-$$(git rev-parse --short=8 HEAD)")
|
|
|
|
all: client server
|
|
|
|
clean:
|
|
rm -rf $(BUILDDIR)
|
|
|
|
client:
|
|
go build -o $(BUILDDIR)/client ./cmd/client
|
|
|
|
server:
|
|
go build -o $(BUILDDIR)/server ./cmd/server
|
|
|
|
test:
|
|
go test -v ./...
|
|
|
|
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
|