<commit_before>PROMPT=$$$$$$S
SHELL:=CMD.EXE

snapshot:
	$(MAKE) fmt
	for /F %%V in ('git.exe describe --tags') do \
	    go build -ldflags "-s -w -X main.version=%%V"

release:
	$(MAKE) fmt
	if not exist bin mkdir bin
	for %%I in (386 amd64) do \
	    if not exist bin\%%I mkdir bin\%%I
	for %%D in (%CD%) do \
	for %%I in (386 amd64) do \
	    set "GOARCH=%%I" & go build -o bin/%%I/%%~nD.exe -ldflags "-s -w"
	( set "GOOS=linux" & go build -ldflags "-s -w" )

clean:
	if exist bin rmdir /s bin

# Without ( and ) , set is called as an external command in nmake

fmt:
	- for /F "tokens=2" %%I in ('git status -s ^| more.com ^| findstr /R ".M.*\.go$$" ') do \
	     go fmt "%%I"

syso:
	pushd $(MAKEDIR)\Etc & go generate & popd

get:
	go get -u
#	go get -u github.com/zetamatta/go-readline-ny@master
	go mod tidy

package:
	for /F %%V in ('type Etc\version.txt') do \
	for %%D in (%CD%) do \
	for %%A in (386 amd64) do \
	for %%N in (%%~nD-%%V-windows-%%A.zip) do \
	    zip -9j "%%N" "bin\%%A\nyagos.exe" .nyagos _nyagos makeicon.cmd LICENSE & \
	    zip -9  "%%N" nyagos.d\*.lua nyagos.d\catalog\*.lua
	for /F %%V in ('type Etc\version.txt') do \
	for %%D in (%CD%) do \
	for %%A in (amd64) do \
	    tar -zcvf "nyagos-%%V-linux-%%A.tar.gz" -C .. \
		%%~nD/nyagos \
		%%~nD/.nyagos \
		%%~nD/_nyagos \
		%%~nD/nyagos.d

install:
	if "%INSTALLDIR%" == "" ( \
	    set /P "INSTALLDIR=Install Dir ? " & \
	    $(MAKE) install & \
	    exit /b 1 \
	)
	-robocopy  nyagos.d    "$(INSTALLDIR)\nyagos.d" /E
	copy /-Y  _nyagos     "$(INSTALLDIR)\."
	copy /-Y  nyagos.exe  "$(INSTALLDIR)\." || ( \
	    move "$(INSTALLDIR)\nyagos.exe" "$(INSTALLDIR)\nyagos.exe-%RANDOM%" & \
	    copy nyagos.exe  "$(INSTALLDIR)\." )

update:
	for /F "skip=1" %%I in ('where nyagos.exe') do $(MAKE) install INSTALLDIR=%%~dpI<commit_msg>Fix: make install without INSTALLDIR=...<commit_after>PROMPT=$$$$$$S
SHELL:=CMD.EXE

snapshot:
	$(MAKE) fmt
	for /F %%V in ('git.exe describe --tags') do \
	    go build -ldflags "-s -w -X main.version=%%V"

release:
	$(MAKE) fmt
	if not exist bin mkdir bin
	for %%I in (386 amd64) do \
	    if not exist bin\%%I mkdir bin\%%I
	for %%D in (%CD%) do \
	for %%I in (386 amd64) do \
	    set "GOARCH=%%I" & go build -o bin/%%I/%%~nD.exe -ldflags "-s -w"
	( set "GOOS=linux" & go build -ldflags "-s -w" )

clean:
	if exist bin rmdir /s bin

# Without ( and ) , set is called as an external command in nmake

fmt:
	- for /F "tokens=2" %%I in ('git status -s ^| more.com ^| findstr /R ".M.*\.go$$" ') do \
	     go fmt "%%I"

syso:
	pushd $(MAKEDIR)\Etc & go generate & popd

get:
	go get -u
#	go get -u github.com/zetamatta/go-readline-ny@master
	go mod tidy

package:
	for /F %%V in ('type Etc\version.txt') do \
	for %%D in (%CD%) do \
	for %%A in (386 amd64) do \
	for %%N in (%%~nD-%%V-windows-%%A.zip) do \
	    zip -9j "%%N" "bin\%%A\nyagos.exe" .nyagos _nyagos makeicon.cmd LICENSE & \
	    zip -9  "%%N" nyagos.d\*.lua nyagos.d\catalog\*.lua
	for /F %%V in ('type Etc\version.txt') do \
	for %%D in (%CD%) do \
	for %%A in (amd64) do \
	    tar -zcvf "nyagos-%%V-linux-%%A.tar.gz" -C .. \
		%%~nD/nyagos \
		%%~nD/.nyagos \
		%%~nD/_nyagos \
		%%~nD/nyagos.d

install:
	@if "%INSTALLDIR%" == "" ( \
	    echo Please do $(MAKE) INSTALLDIR=... & \
	    echo or set INSTALLDIR=... & \
	    exit /b 1 \
	)
	-robocopy  nyagos.d    "$(INSTALLDIR)\nyagos.d" /E
	copy /-Y  _nyagos     "$(INSTALLDIR)\."
	copy /-Y  nyagos.exe  "$(INSTALLDIR)\." || ( \
	    move "$(INSTALLDIR)\nyagos.exe" "$(INSTALLDIR)\nyagos.exe-%RANDOM%" & \
	    copy nyagos.exe  "$(INSTALLDIR)\." )

update:
	for /F "skip=1" %%I in ('where nyagos.exe') do $(MAKE) install INSTALLDIR=%%~dpI
{'fraction_non_alphanumeric': 0.21292257360959652, 'fraction_numerical': 0.011995637949836423, 'mean_word_length': 2.4744318181818183, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '268629', 'n_tokens_mistral': 1747, 'n_tokens_neox': 1613, 'n_words': 454}