account-files/source/Makefile

33 lines
1.6 KiB
Makefile

../result/account-files: account-files.c ../result
gcc -static "$<" $$(pkg-config --static --cflags --libs libxxhash sqlite3) -o "$@"
../result:
mkdir ../result
account-files.c: main.setup.db.sqlite.sql.h
touch "$@"
# ALEXTODO: could be improved by keeping bytes like 'a-zA-Z0-9' etc. however would generate
# more complex code here. The total size increasse is about 1k and acceptable
# the header produced here stores the string ascaped via "\xXX\xXX...." for each input byte
# it strips however SQL comments to save some space
main.setup.db.sqlite.sql.h: main.setup.db.sqlite.sql
echo '#define MAIN_SETUP_DB_SQLITE_SQL "'"$$(grep -ve '^-- ' "$<" | od -A n -t x1 | tr -d '\n' | sed 's/ /\\x/g')"'"' > "$@"
## this was the previous attempt, yet `printf '%q'` does not produce likely working output....
## frankly when it comes to escaping there is no "standard" and all bash, c, js, python all
## have their own rules...
## printf '#define MAIN_SETUP_DB_SQLITE_SQL "%q"\n' "$$(grep -ve '^-- ' "$<" )" >"$@"
#
#convert.hierarchical.files.table.render.absolute.pathnames.by.hash: convert.hierarchical.files.table.render.absolute.pathnames.by.hash.sql
# time cat "$<" | sqlite3 sources.sqlite3.db | pv -l > "$@"
#
#convert.hierarchical.files.table.render.absolute.pathnames: convert.hierarchical.files.table.render.absolute.pathnames.sql
# time cat "$<" | sqlite3 sources.sqlite3.db | pv -l > "$@"
#
#convert.hierarchical.sources.table.render.absolute.pathnames:
# time cat convert.hierarchical.sources.table.render.absolute.pathnames.sql | sqlite3 sources.sqlite3.db | pv -l > convert.hierarchical.sources.table.render.absolute.pathnames