<commit_before># Makefile for mlox project

.PHONY: all stats version mlox-dist data-dist test-dist upload upload-mlox upload-data upload-exe

README    := mlox/mlox_readme.txt
PROGRAM   := mlox/mlox.py
RULES     := data/mlox_base.txt
VERSION   := $(shell cat VERSION)
MLOXARC   := mlox-$(VERSION).7z
EXEARC    := mlox-exe-$(VERSION).7z
RELDATE   := $(shell date --utc "+%Y-%m-%d %T (UTC)")
DATAARC   := $(shell data/arcname)
UPLOAD    := googlecode_upload.py -u john.moonsugar -p mlox
TES3LINTFILES  := $(wildcard util/tes3lint util/tes3lint*.bat util/tes3lint*.txt)
TES3LINTVER    := $(shell grep "^\#Version: " util/tes3lint | cut -f 2 -d ' ')
TES3LINTARC    := tes3lint-$(TES3LINTVER).7z
TES3CMDFILES  := util/tes3cmd
TES3CMDVER    := $(shell grep "^\#Version: " util/tes3cmd | cut -f 2 -d ' ')
TES3CMDARC    := tes3cmd-$(TES3CMDVER).7z

all: mlox-dist data-dist test-dist tes3lint-dist tes3cmd-dist

upload: upload-mlox upload-exe upload-data

upload-mlox:
	@echo "Uploading dist/$(MLOXARC)"
	$(UPLOAD) -s "[mlox $(VERSION)] - requires Python25 and wxPython" dist/$(MLOXARC)

upload-data:
	@echo "Uploading `cat dist/DATAARC`"
	$(UPLOAD) -s "[mlox-data $(RELDATE)] - install mlox_base.txt into your mlox directory" `cat dist/DATAARC`

upload-exe:
	@echo "Uploading dist/$(EXEARC)"
	$(UPLOAD) -s "[mlox-exe $(VERSION)] - standalone executable for Windows" dist/$(EXEARC)

upload-tes3lint:
	@echo "Uploading dist/$(TES3LINTARC)"
	$(UPLOAD) -s "[tes3lint $(TES3LINTVER)]" dist/$(TES3LINTARC)

upload-tes3cmd:
	@echo "Uploading dist/$(TES3CMDARC)"
	$(UPLOAD) -s "[tes3cmd $(TES3CMDVER)]" dist/$(TES3CMDARC)

# update the version strings in mlox_readme.txt, mlox.py
version: $(README) $(PROGRAM)

$(README): VERSION
	@echo "Updating $@ with latest Version number: $(VERSION)"
	@perl -p -i -e "s/^Version: (?:\d+\.\d+)/Version: $(VERSION)/" $@

$(PROGRAM): VERSION
	@echo "Updating $@ with latest Version number: $(VERSION)"
	@perl -p -i -e "s/^Version = \"(?:\d+\.\d+)\"/Version = \"$(VERSION)\"/" $@

mlox-dist: dist/$(MLOXARC)

