lume/Makefile

34 lines
814 B
Makefile
Raw Normal View History

2021-03-03 02:41:58 +00:00
V ?= 0
Q = $(if $(filter 1, $V),, @)
2021-04-07 01:37:19 +00:00
BINDIR=$(CURDIR)/bin
2021-04-07 01:38:00 +00:00
DESTDIR=/usr/local/bin
2021-03-31 04:57:52 +00:00
2021-03-02 04:59:11 +00:00
ifeq ($(OS), Windows_NT)
2021-04-07 01:37:19 +00:00
EXE=$(BINDIR)/lume.exe
2021-03-02 06:40:22 +00:00
RM=del /f /q
2021-03-03 02:41:18 +00:00
BUILD_DATE=$(shell powershell Get-Date -Format "yyyy-MM-ddThh:mm:sszzz")
2021-03-02 04:59:11 +00:00
else
2021-04-07 01:37:19 +00:00
EXE=$(BINDIR)/lume
2021-03-30 18:27:58 +00:00
RM=rm -f
2021-03-03 02:41:18 +00:00
BUILD_DATE=$(shell date --iso-8601=seconds)
2021-03-02 04:59:11 +00:00
endif
2021-03-03 02:41:18 +00:00
LUME_VERSION ?= $(shell git describe --tags --always)
2021-03-11 03:39:47 +00:00
GIT_COMMIT := $(shell git rev-parse --short HEAD)
2021-03-03 06:29:40 +00:00
LDFLAGS := $(LDFLAGS) \
-X git.kill0.net/chill9/lume/cmd.Version=$(LUME_VERSION) \
2021-03-11 03:39:47 +00:00
-X git.kill0.net/chill9/lume/cmd.BuildDate=$(BUILD_DATE) \
-X git.kill0.net/chill9/lume/cmd.GitCommit=$(GIT_COMMIT)
2021-03-03 02:41:18 +00:00
2020-02-29 18:55:28 +00:00
.PHONY: build
build:
2021-03-03 06:29:40 +00:00
$(Q) go build -o $(EXE) -ldflags="$(LDFLAGS)" ./cmd/lume
2020-02-29 18:55:28 +00:00
.PHONY: clean
clean:
2021-03-30 18:27:58 +00:00
$(Q) $(RM) $(EXE)
2021-04-07 01:38:00 +00:00
.PHONY: install
install:
$(Q) install -p -D -m 0755 $(EXE) $(DESTDIR)