[2/2] batctl: make bisect_* a compile time option
Commit Message
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
---
Makefile | 16 +++++++++++++---
main.c | 4 ++++
2 files changed, 17 insertions(+), 3 deletions(-)
Comments
On Saturday 25 August 2012 01:39:17 Marek Lindner wrote:
> # standard build tools
> +ifeq ($(CONFIG_BATCTL_BISECT),y)
> +OBJ += $(OBJ_BISECT)
> +CFLAGS += -DBATCTL_BISECT
> +endif
-D is a preprocessor thing. So please move it to CPPFLAGS
Kind regards,
Sven
@@ -18,9 +18,14 @@
# 02110-1301, USA
#
+# changing the CONFIG_* line to 'y' enables the related feature
+# batctl advanced debugging tool bisect:
+export CONFIG_BATCTL_BISECT=n
+
# batctl build
BINARY_NAME = batctl
-OBJ = main.o bat-hosts.o functions.o sys.o debug.o ping.o traceroute.o tcpdump.o list-batman.o hash.o vis.o debugfs.o bisect_iv.o ioctl.o
+OBJ = main.o bat-hosts.o functions.o sys.o debug.o ping.o traceroute.o tcpdump.o hash.o vis.o debugfs.o ioctl.o list-batman.o
+OBJ_BISECT = bisect_iv.o
MANPAGE = man/batctl.8
# batctl flags and options
@@ -38,6 +43,11 @@ endif
endif
# standard build tools
+ifeq ($(CONFIG_BATCTL_BISECT),y)
+OBJ += $(OBJ_BISECT)
+CFLAGS += -DBATCTL_BISECT
+endif
+
CC ?= gcc
RM ?= rm -f
INSTALL ?= install
@@ -70,7 +80,7 @@ $(BINARY_NAME): $(OBJ)
$(LINK.o) $^ $(LDLIBS) -o $@
clean:
- $(RM) $(BINARY_NAME) $(OBJ) $(DEP)
+ $(RM) $(BINARY_NAME) $(OBJ) $(OBJ_BISECT) $(DEP)
install: $(BINARY_NAME)
$(MKDIR) $(DESTDIR)$(SBINDIR)
@@ -79,7 +89,7 @@ install: $(BINARY_NAME)
$(INSTALL) -m 0644 $(MANPAGE) $(DESTDIR)$(MANDIR)/man8
# load dependencies
-DEP = $(OBJ:.o=.d)
+DEP = $(OBJ:.o=.d) $(OBJ_BISECT:.o=.d)
-include $(DEP)
.PHONY: all clean install
@@ -85,7 +85,9 @@ void print_usage(void)
printf(" \tping|p <destination> \tping another batman adv host via layer 2\n");
printf(" \ttraceroute|tr <destination> \ttraceroute another batman adv host via layer 2\n");
printf(" \ttcpdump|td <interface> \ttcpdump layer 2 traffic on the given interface\n");
+#ifdef BATCTL_BISECT
printf(" \tbisect_iv <file1> .. <fileN>\tanalyze given batman iv log files for routing stability\n");
+#endif
}
int main(int argc, char **argv)
@@ -172,9 +174,11 @@ int main(int argc, char **argv)
ret = ioctl_statistics_get(mesh_iface);
+#ifdef BATCTL_BISECT
} else if ((strcmp(argv[1], "bisect_iv") == 0)) {
ret = bisect_iv(argc - 1, argv + 1);
+#endif
} else {