zhv/makefile

19 lines
703 B
Makefile
Raw Normal View History

2023-05-09 10:02:24 +02:00
SHELL := /bin/bash
2023-05-09 10:40:04 +02:00
TABLES = stops
2023-05-09 10:02:24 +02:00
SCHEMA = zhv
psql = $(strip psql -v schema=$(SCHEMA))
2023-05-09 10:40:04 +02:00
# $(addprefix prefix,names…): The argument names is regarded as a series of names, separated by whitespace; prefix is used as a unit. The value of prefix is prepended to the front of each individual name and the resulting larger names are concatenated with single spaces between them.
#
# FORMAT(format_string [, format_arg [, ...] ])
load: $(addprefix load-,$(TABLES))
@$(psql) -t -A -c "SELECT FORMAT('* loaded %s', feed_file) WHERE feed_file = '$(GTFS)';"
2023-05-09 10:02:24 +02:00
# -v: variable assignment, like the /set meta-command
# $<: name of the firest prerequisite
init: sql/schema.sql
$(psql) -v ON_ERROR_STOP=on -f $<