cityuni-webserver/Makefile

37 lines
799 B
Makefile
Raw Normal View History

2022-07-13 16:16:47 +01:00
SHELL := /bin/bash
BIN := dist/wappcityuni
ENTRY_POINT := ./cmd/wappcityuni
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}
LD_FLAGS := -s -w -X 'main.buildVersion=${VERSION}' -X 'main.buildDate=${BUILD_DATE}'
COMP_BIN := go
ifeq ($(OS),Windows_NT)
BIN := $(BIN).exe
endif
.PHONY: build dev test clean
build:
mkdir -p dist/
${COMP_BIN} build -o "${BIN}" -ldflags="${LD_FLAGS}" ${ENTRY_POINT}
dev:
mkdir -p dist/
${COMP_BIN} build -tags debug -o "${BIN}" -ldflags="${LD_FLAGS}" ${ENTRY_POINT}
./${BIN}
test:
go test
clean:
go clean
rm -r -f dist/
2022-07-15 15:46:58 +01:00
deploy:
sudo systemctl stop wappcityuni
sudo cp dist/wappcityuni /usr/bin/local
sudo systemctl start wappcityuni