dist/$(MLOXARC): version dist/mlox $(wildcard mlox/*)
	@rsync -uvaC mlox/ dist/mlox/ > /dev/null 2>&1
	@cp License.txt dist/mlox
	@(cd dist && rm -f $(MLOXARC) && 7z a $(MLOXARC) mlox) > /dev/null 2>&1
	@rm -rf dist/mlox/
	@echo "CREATED distibution archive for mlox: $@"

data-dist: dist dist/$(DATAARC) stats

dist/$(DATAARC): $(RULES)
	@echo "Updating $< with latest Version date: $(RELDATE)"
	@perl -p -i -e "s/^\[Version\s+[^\]]+\]/[Version $(RELDATE)]/" $<
	@(cd data ; 7z a ../$@ $(<F)) > /dev/null 2>&1
	@echo "CREATED distibution archive for mlox rule-base: $@"
	@echo "$@" > dist/DATAARC

dist/mlox:
	@echo "Creating $@"
	@mkdir -p $@

tes3lint-dist: dist/$(TES3LINTARC)

dist/$(TES3LINTARC): dist/tes3lint $(TES3LINTFILES)
	@rsync -uvaC $(TES3LINTFILES) dist/tes3lint/ > /dev/null 2>&1
	@cp License.txt dist/tes3lint
	@echo "Adding DOS line endings to .bat and .txt files in staging directory"
	@for i in dist/tes3lint/*.bat dist/tes3lint/*.txt ; do perl -p -i -e "s/\015?$$/\015/" $$i ; done
	@(cd dist && 7z a $(TES3LINTARC) tes3lint) > /dev/null 2>&1
	@rm -rf dist/tes3lint/
	@echo "CREATED distibution archive for tes3lint: $@"

dist/tes3lint:
	@echo "Creating $@"
	@mkdir -p $@

tes3cmd-dist: dist/$(TES3CMDARC)

dist/$(TES3CMDARC): dist/tes3cmd $(TES3CMDFILES)
	@rsync -uvaC $(TES3CMDFILES) dist/tes3cmd/ > /dev/null 2>&1
	@cp License.txt dist/tes3cmd
	@echo "Adding DOS line endings .txt files in staging directory"
	@for i in dist/tes3cmd/*.txt ; do perl -p -i -e "s/\015?$$/\015/" $$i ; done
	@(cd dist && 7z a $(TES3CMDARC) tes3cmd) > /dev/null 2>&1
	@rm -rf dist/tes3cmd/
	@echo "CREATED distibution archive for tes3cmd: $@"

dist/tes3cmd:
	@echo "Creating $@"
	@mkdir -p $@

stats:
	@echo "Rule-base stats ($(RELDATE))"
	@grep '^;; @' data/mlox_base.txt |wc -l|xargs echo "sections:	"
	@egrep -i '^\[(order|nearstart|nearend|note|conflict|patch|requires)( |\])' data/mlox_base.txt |wc -l|xargs echo "rules:		"
<commit_msg>fixed dependencies for minimal work<commit_after># Makefile for mlox project

.PHONY: all stats mlox-dist data-dist test-dist upload upload-mlox upload-data upload-exe upload-tes3lint upload-tes3cmd tes3lint-dist tes3cmd-dist

README         := mlox/mlox_readme.txt
PROGRAM        := mlox/mlox.py
RULES          := data/mlox_base.txt
VERSION        := $(shell cat VERSION)
MLOXARC        := mlox-$(VERSION).7z
EXEARC         := mlox-exe-$(VERSION).7z
RELDATE        := $(shell date --utc "+%Y-%m-%d %T (UTC)")
DATAARC        := $(shell cat dist/DATAARC)
NEWDATAARC     := $(shell data/arcname)
UPLOAD         := googlecode_upload.py -u john.moonsugar -p mlox
TES3LINTFILES  := $(wildcard util/tes3lint util/tes3lint*.bat util/tes3lint*.txt)
TES3LINTVER    := $(shell grep "^\#Version: " util/tes3lint | cut -f 2 -d ' ')
TES3LINTARC    := tes3lint-$(TES3LINTVER).7z
TES3CMDFILES   := util/tes3cmd
TES3CMDVER     := $(shell grep -a "^\#Version: " util/tes3cmd | cut -f 2 -d ' ')
TES3CMDARC     := tes3cmd-$(TES3CMDVER).7z

all: mlox-dist data-dist test-dist tes3lint-dist tes3cmd-dist

upload: upload-mlox upload-exe upload-data

upload-mlox:
	@echo "Uploading dist/$(MLOXARC)"
	$(UPLOAD) -s "[mlox $(VERSION)] - requires Python25 and wxPython" dist/$(MLOXARC)

upload-data:
	@echo "Uploading `cat dist/DATAARC`"
	$(UPLOAD) -s "[mlox-data $(RELDATE)] - install mlox_base.txt into your mlox directory" `cat dist/DATAARC`

upload-exe:
	@echo "Uploading dist/$(EXEARC)"
	$(UPLOAD) -s "[mlox-exe $(VERSION)] - standalone executable for Windows" dist/$(EXEARC)

upload-tes3lint:
	@echo "Uploading dist/$(TES3LINTARC)"
	$(UPLOAD) -s "[tes3lint $(TES3LINTVER)]" dist/$(TES3LINTARC)

upload-tes3cmd:
	@echo "Uploading dist/$(TES3CMDARC)"
	$(UPLOAD) -s "[tes3cmd $(TES3CMDVER)]" dist/$(TES3CMDARC)

$(README): VERSION
	@echo "Updating $@ with latest Version number: $(VERSION)"
	@perl -p -i -e "s/^Version: (?:\d+\.\d+)/Version: $(VERSION)/" $@

$(PROGRAM): VERSION
	@echo "Updating $@ with latest Version number: $(VERSION)"
	@perl -p -i -e "s/^Version = \"(?:\d+\.\d+)\"/Version = \"$(VERSION)\"/" $@

mlox-dist: dist/$(MLOXARC)

dist/$(MLOXARC): $(README) $(PROGRAM) $(wildcard mlox/*)
	@mkdir -p dist/mlox
	@rsync -uvaC mlox/ dist/mlox/ > /dev/null 2>&1
	@cp License.txt dist/mlox
	@(cd dist && rm -f $(MLOXARC) && 7z a $(MLOXARC) mlox) > /dev/null 2>&1
	@rm -rf dist/mlox/
	@echo "CREATED distibution archive for mlox: $@"

data-dist: dist/$(DATAARC)

dist/$(DATAARC): $(RULES)
	@echo "Updating $< with latest Version date: $(RELDATE)"
	@perl -p -i -e "s/^\[Version\s+[^\]]+\]/[Version $(RELDATE)]/" $<
	@(cd data ; 7z a ../dist/$(NEWDATAARC) $(<F)) > /dev/null 2>&1
	@echo "CREATED distibution archive for mlox rule-base: $(NEWDATAARC)"
	@echo $(NEWDATAARC) > dist/DATAARC

tes3lint-dist: dist/$(TES3LINTARC)

dist/$(TES3LINTARC): $(TES3LINTFILES)
	@mkdir -p dist/tes3lint
	@rsync -uvaC $(TES3LINTFILES) dist/tes3lint/ > /dev/null 2>&1
	@cp License.txt dist/tes3lint
	@echo "Adding DOS line endings to .bat and .txt files in staging directory"
	@for i in dist/tes3lint/*.bat dist/tes3lint/*.txt ; do perl -p -i -e "s/\015?$$/\015/" $$i ; done
	@(cd dist && 7z a $(TES3LINTARC) tes3lint) > /dev/null 2>&1
	@rm -rf dist/tes3lint/
	@echo "CREATED distibution archive for tes3lint: $@"

tes3cmd-dist: dist/$(TES3CMDARC)

dist/$(TES3CMDARC): $(TES3CMDFILES)
	@mkdir -p dist/tes3cmd
	@rsync -uvaC $(TES3CMDFILES) dist/tes3cmd/ > /dev/null 2>&1
	@cp License.txt dist/tes3cmd
	@echo "Adding DOS line endings .txt files in staging directory"
	@for i in dist/tes3cmd/*.txt ; do perl -p -i -e "s/\015?$$/\015/" $$i ; done
	@(cd dist && 7z a $(TES3CMDARC) tes3cmd) > /dev/null 2>&1
	@rm -rf dist/tes3cmd/
	@echo "CREATED distibution archive for tes3cmd: $@"

stats:
	@echo "Rule-base stats ($(RELDATE))"
	@grep '^;; @' data/mlox_base.txt |wc -l|xargs echo "sections:	"
	@egrep -i '^\[(order|nearstart|nearend|note|conflict|patch|requires)( |\])' data/mlox_base.txt |wc -l|xargs echo "rules:		"

{'fraction_non_alphanumeric': 0.1892605633802817, 'fraction_numerical': 0.02414486921529175, 'mean_word_length': 3.861246943765281, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 33, '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': '5019515', 'n_tokens_mistral': 3506, 'n_tokens_neox': 3258, 'n_words': 801}