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.

Makefile 2.7 KiB

il y a 10 ans
il y a 10 ans
il y a 10 ans
il y a 5 ans
il y a 6 ans
il y a 10 ans
il y a 10 ans
il y a 6 ans
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  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. # static compilation needs libgpm development package
  50. ifeq ($(O_STATIC),1)
  51. LDFLAGS += -static
  52. LDLIBS += -lgpm
  53. endif
  54. DISTFILES = src nnn.1 Makefile README.md LICENSE
  55. SRC = src/nnn.c
  56. HEADERS = src/nnn.h
  57. BIN = nnn
  58. all: $(BIN)
  59. $(BIN): $(SRC) $(HEADERS)
  60. $(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LDLIBS)
  61. # targets for backwards compatibility
  62. debug: $(BIN)
  63. norl: $(BIN)
  64. noloc: $(BIN)
  65. install: all
  66. $(INSTALL) -m 0755 -d $(DESTDIR)$(PREFIX)/bin
  67. $(INSTALL) -m 0755 $(BIN) $(DESTDIR)$(PREFIX)/bin
  68. $(INSTALL) -m 0755 -d $(DESTDIR)$(MANPREFIX)/man1
  69. $(INSTALL) -m 0644 $(BIN).1 $(DESTDIR)$(MANPREFIX)/man1
  70. uninstall:
  71. $(RM) $(DESTDIR)$(PREFIX)/bin/$(BIN)
  72. $(RM) $(DESTDIR)$(MANPREFIX)/man1/$(BIN).1
  73. strip: $(BIN)
  74. $(STRIP) $^
  75. dist:
  76. mkdir -p nnn-$(VERSION)
  77. $(CP) -r $(DISTFILES) nnn-$(VERSION)
  78. tar -cf - nnn-$(VERSION) | gzip > nnn-$(VERSION).tar.gz
  79. $(RM) -r nnn-$(VERSION)
  80. sign:
  81. git archive -o nnn-$(VERSION).tar.gz --format tar.gz --prefix=nnn-$(VERSION)/ v$(VERSION)
  82. gpg --detach-sign --yes nnn-$(VERSION).tar.gz
  83. rm -f nnn-$(VERSION).tar.gz
  84. $(eval ID=$(shell curl -s 'https://api.github.com/repos/jarun/nnn/releases/tags/v$(VERSION)' | jq .id))
  85. curl -XPOST 'https://uploads.github.com/repos/jarun/nnn/releases/$(ID)/assets?name=nnn-$(VERSION).tar.gz.sig' \
  86. -H 'Authorization: token $(NNN_SIG_UPLOAD_TOKEN)' -H 'Content-Type: application/pgp-signature' \
  87. --upload-file nnn-$(VERSION).tar.gz.sig
  88. clean:
  89. $(RM) -f $(BIN) nnn-$(VERSION).tar.gz *.sig
  90. skip: ;
  91. .PHONY: all install uninstall strip dist sign clean