2020-02-24 19:14:46 +03:00
|
|
|
BUILDDIR := bin
|
2022-06-08 01:24:36 +03:00
|
|
|
BINARY_ASSETS := $(BUILDDIR)/cli-ext-linux-amd64 $(BUILDDIR)/cli-ext-darwin-amd64 $(BUILDDIR)/cli-ext-windows-amd64 $(BUILDDIR)/cli-ext-linux-arm64 $(BUILDDIR)/cli-ext-darwin-arm64
|
2021-03-17 18:09:03 +03:00
|
|
|
BINARY_ASSET_CHECKSUMS := $(patsubst %,%.sha256,$(BINARY_ASSETS))
|
2021-11-11 10:45:18 +03:00
|
|
|
GLOBALBUILDDIR ?= /build
|
2020-02-24 19:14:46 +03:00
|
|
|
|
|
|
|
COMPRESS := gzip --best -k -c
|
|
|
|
|
2021-03-17 18:09:03 +03:00
|
|
|
deps:
|
|
|
|
npm install
|
|
|
|
|
2021-11-11 10:45:18 +03:00
|
|
|
.PHONY: ci-deps
|
|
|
|
## ci-deps: builds if not already build
|
2020-02-24 19:14:46 +03:00
|
|
|
ci-deps:
|
|
|
|
if [ ! -d "node_modules" ]; then npm ci; fi
|
|
|
|
|
2021-11-11 10:45:18 +03:00
|
|
|
.PHONY: clean-deps
|
|
|
|
## clean-deps: deletes node_modules
|
|
|
|
clean-deps:
|
|
|
|
if [ -d "node_modules" ]; then rm -r node_modules; fi
|
|
|
|
|
|
|
|
.PHONY: build
|
|
|
|
## build: generates build
|
|
|
|
build: ci-deps
|
|
|
|
npm run build
|
|
|
|
$(MAKE) $(BINARY_ASSET_CHECKSUMS)
|
|
|
|
|
|
|
|
.PHONY: clean-build
|
|
|
|
## clean-build: generates clean build
|
|
|
|
clean-build: clean clean-deps ci-deps
|
|
|
|
npm run build
|
|
|
|
|
|
|
|
.PHONY: ci-copy-assets
|
2020-02-24 19:14:46 +03:00
|
|
|
ci-copy-assets:
|
2021-11-11 10:45:18 +03:00
|
|
|
## ci-copy-assets: copies assests to global build folder
|
|
|
|
mkdir -p $(GLOBALBUILDDIR)/_cli_ext_output
|
|
|
|
cp $(BUILDDIR)/* $(GLOBALBUILDDIR)/_cli_ext_output/
|
2020-02-24 19:14:46 +03:00
|
|
|
|
2020-02-25 17:58:28 +03:00
|
|
|
# Not supported: Refer https://github.com/zeit/pkg/issues/50
|
|
|
|
upx-compress: $(BUILDDIR)
|
|
|
|
ls $(BUILDDIR)/cli-ext-hasura-* | xargs upx
|
|
|
|
|
2020-02-24 19:14:46 +03:00
|
|
|
.PRECIOUS: %.zip
|
|
|
|
%.zip: %.exe
|
|
|
|
cd $(BUILDDIR) && \
|
|
|
|
zip $(patsubst $(BUILDDIR)/%, %, $@) $(patsubst $(BUILDDIR)/%, %, $<)
|
|
|
|
|
|
|
|
.PRECIOUS: %.gz
|
|
|
|
%.gz: %
|
|
|
|
$(COMPRESS) "$<" > "$@"
|
|
|
|
|
|
|
|
%.tar: %
|
|
|
|
tar cf "$@" -C $(BUILDDIR) $(patsubst $(BUILDDIR)/%,%,$^)
|
|
|
|
|
|
|
|
%.sha256: %
|
|
|
|
shasum -a 256 $< > $@
|
|
|
|
|
|
|
|
.PHONY: clean
|
|
|
|
clean:
|
|
|
|
$(RM) -r $(BUILDDIR)
|
|
|
|
|
2021-11-11 10:45:18 +03:00
|
|
|
.PHONY: help
|
|
|
|
## help: prints this help message
|
|
|
|
help:
|
|
|
|
@echo "Usage: \n"
|
|
|
|
@sed -n 's/^##//p' ${MAKEFILE_LIST} | column -t -s ':' | sed -e 's/^/ /'
|
|
|
|
|