cli: make the cli app be conditionally compiled to be interactive

This commit is contained in:
Robert Ghilduta 2013-06-08 02:12:37 -07:00
commit b49d9fe7d2
3 changed files with 12 additions and 2 deletions

View file

@ -3,12 +3,18 @@ OBJ := $(SRC:.c=.o)
BIN_DIR ?= .
FLAGS ?= $(CFLAGS)
ifdef INTERACTIVE
FLAGS += -ltecla -DINTERACTIVE
endif
TARGET = $(BIN_DIR)/bladeRF
all: $(TARGET)
$(TARGET): $(OBJ)
$(CC) $^ $(LDFLAGS) -ltecla -o $(TARGET)
$(CC) $^ $(LDFLAGS) $(FLAGS) -o $(TARGET)
clean:
rm -f bladeRF

View file

@ -8,7 +8,9 @@
#include <getopt.h>
#include <stdbool.h>
#include <libbladeRF.h>
#ifdef INTERACTIVE
#include <libtecla.h>
#endif
#include "version.h"
@ -164,6 +166,7 @@ int cmd_probe()
#endif
static inline int interactive()
{
#ifdef INTERACTIVE
char *line;
bool quit = false;
GetLine *gl = new_GetLine(CLI_MAX_LINE_LEN, CLI_MAX_HIST_LEN);
@ -182,6 +185,7 @@ static inline int interactive()
}
del_GetLine(gl);
#endif
return 0;
}