Can I make something similar to a makefile for psql? Basically I have a handful of .sql files that I regularly modify in structure that need to be run in a certain order:

CREATE.sql,
INSERT.sql,
PLPSGSQL.sql,
TEST.sql,
DROP.sql


Since every structural modification requires a full re-run of this sequence I would like to save myself the trouble of tapping throgh my command history and compile them into a makefile-esque structure; e.g. 

$ Makepsql
$ psql
&gt; \i CREATE.sql
&gt; \i INSERT.sql
&gt; \i PLPSGSQL.sql
&gt; \i TEST.sql
&gt; \i DROP.sql
&gt; \q


Is there something like this?
Write a bash script and pass those files as arguments to psql.

#!/bin/bash

set -e #abort on error

psql -v ON_ERROR_STOP=1 -f CREATE.sql
#...insert your scripts here
#...
psql -v ON_ERROR_STOP=1 -f DROP.sql


If you want the Makefile functionality (e.g. check modified dates of files and dependencies), just write a Makefile, and use the psql commands!