2019-08-21 08:15:45 +00:00
|
|
|
VERSION := $(shell git rev-parse --short HEAD)
|
2019-08-21 08:31:57 +00:00
|
|
|
BUILDUSER := $(shell whoami)
|
|
|
|
BUILDHOST := $(shell hostname -s)
|
|
|
|
BUILDARCH := $(shell uname -m)
|
2019-08-21 08:15:45 +00:00
|
|
|
|
|
|
|
GOLDFLAGS += -X main.Version=$(VERSION)
|
2019-08-21 08:31:57 +00:00
|
|
|
GOLDFLAGS += -X main.Builduser=$(BUILDUSER)@$(BUILDHOST)
|
|
|
|
GOLDFLAGS += -X main.Buildarch=$(BUILDARCH)
|
2019-08-21 08:15:45 +00:00
|
|
|
GOFLAGS = -ldflags "$(GOLDFLAGS)"
|
|
|
|
|
2020-02-25 15:51:22 +00:00
|
|
|
FN := sircd
|
|
|
|
|
2019-08-21 08:31:57 +00:00
|
|
|
default: rundebug
|
|
|
|
|
|
|
|
rundebug: build
|
2020-02-25 15:51:22 +00:00
|
|
|
DEBUG=1 ./$(FN)
|
2019-08-19 23:30:59 +00:00
|
|
|
|
2019-08-21 08:15:45 +00:00
|
|
|
run: build
|
2020-02-25 15:51:22 +00:00
|
|
|
./$(FN)
|
|
|
|
|
|
|
|
build: $(FN)
|
2019-08-21 08:15:45 +00:00
|
|
|
|
2020-02-25 15:51:22 +00:00
|
|
|
go-get:
|
|
|
|
cd cmd/$(FN) && go get -v
|
2019-08-21 08:15:45 +00:00
|
|
|
|
2020-02-25 15:51:22 +00:00
|
|
|
./$(FN): */*.go cmd/*/*.go go-get
|
|
|
|
cd cmd/$(FN) && go build -o ../../$(FN) $(GOFLAGS) .
|
2019-08-20 02:15:56 +00:00
|
|
|
|
|
|
|
fmt:
|
2020-02-25 15:51:22 +00:00
|
|
|
go fmt */*.go
|
|
|
|
go fmt cmd/$(FN)/*.go
|