<commit_before>STATIC = dist/static
INDEX_P = deb_dist/srv/bnw-meow
STATIC_P = "$(INDEX_P)/static"
REVISION = $(shell git rev-parse --short HEAD)
.PHONY: coffee

all: index coffee eco

# Install basic deps what you will need for building (or developing)
install-deps:
	sudo apt-get install npm gpp
	# Also needed for watch script:
	# sudo apt-get install inotify-tools
	sudo npm install -g coffee-script
	npm install eco requirejs

index:
	gpp -H -DVERSION=dev -o dist/index.html templates/index.gpp

index-product:
	gpp -H -DVERSION="$(REVISION)" -DPRODUCT -o "$(INDEX_P)/index.html" \
		templates/index.gpp

coffee:
	coffee -o "$(STATIC)/js/" -bc coffee/

eco:
	-mkdir "$(STATIC)/js/templates/"
	bash -c 'ls templates/*.eco | while read file; do\
		tmp="`basename "$$file"`";\
		dest="$(STATIC)/js/templates/$${tmp/\.eco/.js}";\
		./eco.js "$$file" "$$dest";\
	done'

watch: all
	./watch.sh

pre-deb:
	rm -rf deb_dist/ *.deb
	cp -r deb/ deb_dist/
	find deb_dist/ -name '.*.swp' -delete
	mkdir -p "$(STATIC_P)/css/" "$(STATIC_P)/js/"
	cp -r "$(STATIC)/img/" "$(STATIC_P)"
	cp dist/favicon.ico "$(INDEX_P)"

minify:
	cat $(STATIC)/css/*.css > "$(STATIC_P)/css/default.css"
	./minify.js
	sed "s/^VERSION =.*/VERSION = '$(REVISION)';/" \
		"$(STATIC)/js/load_product.js" >> "$(STATIC_P)/js/meow.js"

deb: pre-deb index-product coffee eco minify
	dpkg -b deb_dist/ bnw-meow.deb

clean:
	rm -rf deb_dist/
	# Clean all compiled js files
	find $(STATIC)/js/ -mindepth 1 -maxdepth 1 ! -path '*/vendor' \
		-exec rm -r '{}' \;<commit_msg>Use fakeroot for building deb<commit_after>STATIC = dist/static
INDEX_P = deb_dist/srv/bnw-meow
STATIC_P = "$(INDEX_P)/static"
REVISION = $(shell git rev-parse --short HEAD)
.PHONY: coffee

all: index coffee eco

# Install basic deps what you will need for building (or developing)
install-deps:
	sudo apt-get install npm gpp fakeroot
	# Also needed for watch script:
	# sudo apt-get install inotify-tools
	sudo npm install -g coffee-script
	npm install eco requirejs

index:
	gpp -H -DVERSION=dev -o dist/index.html templates/index.gpp

index-product:
	gpp -H -DVERSION="$(REVISION)" -DPRODUCT -o "$(INDEX_P)/index.html" \
		templates/index.gpp

coffee:
	coffee -o "$(STATIC)/js/" -bc coffee/

eco:
	-mkdir "$(STATIC)/js/templates/"
	bash -c 'ls templates/*.eco | while read file; do\
		tmp="`basename "$$file"`";\
		dest="$(STATIC)/js/templates/$${tmp/\.eco/.js}";\
		./eco.js "$$file" "$$dest";\
	done'

watch: all
	./watch.sh

pre-deb:
	rm -rf deb_dist/ *.deb
	cp -r deb/ deb_dist/
	find deb_dist/ -name '.*.swp' -delete
	mkdir -p "$(STATIC_P)/css/" "$(STATIC_P)/js/"
	cp -r "$(STATIC)/img/" "$(STATIC_P)"
	cp dist/favicon.ico "$(INDEX_P)"

minify:
	cat $(STATIC)/css/*.css > "$(STATIC_P)/css/default.css"
	./minify.js
	sed "s/^VERSION =.*/VERSION = '$(REVISION)';/" \
		"$(STATIC)/js/load_product.js" >> "$(STATIC_P)/js/meow.js"

deb: pre-deb index-product coffee eco minify
	fakeroot dpkg -b deb_dist/ bnw-meow.deb

clean:
	rm -rf deb_dist/
	# Clean all compiled js files
	find $(STATIC)/js/ -mindepth 1 -maxdepth 1 ! -path '*/vendor' \
		-exec rm -r '{}' \;
{'fraction_non_alphanumeric': 0.18616677440206852, 'fraction_numerical': 0.001292824822236587, 'mean_word_length': 3.402560455192034, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, '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': '839534', 'n_tokens_mistral': 1323, 'n_tokens_neox': 1210, 'n_words': 328}