#!/usr/bin/env python import re import sys import os config = [] for infile in sys.argv[1:]: with open(infile) as f: config.append((os.path.splitext(os.path.basename(infile))[0], f.read())) print ("//generated by " + sys.argv[0] + " DO NOT EDIT\n") print ("#include \"config.h\"\n") print ("const uint32_t num_of_config_templates = " + str(len(config)) + ";\n") print ("config_template_t config_templates[] = {") for index, (file_name, content) in enumerate(config): print ("{") print (".name = \"" + file_name + "\",") print (".config = \"\\") for line in content.splitlines(): print (line + "\\n\\") print ("\"\n},\n") print ("};")