Skip to content

Commit

Permalink
Add Makefile.generic, update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
jarun committed Apr 13, 2017
1 parent 9702abd commit 372a3a0
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 12 deletions.
2 changes: 2 additions & 0 deletions .travis.yml
Expand Up @@ -16,3 +16,5 @@ script:
- export CFLAGS=-Werror
- make clean
- make
- make clean
- make -f Makefile.generic
43 changes: 43 additions & 0 deletions Makefile.generic
@@ -0,0 +1,43 @@
VERSION = 0.6

PREFIX = /usr/local
MANPREFIX = $(PREFIX)/man

CFLAGS += -O2 -Wall -Wextra -Wno-unused-parameter
LDLIBS = -lcurses

DISTFILES = nnn.c config.def.h nnn.1 Makefile README.md LICENSE
LOCALCONFIG = config.h
SRC = nnn.c
BIN = nnn

all: $(BIN)

$(LOCALCONFIG): config.def.h
cp config.def.h $@

$(SRC): $(LOCALCONFIG)

$(BIN): $(SRC)
$(CC) $(CFLAGS) $(CPPFLAGS) -o $@ $^ $(LDFLAGS) $(LDLIBS)
strip $@

install: all
mkdir -p $(DESTDIR)$(PREFIX)/bin
cp -f $(BIN) $(DESTDIR)$(PREFIX)/bin
mkdir -p $(DESTDIR)$(MANPREFIX)/man1
cp -f $(BIN).1 $(DESTDIR)$(MANPREFIX)/man1

uninstall:
rm -f $(DESTDIR)$(PREFIX)/bin/$(BIN)
rm -f $(DESTDIR)$(MANPREFIX)/man1/$(BIN).1

dist:
mkdir -p nnn-$(VERSION)
cp $(DISTFILES) nnn-$(VERSION)
tar -cf nnn-$(VERSION).tar nnn-$(VERSION)
gzip nnn-$(VERSION).tar
rm -rf nnn-$(VERSION)

clean:
rm -f $(BIN) nnn-$(VERSION).tar.gz
21 changes: 9 additions & 12 deletions README.md
Expand Up @@ -15,8 +15,8 @@ Noice is Not Noice, a noicer fork...
- [Original features](#original-features)
- [nnn toppings](#nnn-toppings)
- [Behaviour and navigation](#behaviour-and-navigation)
- [File associations](#file-associations)
- [Optimizations](#optimizations)
- [File association](#file-association)
- [Optimization](#optimization)
- [Installation](#installation)
- [Usage](#usage)
- [Keyboard shortcuts](#keyboard-shortcuts)
Expand All @@ -30,7 +30,7 @@ Noice is Not Noice, a noicer fork...

nnn is a fork of [noice](http://git.2f30.org/noice/), a blazing-fast lightweight terminal file browser with easy keyboard shortcuts for navigation, opening files and running tasks. noice is developed considering terminal based systems. There is no config file and mime associations are hard-coded. However, the incredible user-friendliness and speed make it a perfect utility on modern distros.

nnn can use the default desktop opener at runtime. It also adds new navigation options, a disk usage analyzer mode, comprehensive file details and much more. For a complete list, see [nnn-toppings](#nnn-toppings).
nnn can use the default desktop opener at runtime. It adds new navigation options, enhanced DE integration, a disk usage analyzer mode, comprehensive file details and much more. For a complete list, see [nnn-toppings](#nnn-toppings).

You can try

Expand Down Expand Up @@ -78,10 +78,7 @@ I chose to fork because:
- Removed navigation restriction with relative paths (and let permissions handle it)
- Sort entries by file size (largest to smallest)
- Shortcut to invoke file name copier (set using environment variable `NNN_COPIER`)
#### File associations
- To open the current directory in a desktop file manager, set `NNN_DE_FILE_MANAGER`. E.g.:

export NNN_DE_FILE_MANAGER=thunar
#### File association
- Set `NNN_OPENER` to let a desktop opener handle it all. E.g.:

export NNN_OPENER=xdg-open
Expand All @@ -97,14 +94,15 @@ I chose to fork because:
- If the executable in static file association is missing
- If a file type was not handled in static file association
- This may be the best option to set your desktop opener to
#### Optimizations
- To enable the desktop file manager key, set `NNN_DE_FILE_MANAGER`. E.g.:

export NNN_DE_FILE_MANAGER=thunar
#### Optimization
- All redundant buffer removal
- All frequently used local chunks now static
- Removed some redundant string allocation and manipulation
- Simplified some roundabout procedures
- `-O3` level optimization, warning fixes
- Added compilation flag `-march=native`
- Remove generated config.h on `make clean`
- Compiler warnings fixed
- strip the final binary

The following top excerpt shows the difference in nnn and ncdu memory usage while listing `/usr/bin` with 1439 entries in disk usage analyzer mode, sorted by total content size:
Expand All @@ -123,7 +121,6 @@ Download the [latest master](https://github.com/jarun/nnn/archive/master.zip) or

$ make
$ sudo make install
No plans of packaging at the time.

### Usage

Expand Down

0 comments on commit 372a3a0

Please sign in to comment.