<commit_before>GOOS := $(shell go env GOOS)
GOARCH := $(shell go env GOARCH)
GOENV_EXTRA :=

DEB_TARGET_ARCH ?=

ifeq ($(DEB_TARGET_ARCH),armel)
GOARCH := arm
GOOS := linux
GOENV_EXTRA := GOARM=5 CC_FOR_TARGET=arm-linux-gnueabi-gcc CC=$$CC_FOR_TARGET CGO_ENABLED=1
endif
ifeq ($(DEB_TARGET_ARCH),armhf)
GOARCH := arm
GOOS := linux
GOENV_EXTRA := GOARM=6 CC_FOR_TARGET=arm-linux-gnueabihf-gcc CC=$$CC_FOR_TARGET CGO_ENABLED=1
endif

CURDIR := $(shell pwd)
GOENV := GOOS=$(GOOS) GOARCH=$(GOARCH) $(GOENV_EXTRA)
GOVER := $(shell go version | cut -d ' ' -f 3)

all: build

deps:
	cd $$($(GOENV) go env GOPATH)\
	  && wget -O $(GOOS)_$(GOARCH).tar.gz $$(curl -s https://api.github.com/repos/andrey-yantsen/teko-astra-go/releases/latest | fgrep browser_download_url | cut -d'"' -f 4 | fgrep $(GOVER)_$(GOOS)_$(GOARCH).)\
	  && tar -zxf $(GOOS)_$(GOARCH).tar.gz\
	  && rm $(GOOS)_$(GOARCH).tar.gz

build:
	$(GOENV) go build -o wb-mqtt-astra

install:
	mkdir -p $(DESTDIR)/usr/bin/ $(DESTDIR)/etc/init.d/ $(DESTDIR)/etc/default/
	install -m 0644 initscripts/defaults $(DESTDIR)/etc/default/wb-mqtt-astra
	install -m 0755 wb-mqtt-astra $(DESTDIR)/usr/bin/
	install -m 0755 initscripts/wb-mqtt-astra $(DESTDIR)/etc/init.d/wb-mqtt-astra<commit_msg>[makefile] add release target, to simplify releases<commit_after>GOOS := $(shell go env GOOS)
GOARCH := $(shell go env GOARCH)
GOENV_EXTRA :=

DEB_TARGET_ARCH ?=

ifeq ($(DEB_TARGET_ARCH),armel)
GOARCH := arm
GOOS := linux
GOENV_EXTRA := GOARM=5 CC_FOR_TARGET=arm-linux-gnueabi-gcc CC=$$CC_FOR_TARGET CGO_ENABLED=1
endif
ifeq ($(DEB_TARGET_ARCH),armhf)
GOARCH := arm
GOOS := linux
GOENV_EXTRA := GOARM=6 CC_FOR_TARGET=arm-linux-gnueabihf-gcc CC=$$CC_FOR_TARGET CGO_ENABLED=1
endif

CURDIR := $(shell pwd)
GOENV := GOOS=$(GOOS) GOARCH=$(GOARCH) $(GOENV_EXTRA)
GOVER := $(shell go version | cut -d ' ' -f 3)

all: build

deps:
	cd $$($(GOENV) go env GOPATH)\
	  && wget -O $(GOOS)_$(GOARCH).tar.gz $$(curl -s https://api.github.com/repos/andrey-yantsen/teko-astra-go/releases/latest | fgrep browser_download_url | cut -d'"' -f 4 | fgrep $(GOVER)_$(GOOS)_$(GOARCH).)\
	  && tar -zxf $(GOOS)_$(GOARCH).tar.gz\
	  && rm $(GOOS)_$(GOARCH).tar.gz

build:
	$(GOENV) go build -o wb-mqtt-astra

install:
	mkdir -p $(DESTDIR)/usr/bin/ $(DESTDIR)/etc/init.d/ $(DESTDIR)/etc/default/
	install -m 0644 initscripts/defaults $(DESTDIR)/etc/default/wb-mqtt-astra
	install -m 0755 wb-mqtt-astra $(DESTDIR)/usr/bin/
	install -m 0755 initscripts/wb-mqtt-astra $(DESTDIR)/etc/init.d/wb-mqtt-astra

AUTHOR_NAME = $(shell git config user.name)
AUTHOR_EMAIL = $(shell git config user.<EMAIL>)
DATE = $(shell date '+%a, %d %b %Y %T %z')
RELEASE_URGENCY = low
RELEASE_DEBIAN_TARGET = wheezy
release:
	@git fetch --tags
	@echo 'Changes:' && git log --format="* %s" `git describe --tags --abbrev=0`..HEAD | cat; echo ''
	@echo 'What version is it?' && read version && \
	  echo "wb-mqtt-astra ($$version) $(RELEASE_DEBIAN_TARGET); urgency=$(RELEASE_URGENCY)" > debian/changelog_tmp &&\
	  echo >> debian/changelog_tmp &&\
	  git log --format="  * %s" `git describe --tags --abbrev=0`..HEAD >> debian/changelog_tmp &&\
	  echo >> debian/changelog_tmp &&\
	  echo ' -- $(AUTHOR_NAME) <$(AUTHOR_EMAIL)>  $(DATE)' >> debian/changelog_tmp &&\
	  echo >> debian/changelog_tmp && cat debian/changelog >> debian/changelog_tmp &&\
	  mv debian/changelog_tmp debian/changelog &&\
	  SSH_AUTH_SOCK= WBDEV_TARGET=$(RELEASE_DEBIAN_TARGET)-armel wbdev gdeb &&\
	  hub release create -d -a ../wb-mqtt-astra_$${version}_armel.deb v$$version &&\
	  rm ../wb-mqtt-astra_$${version}*
{'fraction_non_alphanumeric': 0.18275958578225582, 'fraction_numerical': 0.010635320458998041, 'mean_word_length': 4.390648567119156, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 18, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4831071', 'n_tokens_mistral': 1536, 'n_tokens_neox': 1461, 'n_words': 306}