2020-02-28 19:40:37 +01:00
|
|
|
.PHONY: all check-license crossbuild build install test generate embedmd
|
2018-04-24 15:19:40 +01:00
|
|
|
|
2020-03-02 07:37:21 +00:00
|
|
|
SHELL=/bin/bash
|
|
|
|
|
|
2018-04-24 15:19:40 +01:00
|
|
|
GITHUB_URL=github.com/jsonnet-bundler/jsonnet-bundler
|
2020-02-28 19:40:37 +01:00
|
|
|
VERSION := $(shell git describe --tags --dirty --always)
|
2018-04-24 15:19:40 +01:00
|
|
|
OUT_DIR=_output
|
|
|
|
|
BIN?=jb
|
|
|
|
|
PKGS=$(shell go list ./... | grep -v /vendor/)
|
|
|
|
|
|
2020-02-28 19:40:37 +01:00
|
|
|
all: check-license build generate test
|
|
|
|
|
|
|
|
|
|
# Binaries
|
|
|
|
|
LDFLAGS := '-s -w -extldflags "-static" -X main.Version=${VERSION}'
|
|
|
|
|
cross: clean
|
|
|
|
|
CGO_ENABLED=0 gox \
|
|
|
|
|
-output="$(OUT_DIR)/jb-{{.OS}}-{{.Arch}}" \
|
|
|
|
|
-ldflags=$(LDFLAGS) \
|
|
|
|
|
-arch="amd64 arm64 arm" -os="linux" \
|
2022-10-20 10:46:06 -05:00
|
|
|
-arch="amd64 arm64" -os="darwin" \
|
2020-05-20 15:51:58 +02:00
|
|
|
-osarch="windows/amd64" \
|
2020-02-28 19:40:37 +01:00
|
|
|
./cmd/$(BIN)
|
|
|
|
|
|
|
|
|
|
static:
|
|
|
|
|
CGO_ENABLED=0 go build -ldflags=${LDFLAGS} -o $(OUT_DIR)/$(BIN) ./cmd/$(BIN)
|
2018-04-24 15:19:40 +01:00
|
|
|
|
|
|
|
|
build:
|
2020-03-02 16:43:11 +01:00
|
|
|
CGO_ENABLED=0 go build -o $(OUT_DIR)/$(BIN) ./cmd/$(BIN)
|
2018-04-24 15:19:40 +01:00
|
|
|
|
2020-02-28 19:40:37 +01:00
|
|
|
install: static
|
2018-08-08 10:35:20 +02:00
|
|
|
@echo ">> copying $(BIN) into $(GOPATH)/bin/$(BIN)"
|
2020-02-28 19:40:37 +01:00
|
|
|
cp $(OUT_DIR)/$(BIN) $(GOPATH)/bin/$(BIN)
|
2018-04-24 15:19:40 +01:00
|
|
|
|
2020-02-28 19:40:37 +01:00
|
|
|
# Tests
|
2018-04-24 15:19:40 +01:00
|
|
|
test:
|
2019-04-24 18:37:44 +02:00
|
|
|
@echo ">> running all unit tests"
|
2019-07-22 18:03:27 +02:00
|
|
|
go test -v $(PKGS)
|
2018-04-24 15:19:40 +01:00
|
|
|
|
2019-04-24 18:37:44 +02:00
|
|
|
test-integration:
|
|
|
|
|
@echo ">> running all integration tests"
|
|
|
|
|
go test -v -tags=integration $(PKGS)
|
|
|
|
|
|
2020-02-28 19:40:37 +01:00
|
|
|
# Documentation
|
2018-04-24 15:19:40 +01:00
|
|
|
generate: embedmd
|
|
|
|
|
@echo ">> generating docs"
|
|
|
|
|
@./scripts/generate-help-txt.sh
|
2020-03-02 07:37:21 +00:00
|
|
|
$(GOPATH)/bin/embedmd -w `find ./ -path ./vendor -prune -o -name "*.md" -print`
|
2018-04-24 15:19:40 +01:00
|
|
|
|
2020-02-28 19:40:37 +01:00
|
|
|
check-license:
|
|
|
|
|
@echo ">> checking license headers"
|
|
|
|
|
@./scripts/check_license.sh
|
|
|
|
|
|
2018-04-24 15:19:40 +01:00
|
|
|
embedmd:
|
2022-06-22 16:26:42 +02:00
|
|
|
pushd /tmp && go install github.com/campoy/embedmd@latest && popd
|
2018-04-24 15:19:40 +01:00
|
|
|
|
2020-02-28 19:40:37 +01:00
|
|
|
# Other
|
|
|
|
|
clean:
|
|
|
|
|
rm -rf $(OUT_DIR) $(BIN)
|
|
|
|
|
|
|
|
|
|
drone:
|
|
|
|
|
drone jsonnet --format
|