diff --git a/.gitignore b/.gitignore
index 873057c..53c644c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,7 +1,6 @@
-/.deps/
-/Makefile
-/Makefile.in
-
+.deps
+Makefile
+Makefile.in
jzboot
*.o
*.d
diff --git a/Makefile.am b/Makefile.am
index 7aed521..f963eff 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,3 +1 @@
-bin_PROGRAMS = jzboot
-jzboot:
- $(MAKE) -C ./src
\ No newline at end of file
+SUBDIRS = src
\ No newline at end of file
diff --git a/src/Makefile b/src/Makefile
deleted file mode 100644
index e7d34c4..0000000
--- a/src/Makefile
+++ /dev/null
@@ -1,31 +0,0 @@
-READLINE ?= 0
-
-
-ifneq (${READLINE},0)
- LIBS += -lreadline
- CPPFLAGS += -DWITH_READLINE
-endif
-
-CC = gcc
-TARGET = ../jzboot
-SOURCES = debug.c devmgr.c ingenic.c main.c shell_lex.c usbdev.c shell.c shell_builtins.c config.c spl_cmdset.c usbboot_cmdset.c
-CFLAGS = --std=gnu99 -Wall -I../include -O2 $(shell pkg-config libusb-1.0 --cflags)
-LIBS += $(shell pkg-config libusb-1.0 --libs)
-
-OBJECTS = ${SOURCES:.c=.o}
-
-all: ${TARGET}
-
-${TARGET}: ${OBJECTS}
- ${CC} ${LDFLAGS} -o $@ $^ ${LIBS}
-
-clean:
- rm -f ${TARGET} ${OBJECTS} ${SOURCES:.c=.d}
-
-%.o: %.c
- ${CC} ${CPPFLAGS} ${CFLAGS} -o $@ -MD -c $<
-
-%.c: %.l
- flex -o $@ $<
-
--include ${SOURCES:.c=.d}
diff --git a/src/Makefile.am b/src/Makefile.am
new file mode 100644
index 0000000..ac76761
--- /dev/null
+++ b/src/Makefile.am
@@ -0,0 +1,5 @@
+AM_CFLAGS = --std=gnu99 -Wall -I../include
+
+bin_PROGRAMS = jzboot
+jzboot_SOURCES = debug.c devmgr.c ingenic.c main.c shell_lex.c \
+ usbdev.c shell.c shell_builtins.c config.c spl_cmdset.c usbboot_cmdset.c
\ No newline at end of file
diff --git a/src/shell.c b/src/shell.c
index 41b49c5..4520ca3 100644
--- a/src/shell.c
+++ b/src/shell.c
@@ -17,9 +17,10 @@
* along with this program. If not, see .
*/
+#include
#include
#include
-#ifdef WITH_READLINE
+#ifdef HAVE_LIBREADLINE
#include
#include
#endif
@@ -51,7 +52,7 @@ static const struct {
};
shell_context_t *shell_init(void *ingenic) {
-#ifdef WITH_READLINE
+#ifdef HAVE_LIBREADLINE
rl_initialize();
#endif
@@ -303,7 +304,7 @@ int shell_source(shell_context_t *ctx, const char *filename) {
return 0;
}
-#ifdef WITH_READLINE
+#ifdef HAVE_LIBREADLINE
static shell_context_t *completion_context;
static char **completion_matches;
static int completion_matches_count = 0;