My build of nnn with minor changes
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.
 
 
 
 
 
 

110 lignes
2.6 KiB

  1. VERSION = $(shell grep -m1 VERSION $(SRC) | cut -f 2 -d'"')
  2. PREFIX ?= /usr/local
  3. MANPREFIX ?= $(PREFIX)/share/man
  4. STRIP ?= strip
  5. PKG_CONFIG ?= pkg-config
  6. INSTALL ?= install
  7. CP ?= cp
  8. CFLAGS_OPTIMIZATION ?= -O3
  9. O_DEBUG := 0
  10. O_NORL := 0 # no readline support
  11. O_NOLOC := 0 # no locale support
  12. # convert targets to flags for backwards compatibility
  13. ifneq ($(filter debug,$(MAKECMDGOALS)),)
  14. O_DEBUG := 1
  15. endif
  16. ifneq ($(filter norl,$(MAKECMDGOALS)),)
  17. O_NORL := 1
  18. endif
  19. ifneq ($(filter noloc,$(MAKECMDGOALS)),)
  20. O_NORL := 1
  21. O_NOLOC := 1
  22. endif
  23. ifeq ($(O_DEBUG),1)
  24. CPPFLAGS += -DDBGMODE
  25. CFLAGS += -g
  26. LDLIBS += -lrt
  27. endif
  28. ifeq ($(O_NORL),1)
  29. CPPFLAGS += -DNORL
  30. else
  31. LDLIBS += -lreadline
  32. endif
  33. ifeq ($(O_NOLOC),1)
  34. CPPFLAGS += -DNOLOCALE
  35. endif
  36. ifeq ($(shell $(PKG_CONFIG) ncursesw && echo 1),1)
  37. CFLAGS_CURSES ?= $(shell $(PKG_CONFIG) --cflags ncursesw)
  38. LDLIBS_CURSES ?= $(shell $(PKG_CONFIG) --libs ncursesw)
  39. else ifeq ($(shell $(PKG_CONFIG) ncurses && echo 1),1)
  40. CFLAGS_CURSES ?= $(shell $(PKG_CONFIG) --cflags ncurses)
  41. LDLIBS_CURSES ?= $(shell $(PKG_CONFIG) --libs ncurses)
  42. else
  43. LDLIBS_CURSES ?= -lncurses
  44. endif
  45. CFLAGS += -Wall -Wextra
  46. CFLAGS += $(CFLAGS_OPTIMIZATION)
  47. CFLAGS += $(CFLAGS_CURSES)
  48. LDLIBS += $(LDLIBS_CURSES)
  49. DISTFILES = src nnn.1 Makefile README.md LICENSE
  50. SRC = src/nnn.c
  51. HEADERS = src/nnn.h
  52. BIN = nnn
  53. all: $(BIN)
  54. $(BIN): $(SRC) $(HEADERS)
  55. $(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LDLIBS)
  56. # targets for backwards compatibility
  57. debug: $(BIN)
  58. norl: $(BIN)
  59. noloc: $(BIN)
  60. install: all
  61. $(INSTALL) -m 0755 -d $(DESTDIR)$(PREFIX)/bin
  62. $(INSTALL) -m 0755 $(BIN) $(DESTDIR)$(PREFIX)/bin
  63. $(INSTALL) -m 0755 -d $(DESTDIR)$(MANPREFIX)/man1
  64. $(INSTALL) -m 0644 $(BIN).1 $(DESTDIR)$(MANPREFIX)/man1
  65. uninstall:
  66. $(RM) $(DESTDIR)$(PREFIX)/bin/$(BIN)
  67. $(RM) $(DESTDIR)$(MANPREFIX)/man1/$(BIN).1
  68. strip: $(BIN)
  69. $(STRIP) $^
  70. dist:
  71. mkdir -p nnn-$(VERSION)
  72. $(CP) -r $(DISTFILES) nnn-$(VERSION)
  73. tar -cf - nnn-$(VERSION) | gzip > nnn-$(VERSION).tar.gz
  74. $(RM) -r nnn-$(VERSION)
  75. sign:
  76. git archive -o nnn-$(VERSION).tar.gz --format tar.gz --prefix=nnn-$(VERSION)/ v$(VERSION)
  77. gpg --detach-sign --yes nnn-$(VERSION).tar.gz
  78. rm -f nnn-$(VERSION).tar.gz
  79. $(eval ID=$(shell curl -s 'https://api.github.com/repos/jarun/nnn/releases/tags/v$(VERSION)' | jq .id))
  80. curl -XPOST 'https://uploads.github.com/repos/jarun/nnn/releases/$(ID)/assets?name=nnn-$(VERSION).tar.gz.sig' \
  81. -H 'Authorization: token $(NNN_SIG_UPLOAD_TOKEN)' -H 'Content-Type: application/pgp-signature' \
  82. --upload-file nnn-$(VERSION).tar.gz.sig
  83. clean:
  84. $(RM) -f $(BIN) nnn-$(VERSION).tar.gz *.sig
  85. skip: ;
  86. .PHONY: all install uninstall strip dist sign clean