Updated makefile
This commit is contained in:
parent
41eb42c369
commit
9be5aa8718
1 changed files with 49 additions and 12 deletions
61
Makefile
61
Makefile
|
@ -1,16 +1,53 @@
|
||||||
hello:
|
EXTENSION ?=
|
||||||
echo "Sacrebleu-DNS"
|
DIST_DIR ?= dist/
|
||||||
|
GOOS ?= linux
|
||||||
|
ARCH ?= $(shell uname -m)
|
||||||
|
BUILDINFOSDET ?=
|
||||||
|
|
||||||
build:
|
SOFT_NAME := sacrebleu
|
||||||
go build -o bin/sacrebleu-dns
|
SOFT_VERSION := $(shell git describe --tags $(git rev-list --tags --max-count=1))
|
||||||
|
VERSION_PKG := $(shell echo $(SOFT_VERSION) | sed 's/^v//g')
|
||||||
|
ARCH := x86_64
|
||||||
|
LICENSE := AGPL-3
|
||||||
|
URL := https://github.com/outout14/sacrebleu-dns/
|
||||||
|
DESCRIPTION := Sacrebleu is a DNS authoritative nameserver made in Go
|
||||||
|
BUILDINFOS := ($(shell date +%FT%T%z)$(BUILDINFOSDET))
|
||||||
|
LDFLAGS := '-X main.version=$(SOFT_VERSION) -X main.buildinfos=$(BUILDINFOS)'
|
||||||
|
|
||||||
run:
|
OUTPUT_SOFT := $(DIST_DIR)sacrebleu-$(SOFT_VERSION)-$(GOOS)-$(ARCH)$(EXTENSION)
|
||||||
go run main.go
|
|
||||||
|
|
||||||
compile:
|
.PHONY: vet
|
||||||
echo "Compiling for every OS and Platform"
|
vet:
|
||||||
GOOS=linux GOARCH=arm go build -o bin/sacrebleu-dns-linux-arm main.go
|
go vet main.go
|
||||||
GOOS=linux GOARCH=arm64 go build -o bin/sacrebleu-dns-linux-arm64 main.go
|
|
||||||
GOOS=linux GOARCH=amd64 go build -o bin/sacrebleu-dns-linux-amd64 main.go
|
|
||||||
|
|
||||||
all: hello build
|
.PHONY: prepare
|
||||||
|
prepare:
|
||||||
|
mkdir -p $(DIST_DIR)
|
||||||
|
|
||||||
|
.PHONY: clean
|
||||||
|
clean:
|
||||||
|
rm -rf $(DIST_DIR)
|
||||||
|
|
||||||
|
.PHONY: build
|
||||||
|
build: prepare
|
||||||
|
go build -ldflags $(LDFLAGS) -o $(OUTPUT_SOFT)
|
||||||
|
|
||||||
|
.PHONY: package-deb
|
||||||
|
package-deb: prepare
|
||||||
|
fpm -s dir -t deb -n $(SOFT_NAME) -v $(VERSION_PKG) \
|
||||||
|
--description "$(DESCRIPTION)" \
|
||||||
|
--url "$(URL)" \
|
||||||
|
--architecture $(ARCH) \
|
||||||
|
--license "$(LICENSE)" \
|
||||||
|
--package $(DIST_DIR) \
|
||||||
|
$(OUTPUT_SOFT)=/usr/bin/sacrebleu-dns
|
||||||
|
|
||||||
|
.PHONY: package-rpm
|
||||||
|
package-rpm: prepare
|
||||||
|
fpm -s dir -t rpm -n $(SOFT_NAME) -v $(VERSION_PKG) \
|
||||||
|
--description "$(DESCRIPTION)" \
|
||||||
|
--url "$(URL)" \
|
||||||
|
--architecture $(ARCH) \
|
||||||
|
--license "$(LICENSE) "\
|
||||||
|
--package $(DIST_DIR) \
|
||||||
|
$(OUTPUT_SOFT)=/usr/bin/sacrebleu-dns
|
||||||
|
|
Loading…
Reference in a new issue