-
Notifications
You must be signed in to change notification settings - Fork 4
/
Makefile
30 lines (27 loc) · 976 Bytes
/
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
.ONESHELL:
SHA := $(shell git rev-parse --short=8 HEAD)
GITVERSION := $(shell git describe --long --all)
BUILDDATE := $(shell date -Iseconds)
VERSION := $(or ${GITHUB_TAG_NAME},$(shell git describe --tags --exact-match 2> /dev/null || git symbolic-ref -q --short HEAD || git rev-parse --short HEAD))
GO111MODULE := on
.PHONY: all
all:
go build \
-trimpath \
-tags netgo \
-ldflags "-X 'github.com/metal-stack/v.Version=$(VERSION)' \
-X 'github.com/metal-stack/v.Revision=$(GITVERSION)' \
-X 'github.com/metal-stack/v.GitSHA1=$(SHA)' \
-X 'github.com/metal-stacj/v.BuildDate=$(BUILDDATE)'" \
-o bin/lldpd main.go
strip bin/lldpd
.PHONY: release
release: all
rm -rf rel
mkdir -p rel/usr/local/bin rel/etc/systemd/system
cp bin/lldpd rel/usr/local/bin
cp lldpd.service rel/etc/systemd/system
cd rel \
&& tar --owner=root --group=root -cvzf go-lldpd.tgz usr/local/bin/lldpd etc/systemd/system/lldpd.service \
&& mv go-lldpd.tgz .. \
&& cd -