sircd/Makefile
2020-02-25 07:51:22 -08:00

32 lines
587 B
Makefile

VERSION := $(shell git rev-parse --short HEAD)
BUILDUSER := $(shell whoami)
BUILDHOST := $(shell hostname -s)
BUILDARCH := $(shell uname -m)
GOLDFLAGS += -X main.Version=$(VERSION)
GOLDFLAGS += -X main.Builduser=$(BUILDUSER)@$(BUILDHOST)
GOLDFLAGS += -X main.Buildarch=$(BUILDARCH)
GOFLAGS = -ldflags "$(GOLDFLAGS)"
FN := sircd
default: rundebug
rundebug: build
DEBUG=1 ./$(FN)
run: build
./$(FN)
build: $(FN)
go-get:
cd cmd/$(FN) && go get -v
./$(FN): */*.go cmd/*/*.go go-get
cd cmd/$(FN) && go build -o ../../$(FN) $(GOFLAGS) .
fmt:
go fmt */*.go
go fmt cmd/$(FN)/*.go