31 lines
663 B
Makefile
31 lines
663 B
Makefile
|
VERSION := $(shell git rev-parse --short HEAD)
|
||
|
BUILDTIME := $(shell date -u '+%Y-%m-%dT%H:%M:%SZ')
|
||
|
BUILDUSER := $(shell whoami)
|
||
|
BUILDHOST := $(shell hostname -s)
|
||
|
BUILDARCH := $(shell uname -m)
|
||
|
|
||
|
GOLDFLAGS += -X main.Version=$(VERSION)
|
||
|
GOLDFLAGS += -X main.Buildtime=$(BUILDTIME)
|
||
|
GOLDFLAGS += -X main.Builduser=$(BUILDUSER)@$(BUILDHOST)
|
||
|
GOLDFLAGS += -X main.Buildarch=$(BUILDARCH)
|
||
|
GOFLAGS = -ldflags "$(GOLDFLAGS)"
|
||
|
|
||
|
default: rundebug
|
||
|
|
||
|
rundebug: build
|
||
|
./fediverse-archive -debug
|
||
|
|
||
|
run: build
|
||
|
./fediverse-archvie
|
||
|
|
||
|
build: ./fediverse-archive
|
||
|
|
||
|
./fediverse-archive: *.go
|
||
|
go build -o $@ $(GOFLAGS) .
|
||
|
|
||
|
fmt:
|
||
|
go fmt *.go
|
||
|
|
||
|
test:
|
||
|
docker build -t sneak/fediverse-archive .
|