<commit_before>version := $(shell awk '/^version:/{print $$2}' ../text.cabal)
ghc := ghc
ghc-base-flags := -O -funbox-strict-fields -package bytestring \
	-package QuickCheck -ignore-package text
ghc-flags := $(ghc-base-flags) -i../dist/build -package-name text-$(version)
ghc-hpc-flags := $(ghc-base-flags) -fhpc -fno-ignore-asserts -odir hpcdir \
	-hidir hpcdir -i..
lib := ../dist/build/libHStext-$(version).a
lib-srcs := $(shell grep '^  *Data' ../text.cabal | \
                    sed -e 's,\.,/,g' -e 's,$$,.hs,')

all: qc coverage

lib: $(lib)

$(lib): $(lib-srcs:%=../%)
	cd .. && runghc Setup configure --user --prefix=$(HOME)
	cd .. && runghc Setup build

Properties.o: QuickCheckUtils.o

QuickCheckUtils.o: $(lib)

qc: Properties.o QuickCheckUtils.o
	$(ghc) $(ghc-flags) -o $@ $^ $(lib)
<commit_msg>Use cabal instead of runghc Setup if available<commit_after>version := $(shell awk '/^version:/{print $$2}' ../text.cabal)
ghc := ghc
ghc-base-flags := -O -funbox-strict-fields -package bytestring \
	-package QuickCheck -ignore-package text
ghc-flags := $(ghc-base-flags) -i../dist/build -package-name text-$(version)
ghc-hpc-flags := $(ghc-base-flags) -fhpc -fno-ignore-asserts -odir hpcdir \
	-hidir hpcdir -i..
lib := ../dist/build/libHStext-$(version).a
lib-srcs := $(shell grep '^  *Data' ../text.cabal | \
                    sed -e 's,\.,/,g' -e 's,$$,.hs,')

cabal := $(shell which cabal 2>/dev/null)

all: qc coverage

lib: $(lib)

$(lib): $(lib-srcs:%=../%)
ifeq ($(cabal),)
	cd .. && runghc Setup configure --user --prefix=$(HOME)
	cd .. && runghc Setup build
else
	cd .. && cabal configure
	cd .. && cabal build
endif

Properties.o: QuickCheckUtils.o

QuickCheckUtils.o: $(lib)

qc: Properties.o QuickCheckUtils.o
	$(ghc) $(ghc-flags) -o $@ $^ $(lib)

{'fraction_non_alphanumeric': 0.21871476888387825, 'fraction_numerical': 0.0016910935738444193, 'mean_word_length': 3.0432801822323463, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, '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': '4389967', 'n_tokens_mistral': 709, 'n_tokens_neox': 690, 'n_words': 164}