<commit_before>BINARY=csvq
VERSION=$(shell git describe --tags --always)

SOURCEDIR=.
SOURCES := $(shell find $(SOURCEDIR) -name '*.go')

LDFLAGS := -ldflags="-X main.version=$(VERSION)"

DIST_DIRS := find * -type d -exec

.DEFAULT_GOAL: $(BINARY)

$(BINARY): $(SOURCES)
	go build $(LDFLAGS) -o $(BINARY)

.PHONY: deps
deps: glide
	glide install

.PHONY: install
install:
	go install $(LDFLAGS)

.PHONY: glide
glide:
ifeq ($(shell command -v glide 2>/dev/null),)
	curl https://glide.sh/get | sh
endif

.PHONY: test
test:
	go test -cover `glide novendor`

.PHONY: test-all-cov
test-all-cov:
	echo "" > coverage.txt
	for d in `go list ./... | grep -v vendor`; do \
		go test -coverprofile=profile.out -covermode=atomic $$d; \
		if [ -f profile.out ]; then \
			cat profile.out >> coverage.txt; \
			rm profile.out; \
		fi; \
	done

.PHONY: clean
clean:
	if [ -f $(BINARY) ]; then rm $(BINARY); fi

.PHONY: gox
gox:
ifeq ($(shell command -v gox 2>/dev/null),)
	go get github.com/mitchellh/gox
endif

.PHONY: build-all
build-all: gox
	gox -output="dist/{{.OS}}-{{.Arch}}/{{.Dir}}"

.PHONY: dist
dist:
	cd dist && \
	$(DIST_DIRS) cp ../LICENSE {} \; && \
	$(DIST_DIRS) cp ../README.md {} \; && \
	$(DIST_DIRS) tar -zcf ${BINARY}-${VERSION}-{}.tar.gz {} \; && \
	$(DIST_DIRS) zip -r ${BINARY}-${VERSION}-{}.zip {} \; && \
	cd ..

.PHONY: release
release:
ifeq ($(shell git describe --tags 2>/dev/null),)
	$(error HEAD commit is not tagged)
else<commit_msg>Fix release condition in Makefile.<commit_after>BINARY=csvq
VERSION=$(shell git describe --tags --always)

SOURCEDIR=.
SOURCES := $(shell find $(SOURCEDIR) -name '*.go')

LDFLAGS := -ldflags="-X main.version=$(VERSION)"

DIST_DIRS := find * -type d -exec

.DEFAULT_GOAL: $(BINARY)

$(BINARY): $(SOURCES)
	go build $(LDFLAGS) -o $(BINARY)

.PHONY: deps
deps: glide
	glide install

.PHONY: install
install:
	go install $(LDFLAGS)

.PHONY: glide
glide:
ifeq ($(shell command -v glide 2>/dev/null),)
	curl https://glide.sh/get | sh
endif

.PHONY: test
test:
	go test -cover `glide novendor`

.PHONY: test-all-cov
test-all-cov:
	echo "" > coverage.txt
	for d in `go list ./... | grep -v vendor`; do \
		go test -coverprofile=profile.out -covermode=atomic $$d; \
		if [ -f profile.out ]; then \
			cat profile.out >> coverage.txt; \
			rm profile.out; \
		fi; \
	done

.PHONY: clean
clean:
	if [ -f $(BINARY) ]; then rm $(BINARY); fi

.PHONY: gox
gox:
ifeq ($(shell command -v gox 2>/dev/null),)
	go get github.com/mitchellh/gox
endif

.PHONY: build-all
build-all: gox
	gox -output="dist/{{.OS}}-{{.Arch}}/{{.Dir}}"

.PHONY: dist
dist:
	cd dist && \
	$(DIST_DIRS) cp ../LICENSE {} \; && \
	$(DIST_DIRS) cp ../README.md {} \; && \
	$(DIST_DIRS) tar -zcf ${BINARY}-${VERSION}-{}.tar.gz {} \; && \
	$(DIST_DIRS) zip -r ${BINARY}-${VERSION}-{}.zip {} \; && \
	cd ..

.PHONY: release
release:
ifeq ($(shell git tag --contains 2>/dev/null),)
	$(error HEAD commit is not tagged)
else
{'fraction_non_alphanumeric': 0.20513698630136987, 'fraction_numerical': 0.002054794520547945, 'mean_word_length': 3.19683908045977, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 15, 'https://': 2, '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': '268961', 'n_tokens_mistral': 1252, 'n_tokens_neox': 1187, 'n_words': 319}