build: module: Fix bug in dynamic flags

The global dynamic flags weren't passed on to the dependency modules,
contrary to their definition.

This patch splits up the function dealing with those dynamic flags and
by calling these parts of that function from different parts of the
flags building process the global part now trickles down the tree to all
the dependency modules.

Signed-off-by: Bart Kuivenhoven <bemkuivenhoven@gmail.com>