PostgreSQL Extension Multiple SQL Files
You could probably achieve #1 with "\i" directives to import snippets. I wouldn't advise it, though, I'd use a Makefile to concatenate the desired chunks.

It's as simple as something like:

myext--1.0.sql: myext-types.sql myext-tables.sql myext-views.sql
    cat $&lt; $@


Note that the indent must be a tab, not spaces.

There's lots of good info out there on writing basic Makefiles, so I won't go on further.