2023-03-18 17:32:31 +01:00
|
|
|
# Remove all columns according to specification in columns.pruned.tsv
|
2023-03-18 17:00:48 +01:00
|
|
|
languages.pruned.tsv: languages.original.tsv columns.user.tsv
|
2023-03-18 17:42:18 +01:00
|
|
|
bash -c "cut -f`grep '^y' columns.user.tsv | cut -f3 | paste -sd ','` $< >$@"
|
2023-03-18 17:00:48 +01:00
|
|
|
|
2023-03-18 16:42:19 +01:00
|
|
|
# Allow user to mark in which columns is interested
|
|
|
|
columns.user.tsv: columns.pruned.tsv
|
2023-03-18 17:32:31 +01:00
|
|
|
if [ -f $@ ]; then touch $@; else awk 'NR==1{ printf("Keep\tType\t"); print } NR>1{printf("n\tstr\t"); print}' $< >$@; fi
|
2023-03-18 16:42:19 +01:00
|
|
|
|
|
|
|
# Prune columns that are not needed to create specification
|
|
|
|
columns.pruned.tsv: columns.original.tsv
|
|
|
|
cut --complement -f3,4,5,7,8,9,10 $< >$@
|
|
|
|
|
|
|
|
# Change data to TSV format since it is easier to process using standard UNIX tools
|
|
|
|
%.tsv: %.csv
|
2023-03-18 17:42:18 +01:00
|
|
|
csv2tsv/csv2tsv <$< >$@
|
2023-03-18 16:42:19 +01:00
|
|
|
|
|
|
|
# Check while downloading that file is as expected.
|
|
|
|
# Otherwise automatic filter mechanism wouldn't work.
|
|
|
|
# If hashes differ then user of this repo must migrate columns.user.tsv to a new format
|
|
|
|
columns.original.csv:
|
|
|
|
wget 'https://pldb.com/columns.csv' -O $@
|
|
|
|
sha256sum -c checksums.sha256
|
|
|
|
|
|
|
|
languages.original.csv: columns.original.csv
|
|
|
|
wget 'https://pldb.com/languages.csv' -O $@
|
2023-03-18 16:47:06 +01:00
|
|
|
|
|
|
|
clean:
|
|
|
|
rm -f languages.*.tsv languages.*.csv columns.original.tsv columns.*.csv columns.pruned.tsv
|
|
|
|
|
2023-03-18 17:42:18 +01:00
|
|
|
csv2tsv/csv2tsv: csv2tsv/csv2tsv.go
|
|
|
|
cd csv2tsv; go build
|
|
|
|
|
2023-03-18 20:24:20 +01:00
|
|
|
tsv2json/tsv2json: tsv2json/tsv2json.cc
|
|
|
|
g++ -std=c++20 -O3 -Wall -Wextra -o $@ $<
|
|
|
|
|
2023-03-18 16:47:06 +01:00
|
|
|
.PHONY: clean
|