<commit_before>.PHONY: build designmode repl clean docs web dash lint

LIB_SOURCE_FILES = $(wildcard src-lib/**/*hs)
LHS_FILES = $(wildcard src-lib/**/*.lhs)
SANDBOX = /home/vagrant/pigment-sandbox

build: build/index.html build/assets/index.css build/assets/all.js

designmode: designmode/index.html designmode/assets/all.js

repl: $(SANDBOX)
	cabal repl

# http://blog.jgc.org/2015/04/the-one-line-you-should-add-to-every.html
print-%: ; @echo $*=$($*)

clean:
	git clean -xf

$(SANDBOX)/bin/designmode.jsexe/all.js: $(SANDBOX) $(LIB_SOURCE_FILES) src-web/hs/Designmode.hs
	cabal install --ghcjs --flag ghcjs --disable-documentation --disable-library-profiling --disable-benchmarks

$(SANDBOX)/bin/pigment.jsexe/all.js: $(SANDBOX) $(LIB_SOURCE_FILES) src-web/hs/Main.hs
	cabal install --ghcjs --flag ghcjs --disable-documentation --disable-library-profiling --disable-benchmarks

$(SANDBOX):
	cabal sandbox init --sandbox $(SANDBOX)
	cabal sandbox add-source ../react-haskell

build/index.html: src-web/index.html
	cp src-web/index.html build/

build/assets/index.css: src-web/css/index.css
	cp src-web/css/index.css build/assets/

build/assets/all.js: $(SANDBOX)/bin/pigment.jsexe/all.js
	cp $(SANDBOX)/bin/pigment.jsexe/all.js build/assets/

designmode/assets/index.css: src-web/css/index.css
	cp src-web/css/index.css designmode/assets/

designmode/assets/all.js: $(SANDBOX)/bin/designmode.jsexe/all.js
	cp $(SANDBOX)/bin/designmode.jsexe/all.js designmode/assets/

# This has a hidden dependency on global `hscolour`.
dist/doc/html/pigment/index.html: $(SANDBOX) $(LIB_SOURCE_FILES)
	cabal haddock --hyperlink-source

# this has a hidden dependency on sandbox-installed dash-haskell
dash: dist/doc/html/pigment/index.html
	rm -rf docsets
	../sandbox/.cabal-sandbox/bin/dash-haskell -c pigment.cabal -o docsets

lint:
	../sandbox/.cabal-sandbox/bin/hlint src-lib

# *caution*
docs:
	rm -rf docs
	mkdir docs
	cd lib; rsync -R $(LHS_FILES) docs; cd -
	cd docs; find . -name "*.lhs" -exec rename -v 's/\.lhs$$/\.md/i' "{}" ";"; cd -
	cd docs; ls | xargs sed -i '' -e's/^> /    /'; cd -<commit_msg>Point Makefile to the actual sandbox.<commit_after>.PHONY: build designmode repl clean docs web dash lint

LIB_SOURCE_FILES = $(wildcard src-lib/**/*hs)
LHS_FILES = $(wildcard src-lib/**/*.lhs)
SANDBOX = /home/vagrant/pigment-sandbox

build: build/index.html build/assets/index.css build/assets/all.js

designmode: designmode/index.html designmode/assets/all.js

repl: $(SANDBOX)
	cabal repl

# http://blog.jgc.org/2015/04/the-one-line-you-should-add-to-every.html
print-%: ; @echo $*=$($*)

clean:
	git clean -xf

$(SANDBOX)/bin/designmode.jsexe/all.js: $(SANDBOX) $(LIB_SOURCE_FILES) src-web/hs/Designmode.hs
	cabal install --ghcjs --flag ghcjs --disable-documentation --disable-library-profiling --disable-benchmarks

$(SANDBOX)/bin/pigment.jsexe/all.js: $(SANDBOX) $(LIB_SOURCE_FILES) src-web/hs/Main.hs
	cabal install --ghcjs --flag ghcjs --disable-documentation --disable-library-profiling --disable-benchmarks

$(SANDBOX):
	cabal sandbox init --sandbox $(SANDBOX)
	cabal sandbox add-source ../react-haskell

build/index.html: src-web/index.html
	cp src-web/index.html build/

build/assets/index.css: src-web/css/index.css
	cp src-web/css/index.css build/assets/

build/assets/all.js: $(SANDBOX)/bin/pigment.jsexe/all.js
	cp $(SANDBOX)/bin/pigment.jsexe/all.js build/assets/

designmode/assets/index.css: src-web/css/index.css
	cp src-web/css/index.css designmode/assets/

designmode/assets/all.js: $(SANDBOX)/bin/designmode.jsexe/all.js
	cp $(SANDBOX)/bin/designmode.jsexe/all.js designmode/assets/

# This has a hidden dependency on global `hscolour`.
dist/doc/html/pigment/index.html: $(SANDBOX) $(LIB_SOURCE_FILES)
	cabal haddock --hyperlink-source

# this has a hidden dependency on sandbox-installed dash-haskell
dash: dist/doc/html/pigment/index.html
	rm -rf docsets
	$(SANDBOX)/bin/dash-haskell -c pigment.cabal -o docsets

lint:
	$(SANDBOX)/bin/hlint src-lib

# *caution*
docs:
	rm -rf docs
	mkdir docs
	cd lib; rsync -R $(LHS_FILES) docs; cd -
	cd docs; find . -name "*.lhs" -exec rename -v 's/\.lhs$$/\.md/i' "{}" ";"; cd -
	cd docs; ls | xargs sed -i '' -e's/^> /    /'; cd -
{'fraction_non_alphanumeric': 0.16626908396946566, 'fraction_numerical': 0.0028625954198473282, 'mean_word_length': 3.792, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '1927383', 'n_tokens_mistral': 1788, 'n_tokens_neox': 1653, 'n_words': 327}