<commit_before>APP									= docker-volume-location-plugin

VERSION 						?= HEAD
BUILD               ?= $(shell git rev-parse HEAD)

PLATFORMS           = linux_amd64 linux_arm darwin_amd64

FLAGS_all = CGO_ENABLED=0

FLAGS_linux_amd64   = $(FLAGS_all) GOOS=linux GOARCH=amd64
FLAGS_linux_arm     = $(FLAGS_all) GOOS=linux GOARCH=arm
FLAGS_darwin_amd64  = $(FLAGS_all) GOOS=darwin GOARCH=amd64


msg=@printf "\n\033[0;01m>>> %s\033[0m\n" $1

.DEFAULT_GOAL := build

get-deps:
	go get github.com/tools/godep
	godep restore
.PHONY: deps

build: get-deps
	$(call msg,"Build binary")
	$(FLAGS_all) go build -ldflags "-X main.Version=${VERSION} -X main.Build=${BUILD}" -o bin/${APP} .
	./bin/${APP} -version
.PHONY: build

test: get-deps
	$(call msg,"Run tests")
	go test -v ./...
.PHONY: test

clean:
	$(call msg,"Clean directory")
	rm -rf bin
	rm -rf dist
.PHONY: clean

build-all: get-deps $(foreach PLATFORM,$(PLATFORMS),dist/$(PLATFORM)/$(APP))
.PHONY: build-all

dist: notHEAD build-all \
$(foreach PLATFORM,$(PLATFORMS),dist/$(APP)-$(VERSION)-$(PLATFORM).tar.gz)
.PHONY:	dist

dist/%/$(APP):
	$(call msg,"Build binary for $*")
	rm -f $@
	mkdir -p $(dir $@)
	$(FLAGS_$*) go build -ldflags "-X main.Version=${VERSION} -X main.Build=${BUILD}" -o dist/$*/${APP} .

dist/hello-http-go-$(VERSION)-%.tar.gz: notHEAD
	$(call msg,"Create TAR for $*")
	rm -f $@
	mkdir -p $(dir $@)
	tar czf $@ -C dist/$* .

notHEAD:
	@ if [ "$(VERSION)" = "HEAD" ]; then \<commit_msg>Change from go test -v ./... to go test -v . to avoid testing m$ code<commit_after>APP									= docker-volume-location-plugin

VERSION 						?= HEAD
BUILD               ?= $(shell git rev-parse HEAD)

PLATFORMS           = linux_amd64 linux_arm darwin_amd64

FLAGS_all = CGO_ENABLED=0

FLAGS_linux_amd64   = $(FLAGS_all) GOOS=linux GOARCH=amd64
FLAGS_linux_arm     = $(FLAGS_all) GOOS=linux GOARCH=arm
FLAGS_darwin_amd64  = $(FLAGS_all) GOOS=darwin GOARCH=amd64


msg=@printf "\n\033[0;01m>>> %s\033[0m\n" $1

.DEFAULT_GOAL := build

get-deps:
	go get github.com/tools/godep
	godep restore
.PHONY: deps

build: get-deps
	$(call msg,"Build binary")
	$(FLAGS_all) go build -ldflags "-X main.Version=${VERSION} -X main.Build=${BUILD}" -o bin/${APP} .
	./bin/${APP} -version
.PHONY: build

test: get-deps
	$(call msg,"Run tests")
	go test -v .
.PHONY: test

clean:
	$(call msg,"Clean directory")
	rm -rf bin
	rm -rf dist
.PHONY: clean

build-all: get-deps $(foreach PLATFORM,$(PLATFORMS),dist/$(PLATFORM)/$(APP))
.PHONY: build-all

dist: notHEAD build-all \
$(foreach PLATFORM,$(PLATFORMS),dist/$(APP)-$(VERSION)-$(PLATFORM).tar.gz)
.PHONY:	dist

dist/%/$(APP):
	$(call msg,"Build binary for $*")
	rm -f $@
	mkdir -p $(dir $@)
	$(FLAGS_$*) go build -ldflags "-X main.Version=${VERSION} -X main.Build=${BUILD}" -o dist/$*/${APP} .

dist/hello-http-go-$(VERSION)-%.tar.gz: notHEAD
	$(call msg,"Create TAR for $*")
	rm -f $@
	mkdir -p $(dir $@)
	tar czf $@ -C dist/$* .

notHEAD:
	@ if [ "$(VERSION)" = "HEAD" ]; then \
{'fraction_non_alphanumeric': 0.19132481506388702, 'fraction_numerical': 0.01613987895090787, 'mean_word_length': 3.521276595744681, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '268754', 'n_tokens_mistral': 1267, 'n_tokens_neox': 1195, 'n_words': 283}