30 lines
901 B
Makefile
30 lines
901 B
Makefile
.PHONY: dangerous drop-db rebuild-db load-catalog install-modules
|
|
|
|
dangerous:
|
|
ifndef PGC_DANGEROUS
|
|
$(error Refusing to continue without PGC_DANGEROUS set.)
|
|
endif
|
|
|
|
drop-db: dangerous
|
|
dropdb --if-exists --username="pgc_owner" pg_book_catalog
|
|
|
|
rebuild-db: drop-db
|
|
createdb --username="pgc_owner" pg_book_catalog \
|
|
"Tables for an import of the book catalog from Project Gutenberg."
|
|
psql --dbname="pg_book_catalog" --username="pgc_owner" \
|
|
--command="\set ON_ERROR_STOP" \
|
|
--command="BEGIN TRANSACTION;" \
|
|
--file="create-tables.sql" \
|
|
--command="COMMIT;"
|
|
|
|
load-catalog:
|
|
psql --username="pgc_owner" pg_book_catalog \
|
|
--command="TRUNCATE TABLE book, author;"
|
|
bin/load-gutenberg.pl pg_catalog.csv
|
|
|
|
PGC_PERL5LIB ?= "/usr/local/lib/site_perl"
|
|
|
|
install-modules:
|
|
install --directory $(PGC_PERL5LIB)
|
|
cp --recursive lib/Book $(PGC_PERL5LIB)
|