<commit_before>.PHONY: all clean veryclean postgres pg_logfebe testdb

all:
	GOPATH=`pwd`:$(GOPATH) go install pg_logplexcollector tool/logplexd

fmt:
	GOPATH=`pwd` go fmt pg_logplexcollector tool/logplexd

test:
	GOPATH=`pwd` go test pg_logplexcollector tool/logplexd

clean:
	rm -f bin/pg_logplexcollector
	rm -f bin/logplexd

# Everything below here is a monstrous hack to make playing with the
# toolchain a bit easier.  If one sets
# PGSRCDIR=/a/local/git/repo/with/postgres then typing "make testdb"
# should copy in Postgres, configure, install it locally, check out
# the pg_logfebe extension, compile and install *that*, initdb, and
# then configure that initdb's postgresql.conf to load the extension
# and configure it with some defaults.

veryclean: clean
	rm -rf tmp/src/postgres
	rm -rf tmp/src/pg_logfebe
	rm -rf tmp/postgres
	rm -rf tmp/testdb

postgres: tmp/postgres/bin/pg_config
pg_logfebe: tmp/postgres/lib/pg_logfebe.so
testdb: tmp/testdb

# Following targets copy and grab files

tmp/src/postgres/configure:
	mkdir -p tmp/src
	cp -a $(PGSRCDIR) tmp/src/postgres

tmp/src/pg_logfebe:
	git clone https://github.com/fdr/pg_logfebe.git	tmp/src/pg_logfebe

# Compilation-oriented targets

tmp/postgres/bin/pg_config: tmp/src/postgres/configure
	(cd tmp/src/postgres &&			\
	git clean -fdx &&			\
	env CFLAGS='-O0 -g'			\
		./configure			\<commit_msg>make testdb: switch to 'git archive' from 'cp -a '<commit_after>.PHONY: all clean veryclean postgres pg_logfebe testdb

all:
	GOPATH=`pwd`:$(GOPATH) go install pg_logplexcollector tool/logplexd

fmt:
	GOPATH=`pwd` go fmt pg_logplexcollector tool/logplexd

test:
	GOPATH=`pwd` go test pg_logplexcollector tool/logplexd

clean:
	rm -f bin/pg_logplexcollector
	rm -f bin/logplexd

# Everything below here is a monstrous hack to make playing with the
# toolchain a bit easier.  If one sets
# PGSRCDIR=/a/local/git/repo/with/postgres then typing "make testdb"
# should copy in Postgres, configure, install it locally, check out
# the pg_logfebe extension, compile and install *that*, initdb, and
# then configure that initdb's postgresql.conf to load the extension
# and configure it with some defaults.

veryclean: clean
	rm -rf tmp/src/postgres
	rm -rf tmp/src/pg_logfebe
	rm -rf tmp/postgres
	rm -rf tmp/testdb

postgres: tmp/postgres/bin/pg_config
pg_logfebe: tmp/postgres/lib/pg_logfebe.so
testdb: tmp/testdb

# Following targets copy and grab files

tmp/src/postgres/configure:
	mkdir -p tmp/src
	(cd tmp/src && \
	 git archive --remote=$(PGSRC) --prefix='postgres/' \
	   REL9_2_2 --prefix='postgres/' \
	| tar x)

tmp/src/pg_logfebe:
	git clone https://github.com/fdr/pg_logfebe.git	tmp/src/pg_logfebe

# Compilation-oriented targets

tmp/postgres/bin/pg_config: tmp/src/postgres/configure
	(cd tmp/src/postgres &&			\
	env CFLAGS='-O0 -g'			\
		./configure			\
{'fraction_non_alphanumeric': 0.10137760508654185, 'fraction_numerical': 0.0017661603673613563, 'mean_word_length': 4.075268817204301, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, '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': '4449058', 'n_tokens_mistral': 1074, 'n_tokens_neox': 1043, 'n_words': 296}