Adding %g syntax

Adding a new flag that expands to the glob expansion match.
The main use case for this is if the command to run changes the basename
of the file:

: foreach *_master.c |> foo %f |> %g_minor.out

I implemented it by adding on to the basenamelen, basenametotlen, etc.
infrastructure with an array that gets updated to the index and length
of each portion of the expanded filename. tup_printf() then uses this
array to substitute in for the %g flag.
Added t3069 - allow extra text after a !-macro.

Now you can do '!cc -DFOO' to just add -DFOO for a single !cc macro.
Added t3070 - cache results of tup_db_get_incoming_link().
Cache results of tup_db_get_links for stickies.

Since these can potentially be re-used many times, we can cache the result in the tup_entry. They are updated automatically as stickies are added/removed, except in the case where nodes are removed, since they remove all stickies for that node. In that case we simply invalidate the cache and reload from the db next time they are needed.
Update SQLite 3.7.16.2 -> 3.7.17
tup_db_print - group nodes already have "<>" markers in the name.
Added t6070 - fix for circular group check bug.

For the circular group check, the starting group nodes go directly into the plist (we don't have use the root node and pop it off like for the updater), so these nodes should have the 'expanded' flag set.
Added t4117 - refactoring dependent dirs.

When we build the create graph, we load all directories in create_list, and those that are dependent on them. However, we call tup_db_unflag_create() on all nodes, even if they aren't in the create_list. SQLite wasn't counting these as modifications, but tup was adding them to the expected_changes counter, so the refactor check was failing.
Removed low information error messages, excess stacktraces.
Added Lua stack height assertions.
Added t8080 - make sure we can't include files outside of our variant.

If we have a variant and do "include ../foo.tup", we don't want to be able to grab a foo.tup from the source tree - otherwise, when we switch from a variant build to a normal build, ../foo.tup will no longer mean anything.
Rename t4099 to describe what it is.
Prefix Lua errors from immediate execution failure.
Update lua 5.2.0 -> 5.2.2

Added tup-lua.patch to be applied after copying sources over.
Don't use new default tostring behavior for tables if the table has a metatable.
Minor formatting fixes.
Merge branch 'master' into lua

Conflicts:
	src/tup/parser.c