Cleanup: Rearranged source code order: Moved exception classes

to the part of the file labelled "available to stbt scripts".
Add "save_frame" to "stbt run" public API

"save_frame" can save to disk the buffer in the "screenshot" property
of MatchTimeout and MotionTimeout exceptions.

Note that I only moved "save_frame" to the part of the file labelled
"available to stbt scripts"; I didn't change the function itself.
New "get_frame" function in "stbt run" public API

The intended use is `save_frame(get_frame(), "filename.png")`
so that stbt scripts --or custom helper functions called from those
scripts-- can capture screenshots at arbitrary points in the script.
Add "debug" to "stbt run" public API

Exposing this to user scripts doesn't seem the cleanest thing, but it's
certainly convenient to have a way to print debug output only when stbt
run "--verbose" was given.

There's nothing stopping user scripts from importing their own logging
mechanism, of course.

Note that I moved "debug" to the part of the file labelled "available
to stbt scripts" and I also added a docstring.
Fix selftests on OS X

The selftests for the GStreamer elements work by searching for specific
GStreamer bus messages on standard output.

For some reason I still don't understand, setting GST_DEBUG=4 failed to
print the bus messages on OS X (perhaps the GStreamer binaries provided
by my package manager, macports, have the higher levels of debug
compiled out?). Using gst-launch "--messages" prints exactly the same
bus messages to stdout. It's certainly a better solution than relying on
undocumented debug output.
.gitignore stbt-debug directory

It is created by the selftest
test_detect_motion_with_debug_output_does_not_segfault_without_mask.

I should probably change the test framework to run from the test's
scratch directory, so that the debug output goes there and is deleted
by the test teardown. But this will do for now.
Makefile: Define targets "all", "clean", etc as phony

See http://www.gnu.org/software/make/manual/html_node/Phony-Targets.html
Makefile: Force rebuild if installation directories or compilation flags change

The main problem this fixes is:

    make
    make prefix=$HOME install

which would install $HOME/bin/stbt pointing at
/usr/local/libexec/stbt/stbt-run instead of
$HOME/libexec/stbt/stbt-run.

Now, `make prefix=$HOME install` will rebuild the `stbt` target if
prefix has changed since `stbt` was built.

While I did this change I decided I'd do the same for CC, CFLAGS,
LDFLAGS, etc.

Note that I have to escape single-quotes in FLAGS, so that when make
expands '$(FLAGS)' the shell still sees a single string. Note also that
the syntax highlighting engine of my editor (Emacs) got terribly
confused by the first unmatched single-quote in the definition of "sq",
hence the comment with closing "')".
Makefile: Don't rebuild gst/*.o unnecessarily with each new git commit

VERSION changes with each commit (e.g. from 0.7-5-g2c434b2 to
0.7-6-gc8ea149), which was changing .stbt-cflags, which was forcing
everything in gst/ to be rebuilt after each commit. Now only
gst/gst-stb-tester.o and gst/libgst-stb-tester.so are rebuilt.

Note that since the previous commit, we do rebuild gst/gst-stb-tester.o
(and the .so library) whenever VERSION changes. The version number is
embedded in the library, and reported by "gst-inspect stb-tester".
rpm spec file: Bump stb-tester version to 0.8
Makefile: "make check" doesn't need to rebuild "stbt"

The original commit (2c454289) only intended to rebuild the
shared library, but actually also rebuild "stbt" and "stbt.1".

Now that "stbt" is rebuilt whenever "prefix" changes (see commit
31bd0a25), if I do:

    make prefix=$HOME
    make check

...the "make check" would rebuild "stbt", even though the unit tests
don't actually use "stbt" directly -- they use "stbt-run" and
"stbt-record", because "stbt" references stbt.py at its installed
location, whereas the unit tests want to test the stbt.py in the source
location.