mirror of
https://github.com/TECHNOFAB11/jsonnet-bundler.git
synced 2025-12-12 08:00:05 +01:00
* use filepath to check for known packages this fixes an issue using windows. without this patch, jb would delete the folder after installation since the path is not known * reduce temp directory length by hashing using this hash it is harder to reach the windows limit for filenames and directories * further reduce temp dir length * do not build binaries for windows/amd*
61 lines
1.4 KiB
Makefile
61 lines
1.4 KiB
Makefile
.PHONY: all check-license crossbuild build install test generate embedmd
|
|
|
|
SHELL=/bin/bash
|
|
|
|
GITHUB_URL=github.com/jsonnet-bundler/jsonnet-bundler
|
|
VERSION := $(shell git describe --tags --dirty --always)
|
|
OUT_DIR=_output
|
|
BIN?=jb
|
|
PKGS=$(shell go list ./... | grep -v /vendor/)
|
|
|
|
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" \
|
|
-osarch="darwin/amd64" \
|
|
-osarch="windows/amd64" \
|
|
./cmd/$(BIN)
|
|
|
|
static:
|
|
CGO_ENABLED=0 go build -ldflags=${LDFLAGS} -o $(OUT_DIR)/$(BIN) ./cmd/$(BIN)
|
|
|
|
build:
|
|
CGO_ENABLED=0 go build -o $(OUT_DIR)/$(BIN) ./cmd/$(BIN)
|
|
|
|
install: static
|
|
@echo ">> copying $(BIN) into $(GOPATH)/bin/$(BIN)"
|
|
cp $(OUT_DIR)/$(BIN) $(GOPATH)/bin/$(BIN)
|
|
|
|
# Tests
|
|
test:
|
|
@echo ">> running all unit tests"
|
|
go test -v $(PKGS)
|
|
|
|
test-integration:
|
|
@echo ">> running all integration tests"
|
|
go test -v -tags=integration $(PKGS)
|
|
|
|
# Documentation
|
|
generate: embedmd
|
|
@echo ">> generating docs"
|
|
@./scripts/generate-help-txt.sh
|
|
$(GOPATH)/bin/embedmd -w `find ./ -path ./vendor -prune -o -name "*.md" -print`
|
|
|
|
check-license:
|
|
@echo ">> checking license headers"
|
|
@./scripts/check_license.sh
|
|
|
|
embedmd:
|
|
pushd /tmp && GO111MODULES=on go get github.com/campoy/embedmd && popd
|
|
|
|
# Other
|
|
clean:
|
|
rm -rf $(OUT_DIR) $(BIN)
|
|
|
|
drone:
|
|
drone jsonnet --format
|