<commit_before># convenience variables
mkfile_path := $(abspath $(lastword $(MAKEFILE_LIST)))
mydir := $(abspath $(lastword $(dir $(MAKEFILE_LIST))))
cwd := $(notdir $(patsubst %/,%,$(dir $(mkfile_path))))

# source code
DOC := $(wildcard $(mydir)/src/*.m4)
SRC = $(filter-out %.min.js, $(wildcard $(mydir)/src/*.js))
EXT = package.json LICENSE

# compilers/tools
node := /usr/bin/env node
m4 := /usr/bin/env m4
npm := /usr/bin/env npm
coffee := $(mydir)/node_modules/coffee-script/bin/coffee
coffeelint := $(mydir)/node_modules/coffeelint/bin/coffeelint
uglify := $(mydir)/node_modules/uglify-js/bin/uglifyjs

SUBDIRS = src

.PHONY: clean release all doc publish
all: doc

build: deps ugly test

test:

deps:
	cd $(mydir); $(npm) install
	@touch deps

doc:
	echo $(DOC)
	echo $(MAIN_M4)
	$(foreach d,$(DOC),$(m4) $(d) > $(d:.m4=.md);)

publish: doc
	$(foreach d,$(DOC:.m4=.md),mv $(d) $(mydir)/wiki;)

lint: style
	@touch lint

style:
	$(foreach f,$(SRC),sed -ri 's/\s+$$//' $(f);)
	@touch style

ugly: deps
	$(foreach f,$(SRC),$(uglify) $(f) > $(f:.js=.min.js);)
	@touch ugly

clean:
	$(foreach f,$(SRC:.js=.min.js),$(RM) $(f);)
	$(foreach f,$(DOC:.m4=.md),$(RM) $(f);)
	$(foreach t,deps ugly style doc,$(RM) $(t);)

release: deps ugly
	cd $(mydir); \
	  sed -i '1s/src/lib/' $(filter index%, $(SRC)); \
	  tar cf bebopt.tar $(SRC) $(EXT); \
	  sed -i 's/index/index.min/' package.json; \
	  tar czf bebopt.min.tar.gz $(SRC:.js=.min.js) $(EXT); \
	  sed -i 's/index[.]min/index/' package.json; \
	  git checkout void; \
	  git clean -e bebopt.tar -e bebopt.min.tar.gz -f; \
	  tar xf bebopt.tar; \
	  git add package.json LICENSE index.js lib; \
	  $(RM) -r node_modules; \
	  git clean -e bebopt.min.tar.gz -f<commit_msg>adds more rules to make<commit_after># convenience variables
mkfile_path := $(abspath $(lastword $(MAKEFILE_LIST)))
mydir := $(abspath $(lastword $(dir $(MAKEFILE_LIST))))
cwd := $(notdir $(patsubst %/,%,$(dir $(mkfile_path))))

# source code
DOC := $(wildcard $(mydir)/src/*.m4)
SRC = $(filter-out %.min.js, $(wildcard $(mydir)/src/*.js))
EXT = package.json LICENSE

# compilers/tools
node := /usr/bin/env node
m4 := /usr/bin/env m4
markdown := /usr/bin/env markdown
npm := /usr/bin/env npm
coffee := $(mydir)/node_modules/coffee-script/bin/coffee
coffeelint := $(mydir)/node_modules/coffeelint/bin/coffeelint
uglify := $(mydir)/node_modules/uglify-js/bin/uglifyjs

SUBDIRS = src

.PHONY: clean release all doc publish expand-doc
all: doc

build: deps ugly test

test:

deps:
	cd $(mydir); $(npm) install
	@touch deps

%.md : %.m4
	$(m4) -I $(mydir)/src -P $< > $@

doc: $(DOC:.m4=.md)

expand-doc: $(DOC:.m4=.md)
	$(foreach d,$(DOC),$(markdown) $(d:.m4=.md) > $(d:.m4=.html);)

publish: $(DOC:.m4=.md)
	$(foreach d,$(DOC:.m4=.md),mv $(d) $(mydir)/wiki;)

lint: style
	@touch lint

style:
	$(foreach f,$(SRC),sed -ri 's/\s+$$//' $(f);)
	@touch style

ugly: $(SRC:.js=.min.js)

%.min.js : %.js
	$(uglify) $< > $@

clean:
	$(foreach f,$(SRC:.js=.min.js),$(RM) $(f);)
	$(foreach f,$(DOC:.m4=.md),$(RM) $(f);)
	$(foreach t,deps ugly style doc,$(RM) $(t);)

release: deps ugly
	cd $(mydir); \
	  sed -i '1s/src/lib/' $(filter index%, $(SRC)); \
	  tar cf bebopt.tar $(SRC) $(EXT); \
	  sed -i 's/index/index.min/' package.json; \
	  tar czf bebopt.min.tar.gz $(SRC:.js=.min.js) $(EXT); \
	  sed -i 's/index[.]min/index/' package.json; \
	  git checkout void; \
	  git clean -e bebopt.tar -e bebopt.min.tar.gz -f; \
	  tar xf bebopt.tar; \
	  git add package.json LICENSE index.js lib; \
	  $(RM) -r node_modules; \
	  git clean -e bebopt.min.tar.gz -f
{'fraction_non_alphanumeric': 0.23382805936712406, 'fraction_numerical': 0.006160739288714646, 'mean_word_length': 3.6329442282749675, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 8, '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': '1124842', 'n_tokens_mistral': 1601, 'n_tokens_neox': 1500, 'n_words': 353}