Don't print module header if nothing is defined

Modules may decide not to output any build definitions in some cases.
Clean up the ninja file by not adding headers for empty sections.

One particular usecase is my upcoming multi-stage bootstrapping -
bootstrap_go_* will not output any rules in the first stage unless it's
required to build the primary builder.

Change-Id: I6a6b54da7e1702c63bfa736bcf8daf16956f9449
diff --git a/context.go b/context.go
index b077623..4794934 100644
--- a/context.go
+++ b/context.go
@@ -2429,6 +2429,10 @@
 	buf := bytes.NewBuffer(nil)
 
 	for _, module := range modules {
+		if len(module.actionDefs.variables)+len(module.actionDefs.rules)+len(module.actionDefs.buildDefs) == 0 {
+			continue
+		}
+
 		buf.Reset()
 
 		// In order to make the bootstrap build manifest independent of the
@@ -2497,6 +2501,10 @@
 	for _, name := range singletonNames {
 		info := c.singletonInfo[name]
 
+		if len(info.actionDefs.variables)+len(info.actionDefs.rules)+len(info.actionDefs.buildDefs) == 0 {
+			continue
+		}
+
 		// Get the name of the factory function for the module.
 		factory := info.factory
 		factoryFunc := runtime.FuncForPC(reflect.ValueOf(factory).Pointer())