|
|
|
@ -2,9 +2,11 @@ |
|
|
|
|
.PHONY: help deps dev build install image release test clean clean-all |
|
|
|
|
|
|
|
|
|
export CGO_ENABLED=0
|
|
|
|
|
VERSION=$(shell git describe --abbrev=0 --tags 2>/dev/null || echo "0.0.0")
|
|
|
|
|
COMMIT=$(shell git rev-parse --short HEAD || echo "HEAD")
|
|
|
|
|
VERSION=$(shell git describe --abbrev=0 --tags 2>/dev/null || echo "$VERSION")
|
|
|
|
|
COMMIT=$(shell git rev-parse --short HEAD || echo "$COMMIT")
|
|
|
|
|
BRANCH=$(shell git rev-parse --abbrev-ref HEAD)
|
|
|
|
|
BUILD=$(shell git show -s --pretty=format:%cI)
|
|
|
|
|
GOCMD=go
|
|
|
|
|
GOCMD=go
|
|
|
|
|
|
|
|
|
|
DESTDIR=/usr/local/bin
|
|
|
|
@ -49,14 +51,19 @@ cli: ## Build the salty-chat command-line client and tui |
|
|
|
|
ifeq ($(DEBUG), 1) |
|
|
|
|
@echo "Building in debug mode..."
|
|
|
|
|
@$(GOCMD) build -tags "netgo static_build" -installsuffix netgo \
|
|
|
|
|
-ldflags "-X $(shell go list).Version=$(VERSION) \
|
|
|
|
|
-X $(shell go list).Commit=$(COMMIT)" \
|
|
|
|
|
-ldflags "\
|
|
|
|
|
-X $(shell go list).Version=$(VERSION) \
|
|
|
|
|
-X $(shell go list).Commit=$(COMMIT) \
|
|
|
|
|
-X $(shell go list).Build=$(BUILD) \
|
|
|
|
|
" \
|
|
|
|
|
./cmd/salty-chat/
|
|
|
|
|
else |
|
|
|
|
@$(GOCMD) build -tags "netgo static_build" -installsuffix netgo \
|
|
|
|
|
-ldflags "-w \
|
|
|
|
|
-X $(shell go list).Version=$(VERSION) \
|
|
|
|
|
-X $(shell go list).Commit=$(COMMIT)" \
|
|
|
|
|
-X $(shell go list).Commit=$(COMMIT) \
|
|
|
|
|
-X $(shell go list).Build=$(BUILD) \
|
|
|
|
|
" \
|
|
|
|
|
./cmd/salty-chat/
|
|
|
|
|
endif |
|
|
|
|
|
|
|
|
@ -64,14 +71,19 @@ server: generate pwa ## Build the saltyd server and broker (also includes the PW |
|
|
|
|
ifeq ($(DEBUG), 1) |
|
|
|
|
@echo "Building in debug mode..."
|
|
|
|
|
@$(GOCMD) build -tags "embed netgo static_build" -installsuffix netgo \
|
|
|
|
|
-ldflags "-X $(shell go list).Version=$(VERSION) \
|
|
|
|
|
-X $(shell go list).Commit=$(COMMIT)" \
|
|
|
|
|
-ldflags "\
|
|
|
|
|
-X $(shell go list).Version=$(VERSION) \
|
|
|
|
|
-X $(shell go list).Commit=$(COMMIT) \
|
|
|
|
|
-X $(shell go list).Build=$(BUILD) \
|
|
|
|
|
" \
|
|
|
|
|
./cmd/saltyd/
|
|
|
|
|
else |
|
|
|
|
@$(GOCMD) build -tags "embed netgo static_build" -installsuffix netgo \
|
|
|
|
|
-ldflags "-w \
|
|
|
|
|
-X $(shell go list).Version=$(VERSION) \
|
|
|
|
|
-X $(shell go list).Commit=$(COMMIT)" \
|
|
|
|
|
-X $(shell go list).Commit=$(COMMIT) \
|
|
|
|
|
-X $(shell go list).Build=$(BUILD) \
|
|
|
|
|
" \
|
|
|
|
|
./cmd/saltyd/
|
|
|
|
|
endif |
|
|
|
|
|
|
|
|
@ -95,11 +107,18 @@ install: build ## Install salty-chat (cli) and saltyd (server) to $DESTDIR |
|
|
|
|
|
|
|
|
|
ifeq ($(PUBLISH), 1) |
|
|
|
|
image: generate ## Build the Docker image
|
|
|
|
|
@docker build --build-arg VERSION="$(VERSION)" --build-arg COMMIT="$(COMMIT)" -t $(IMAGE):$(TAG) .
|
|
|
|
|
@docker push $(IMAGE):$(TAG)
|
|
|
|
|
@docker buildx build \
|
|
|
|
|
--build-arg VERSION="$(VERSION)" \
|
|
|
|
|
--build-arg COMMIT="$(COMMIT)" \
|
|
|
|
|
--build-arg BUILD="$(BUILD)" \
|
|
|
|
|
--platform linux/amd64,linux/arm64 --push -t $(IMAGE):$(TAG) .
|
|
|
|
|
else |
|
|
|
|
image: generate |
|
|
|
|
@docker build --build-arg VERSION="$(VERSION)" --build-arg COMMIT="$(COMMIT)" -t $(IMAGE):$(TAG) .
|
|
|
|
|
@docker build \
|
|
|
|
|
--build-arg VERSION="$(VERSION)" \
|
|
|
|
|
--build-arg COMMIT="$(COMMIT)" \
|
|
|
|
|
--build-arg BUILD="$(BUILD)" \
|
|
|
|
|
-t $(IMAGE):$(TAG) .
|
|
|
|
|
endif |
|
|
|
|
|
|
|
|
|
release: generate ## Release a new version to Gitea
|
|
|
|
|