Compile out wiki output on request and move wiki stuff into a separate file
This is useful for libflashrom (you don't need wiki output in a coreboot
payload).
Wiki output is now disabled by default. If you want to enable it, run
make CONFIG_PRINT_WIKI=yes
Corresponding to flashrom svn r725.
Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Stefan Reinauer <stepan@coresystems.de>
diff --git a/flashrom.c b/flashrom.c
index fc69f25..ad9f3d2 100644
--- a/flashrom.c
+++ b/flashrom.c
@@ -581,7 +581,9 @@
" -l | --layout <file.layout>: read ROM layout from file\n"
" -i | --image <name>: only flash image name from flash layout\n"
" -L | --list-supported: print supported devices\n"
+#if CONFIG_PRINT_WIKI == 1
" -z | --list-supported-wiki: print supported devices in wiki syntax\n"
+#endif
" -p | --programmer <name>: specify the programmer device");
for (p = 0; p < PROGRAMMER_INVALID; p++) {
@@ -634,10 +636,18 @@
int option_index = 0;
int force = 0;
int read_it = 0, write_it = 0, erase_it = 0, verify_it = 0;
- int dont_verify_it = 0, list_supported = 0, list_supported_wiki = 0;
+ int dont_verify_it = 0, list_supported = 0;
+#if CONFIG_PRINT_WIKI == 1
+ int list_supported_wiki = 0;
+#endif
int operation_specified = 0;
int ret = 0, i;
+#if CONFIG_PRINT_WIKI == 1
+ const char *optstring = "rRwvnVEfc:m:l:i:p:Lzh";
+#else
+ const char *optstring = "rRwvnVEfc:m:l:i:p:Lh";
+#endif
static struct option long_options[] = {
{"read", 0, 0, 'r'},
{"write", 0, 0, 'w'},
@@ -651,7 +661,9 @@
{"layout", 1, 0, 'l'},
{"image", 1, 0, 'i'},
{"list-supported", 0, 0, 'L'},
+#if CONFIG_PRINT_WIKI == 1
{"list-supported-wiki", 0, 0, 'z'},
+#endif
{"programmer", 1, 0, 'p'},
{"help", 0, 0, 'h'},
{"version", 0, 0, 'R'},
@@ -683,7 +695,7 @@
}
setbuf(stdout, NULL);
- while ((opt = getopt_long(argc, argv, "rRwvnVEfc:m:l:i:p:Lzh",
+ while ((opt = getopt_long(argc, argv, optstring,
long_options, &option_index)) != EOF) {
switch (opt) {
case 'r':
@@ -754,9 +766,11 @@
case 'L':
list_supported = 1;
break;
+#if CONFIG_PRINT_WIKI == 1
case 'z':
list_supported_wiki = 1;
break;
+#endif
case 'p':
for (programmer = 0; programmer < PROGRAMMER_INVALID; programmer++) {
name = programmer_table[programmer].name;
@@ -813,10 +827,12 @@
exit(0);
}
+#if CONFIG_PRINT_WIKI == 1
if (list_supported_wiki) {
print_wiki_tables();
exit(0);
}
+#endif
if (read_it && write_it) {
printf("Error: -r and -w are mutually exclusive.\n");