CFLAGS += $(CFLAGS_OPTIMIZATION)
CFLAGS += $(CFLAGS_CURSES)
-LDLIBS += -lreadline $(LDLIBS_CURSES)
+LDLIBS += $(LDLIBS_CURSES)
DISTFILES = src nnn.1 Makefile README.md LICENSE
SRC = src/nnn.c
$(SRC): src/nnn.h
$(BIN): $(SRC)
- $(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LDLIBS)
+ $(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LDLIBS) -lreadline
debug: $(SRC)
- $(CC) -DDBGMODE -g $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -o $(BIN) $^ $(LDLIBS)
+ $(CC) -DDBGMODE -g $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -o $(BIN) $^ $(LDLIBS) -lreadline
+
+norl: $(SRC)
+ $(CC) -DNORL $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -o $(BIN) $^ $(LDLIBS)
+ $(STRIP) $(BIN)
install: all
$(INSTALL) -m 0755 -d $(DESTDIR)$(PREFIX)/bin
#### Library dependencies
-`nnn` needs a curses library with wide character support (like ncursesw), libreadline and standard libc.
+`nnn` needs a curses library with wide character support (like ncursesw), libreadline and standard libc. It's possible to drop libreadline using the Makefile target `norl`.
#### Utility dependencies
#include <locale.h>
#include <pwd.h>
#include <stdio.h>
+#ifndef NORL
#include <readline/history.h>
#include <readline/readline.h>
+#endif
#include <regex.h>
#include <signal.h>
#include <stdarg.h>
}
break;
default: /* SEL_RUNCMD */
+#ifndef NORL
if (cfg.picker) {
/* readline prompt breaks the interface, use stock */
+#endif
tmp = xreadline(NULL, "> ");
if (tmp[0])
spawn(shell, "-c", tmp, path, F_NORMAL | F_SIGINT);
+#ifndef NORL
} else {
exitcurses();
free(tmp);
}
}
+#endif
}
/* Continue in navigate-as-you-type mode, if enabled */
crc8init();
#endif
+#ifndef NORL
/* Bind TAB to cycling */
rl_variable_bind("completion-ignore-case", "on");
#ifdef __linux__
rl_bind_key('\t', rl_complete);
#endif
read_history(NULL);
+#endif
#ifdef DBGMODE
enabledbg();
browse(ipath);
exitcurses();
+#ifndef NORL
write_history(NULL);
+#endif
if (cfg.pickraw) {
if (copybufpos) {