From 84dbf939fd413630f5c0dfc195dee1252c9a8451 Mon Sep 17 00:00:00 2001
From: magnum <magnum>
Date: Tue, 8 Nov 2011 21:18:39 +0100
Subject: [PATCH] j7: Fix for make generic vs -mkpc option

---
 src/Makefile  |    8 ++++++--
 src/formats.c |    4 ++++
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/src/Makefile b/src/Makefile
index e2d09fc..a62e130 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -107,8 +107,8 @@ BENCH_OBJS = \
 	DES_bsg.o $(BENCH_DES_BS_OBJS_DEPEND) \
 	$(BENCH_MD5_OBJS_DEPEND) \
 	$(BENCH_BF_OBJS_DEPEND) \
-	bench-t.o best.o common.o config_g.o formats.o math.o memory.o miscnl.o \
-	params.o path.o signals.o tty.o
+	bench-t.o best.o common.o config_g.o formats_g.o math.o memory.o \
+	miscnl.o params.o path.o signals.o tty.o
 
 GENMKVPWD_OBJS = \
 	genmkvpwd.o mkvlib.o memory.o miscnl.o
@@ -1228,6 +1228,10 @@ DES_bsg.o: DES_bs.c
 config_g.o: config.c
 	$(CC) $(CFLAGS) -DBENCH_BUILD config.c -o config_g.o
 
+# This is for the BENCH build (to not depend upon options.o)
+formats_g.o: formats.o
+	$(CC) $(CFLAGS) -DBENCH_BUILD formats.c -o formats_g.o
+
 miscnl.o: misc.c
 	$(CC) $(CFLAGS) $(OPT_NORMAL) -D_JOHN_MISC_NO_LOG misc.c -o miscnl.o
 
diff --git a/src/formats.c b/src/formats.c
index 8cbd9ac..a23b4f9 100644
--- a/src/formats.c
+++ b/src/formats.c
@@ -10,7 +10,9 @@
 
 #include "params.h"
 #include "formats.h"
+#ifndef BENCH_BUILD
 #include "options.h"
+#endif
 
 struct fmt_main *fmt_list = NULL;
 static struct fmt_main **fmt_tail = &fmt_list;
@@ -29,6 +31,7 @@ void fmt_init(struct fmt_main *format)
 		format->methods.init(format);
 		format->private.initialized = 1;
 	}
+#ifndef BENCH_BUILD
 	if (options.mkpc) {
 		if (options.mkpc <= format->params.max_keys_per_crypt)
 			format->params.min_keys_per_crypt =
@@ -39,6 +42,7 @@ void fmt_init(struct fmt_main *format)
 			error();
 		}
 	}
+#endif
 }
 
 char *fmt_self_test(struct fmt_main *format)
-- 
1.7.5.4

