-
Notifications
You must be signed in to change notification settings - Fork 7
/
Makefile
43 lines (36 loc) · 1.15 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
34
35
36
37
38
39
40
41
42
43
HASH := $(shell git rev-parse --short HEAD)
COMMIT_DATE := $(shell git show -s --format=%ci ${HASH})
BUILD_DATE := $(shell date '+%Y-%m-%d %H:%M:%S')
VERSION := ${HASH} (${COMMIT_DATE})
BUILDDIR ?= .
SRCDIR ?= .
.PHONY: help
help:
@echo "make [TARGETS...]"
@echo
@echo "This is the maintenance makefile of network-event-broker. The following"
@echo "targets are available:"
@echo
@echo " help: Print this usage information."
@echo " build: Builds project"
@echo " install: Installs binary, configuration and unit files"
@echo " clean: Cleans the build"
$(BUILDDIR)/:
mkdir -p "$@"
$(BUILDDIR)/%/:
mkdir -p "$@"
.PHONY: build
build:
- mkdir -p bin
go build -ldflags="-X 'main.buildVersion=${VERSION}' -X 'main.buildDate=${BUILD_DATE}'" -o bin/network-broker ./cmd/network-broker
.PHONY: install
install:
install bin/network-broker /usr/bin/
install -vdm 755 /etc/network-broker
install -m 755 distribution/network-broker.toml /etc/network-broker
install -m 0644 distribution/network-broker.service /lib/systemd/system/
systemctl daemon-reload
PHONY: clean
clean:
go clean
rm -rf bin