aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile44
1 files changed, 44 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..da681d1
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,44 @@
+NAME ?= monzero
+PKGNAME ?= git.zero-knowledge.org/gibheer/monzero
+
+export GO111MODULE=on
+
+# build specific flags
+DESTDIR ?= .
+prefix ?= /usr/local
+exec_prefix ?= ${prefix}
+bindir ?= ${exec_prefix}/bin
+sysconfdir ?= ${prefix}/etc/${NAME}
+WRKDIR ?= build
+GOBIN ?= go
+
+# set GOOS to linux by default
+GOOS ?= linux
+BUILDID = 0x`head -c20 /dev/urandom | od -An -tx | tr -d ' \n'`
+LDFLAGS += -B ${BUILDID}
+BUILD_DATE ?= `date +%FT%T%z`
+LDFLAGS += -X main.BUILD_DATE=${BUILD_DATE}
+
+clean:
+ -rm -r ${WRKDIR}
+
+build: clean
+ mkdir -p ${WRKDIR}
+ go build -ldflags="${LDFLAGS}" -o ${WRKDIR}/moncheck ${PKGNAME}/cmd/moncheck
+ go build -ldflags="${LDFLAGS}" -o ${WRKDIR}/monfront ${PKGNAME}/cmd/monfront
+ go build -ldflags="${LDFLAGS}" -o ${WRKDIR}/monwork ${PKGNAME}/cmd/monwork
+
+install: build
+ install -d -m 0755 ${DESTDIR}${bindir}
+ install -d -m 0755 ${DESTDIR}${sysconfdir}/${NAME}
+ install -m 0755 ${WRKDIR}/moncheck ${DESTDIR}${bindir}
+ install -m 0755 ${WRKDIR}/monfront ${DESTDIR}${bindir}
+ install -m 0755 ${WRKDIR}/monwork ${DESTDIR}${bindir}
+ install -m 0644 moncheck.conf.example ${DESTDIR}${sysconfdir}/${NAME}
+ install -m 0644 monfront.conf.example ${DESTDIR}${sysconfdir}/${NAME}
+ install -m 0644 monwork.conf.example ${DESTDIR}${sysconfdir}/${NAME}
+
+package: DESTDIR = ${NAME}-${VERSION}
+package: install
+ tar -czf ${NAME}-${VERSION}.tar.gz ${DESTDIR}
+ rm -R ${DESTDIR}