Index: waf_generator.py
===================================================================
--- waf_generator.py	(revision 5ba69495784a29ebc21811aedd37186556b263d0)
+++ waf_generator.py	(revision e9aa9537891a390044d1f283ef190165cfdd16e7)
@@ -205,5 +205,9 @@
 
         self.add('#')
-        self.add('# Generated waf script.')
+        self.add('# RTEMS Project (https://www.rtems.org)')
+        self.add('#')
+        self.add('# Generated waf script. Do not edit, run ./freebsd-to-rtems.py -m')
+        self.add('#')
+        self.add('# To use see README.waf shipped with this file.')
         self.add('#')
         self.add('')
@@ -220,9 +224,22 @@
         self.add('def options(opt):')
         self.add('    rtems.options(opt)')
+        self.add('    opt.add_option("--enable-auto-regen",')
+        self.add('                   action = "store_true",')
+        self.add('                   default = False,')
+        self.add('                   dest = "auto_regen",')
+        self.add('                   help = "Enable auto-regeneration of LEX, RPC and YACC files.")')
+        self.add('    opt.add_option("--enable-warnings",')
+        self.add('                   action = "store_true",')
+        self.add('                   default = False,')
+        self.add('                   dest = "warnings",')
+        self.add('                   help = "Enable all warnings. The default is quiet builds.")')
         self.add('')
         self.add('def configure(conf):')
-        self.add('    conf.find_program("lex", mandatory = True)')
-        self.add('    conf.find_program("rpcgen", mandatory = True)')
-        self.add('    conf.find_program("yacc", mandatory = True)')
+        self.add('    if conf.options.auto_regen:')
+        self.add('        conf.find_program("lex", mandatory = True)')
+        self.add('        conf.find_program("rpcgen", mandatory = True)')
+        self.add('        conf.find_program("yacc", mandatory = True)')
+        self.add('    conf.env.AUTO_REGEN = conf.options.auto_regen')
+        self.add('    conf.env.WARNINGS = conf.options.warnings')
         self.add('    rtems.configure(conf)')
         self.add('    if rtems.check_networking(conf):')
@@ -236,6 +253,10 @@
         for f in builder.common_flags():
             self.add('    common_flags += ["%s"]' % (f))
+        self.add('    if bld.env.WARNINGS:')
+        for f in builder.common_warnings():
+            self.add('        common_flags += ["%s"]' % (f))
+        self.add('    else:')
         for f in builder.common_no_warnings():
-            self.add('    common_flags += ["%s"]' % (f))
+            self.add('        common_flags += ["%s"]' % (f))
         self.add('    cflags = %r + common_flags' % (builder.cflags()))
         self.add('    cxxflags = %r + common_flags' % (builder.cxxflags()))
@@ -263,7 +284,8 @@
             kvmsymbols = data['KVMSymbols']
             self.add('    # KVM Symbols')
-            self.add('    bld(target = "%s",' % (kvmsymbols['files']['all'][0]))
-            self.add('        source = "rtemsbsd/rtems/generate_kvm_symbols",')
-            self.add('        rule = "./${SRC} > ${TGT}")')
+            self.add('    if bld.env.AUTO_REGEN:')
+            self.add('        bld(target = "%s",' % (kvmsymbols['files']['all'][0]))
+            self.add('            source = "rtemsbsd/rtems/generate_kvm_symbols",')
+            self.add('            rule = "./${SRC} > ${TGT}")')
             self.add('    bld.objects(target = "kvmsymbols",')
             self.add('                features = "c",')
@@ -278,7 +300,8 @@
             rpcname = rpcgen['files']['all'][0][:-2]
             self.add('    # RPC Generation')
-            self.add('    bld(target = "%s.h",' % (rpcname))
-            self.add('        source = "%s.x",' % (rpcname))
-            self.add('        rule = "${RPCGEN} -h -o ${TGT} ${SRC}")')
+            self.add('    if bld.env.AUTO_REGEN:')
+            self.add('        bld(target = "%s.h",' % (rpcname))
+            self.add('            source = "%s.x",' % (rpcname))
+            self.add('            rule = "${RPCGEN} -h -o ${TGT} ${SRC}")')
             self.add('')
 
@@ -287,11 +310,12 @@
             rkwname = routekw['files']['all'][0]
             self.add('    # Route keywords')
-            self.add('    rkw_rule = "cat ${SRC} | ' + \
+            self.add('    if bld.env.AUTO_REGEN:')
+            self.add('        rkw_rule = "cat ${SRC} | ' + \
                      'awk \'BEGIN { r = 0 } { if (NF == 1) ' + \
                      'printf \\"#define\\\\tK_%%s\\\\t%%d\\\\n\\\\t{\\\\\\"%%s\\\\\\", K_%%s},\\\\n\\", ' + \
                      'toupper($1), ++r, $1, toupper($1)}\' > ${TGT}"')
-            self.add('    bld(target = "%s.h",' % (rkwname))
-            self.add('        source = "%s",' % (rkwname))
-            self.add('        rule = rkw_rule)')
+            self.add('        bld(target = "%s.h",' % (rkwname))
+            self.add('            source = "%s",' % (rkwname))
+            self.add('            rule = rkw_rule)')
             self.add('')
 
@@ -301,7 +325,8 @@
             for l in lexes:
                 lex = lexes[l]['all']
-                self.add('    bld(target = "%s.c",' % (lex['file'][:-2]))
-                self.add('        source = "%s",' % (lex['file']))
-                self.add('        rule = "${LEX} -P %s -t ${SRC} | ' % (lex['sym']) + \
+                self.add('    if bld.env.AUTO_REGEN:')
+                self.add('        bld(target = "%s.c",' % (lex['file'][:-2]))
+                self.add('            source = "%s",' % (lex['file']))
+                self.add('            rule = "${LEX} -P %s -t ${SRC} | ' % (lex['sym']) + \
                          'sed -e \'/YY_BUF_SIZE/s/16384/1024/\' > ${TGT}")')
                 self.add('    bld.objects(target = "lex_%s",' % (lex['sym']))
@@ -321,7 +346,8 @@
                 yacc_sym = yacc['sym']
                 yacc_header = '%s/%s' % (os.path.dirname(yacc_file), yacc['header'])
-                self.add('    bld(target = "%s.c",' % (yacc_file[:-2]))
-                self.add('        source = "%s",' % (yacc_file))
-                self.add('        rule = "${YACC} -b %s -d -p %s ${SRC} && ' % (yacc_sym, yacc_sym) + \
+                self.add('    if bld.env.AUTO_REGEN:')
+                self.add('        bld(target = "%s.c",' % (yacc_file[:-2]))
+                self.add('            source = "%s",' % (yacc_file))
+                self.add('            rule = "${YACC} -b %s -d -p %s ${SRC} && ' % (yacc_sym, yacc_sym) + \
                          'sed -e \'/YY_BUF_SIZE/s/16384/1024/\' < %s.tab.c > ${TGT} && ' % (yacc_sym) + \
                          'rm -f %s.tab.c && mv %s.tab.h %s")' % (yacc_sym, yacc_sym, yacc_header))
