My build of nnn with minor changes
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

64 lines
1.5 KiB

  1. VERSION = 2.1
  2. PREFIX ?= /usr/local
  3. MANPREFIX ?= $(PREFIX)/share/man
  4. STRIP ?= strip
  5. PKG_CONFIG ?= pkg-config
  6. INSTALL ?= install
  7. CFLAGS_OPTIMIZATION ?= -O3
  8. CFLAGS += -Wall -Wextra -Wno-unused-parameter
  9. CFLAGS += $(CFLAGS_OPTIMIZATION)
  10. ifeq ($(shell $(PKG_CONFIG) ncursesw && echo 1),1)
  11. CFLAGS += $(shell $(PKG_CONFIG) --cflags ncursesw)
  12. LDLIBS += $(shell $(PKG_CONFIG) --libs ncursesw)
  13. else ifeq ($(shell $(PKG_CONFIG) ncurses && echo 1),1)
  14. CFLAGS += $(shell $(PKG_CONFIG) --cflags ncurses)
  15. LDLIBS += $(shell $(PKG_CONFIG) --libs ncurses)
  16. else
  17. LDLIBS += -lncurses
  18. endif
  19. DISTFILES = src nnn.1 Makefile README.md LICENSE
  20. SRC = src/nnn.c
  21. BIN = nnn
  22. all: $(BIN)
  23. $(SRC): src/nnn.h
  24. $(BIN): $(SRC)
  25. $(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LDLIBS)
  26. debug: $(SRC)
  27. $(CC) -DDEBUGMODE -g $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -o $(BIN) $^ $(LDLIBS)
  28. install: all
  29. $(INSTALL) -m 0755 -d $(DESTDIR)$(PREFIX)/bin
  30. $(INSTALL) -m 0755 $(BIN) $(DESTDIR)$(PREFIX)/bin
  31. $(INSTALL) -m 0755 -d $(DESTDIR)$(MANPREFIX)/man1
  32. $(INSTALL) -m 0644 $(BIN).1 $(DESTDIR)$(MANPREFIX)/man1
  33. uninstall:
  34. $(RM) $(DESTDIR)$(PREFIX)/bin/$(BIN)
  35. $(RM) $(DESTDIR)$(MANPREFIX)/man1/$(BIN).1
  36. strip: $(BIN)
  37. $(STRIP) $^
  38. dist:
  39. mkdir -p nnn-$(VERSION)
  40. $(CP) -r $(DISTFILES) nnn-$(VERSION)
  41. tar -cf nnn-$(VERSION).tar nnn-$(VERSION)
  42. gzip nnn-$(VERSION).tar
  43. $(RM) -r nnn-$(VERSION)
  44. clean:
  45. $(RM) -f $(BIN) nnn-$(VERSION).tar.gz
  46. skip: ;
  47. .PHONY: $(BIN) $(SRC) all debug install uninstall strip dist clean