2019-12-29 21:13:09 +03:00
|
|
|
VERSION = $(shell grep -m1 VERSION $(SRC) | cut -f 2 -d'"')
|
2014-11-14 15:20:37 +03:00
|
|
|
|
2017-06-19 19:51:08 +03:00
|
|
|
PREFIX ?= /usr/local
|
2018-01-10 19:32:48 +03:00
|
|
|
MANPREFIX ?= $(PREFIX)/share/man
|
2020-03-31 23:59:21 +03:00
|
|
|
DESKTOPPREFIX ?= $(PREFIX)/share/applications
|
2020-05-01 18:58:07 +03:00
|
|
|
DESKTOPICONPREFIX ?= $(PREFIX)/share/icons/hicolor
|
2018-01-10 19:32:48 +03:00
|
|
|
STRIP ?= strip
|
2018-01-22 16:09:17 +03:00
|
|
|
PKG_CONFIG ?= pkg-config
|
2018-03-14 13:41:30 +03:00
|
|
|
INSTALL ?= install
|
2019-06-26 15:25:31 +03:00
|
|
|
CP ?= cp
|
2014-10-22 15:52:45 +04:00
|
|
|
|
2018-12-16 19:56:41 +03:00
|
|
|
CFLAGS_OPTIMIZATION ?= -O3
|
|
|
|
|
2020-08-13 21:32:54 +03:00
|
|
|
O_DEBUG := 0 # debug binary
|
2019-10-08 17:24:40 +03:00
|
|
|
O_NORL := 0 # no readline support
|
2020-08-13 21:32:54 +03:00
|
|
|
O_PCRE := 0 # link with PCRE library
|
2021-05-24 20:08:08 +03:00
|
|
|
O_NOLC := 0 # no locale support
|
2020-08-13 21:32:54 +03:00
|
|
|
O_NOMOUSE := 0 # no mouse support
|
|
|
|
O_NOBATCH := 0 # no built-in batch renamer
|
|
|
|
O_NOFIFO := 0 # no FIFO previewer support
|
|
|
|
O_CTX8 := 0 # enable 8 contexts
|
2020-09-14 05:59:51 +03:00
|
|
|
O_ICONS := 0 # support icons-in-terminal
|
|
|
|
O_NERD := 0 # support icons-nerdfont
|
2022-05-05 22:52:27 +03:00
|
|
|
O_EMOJI := 0 # support emoji
|
2020-08-21 05:45:45 +03:00
|
|
|
O_QSORT := 0 # use Alexey Tourbin's QSORT implementation
|
|
|
|
O_BENCH := 0 # benchmark mode (stops at first user input)
|
2021-07-29 12:33:19 +03:00
|
|
|
O_NOSSN := 0 # disable session support
|
2020-10-31 18:52:01 +03:00
|
|
|
O_NOUG := 0 # disable user, group name in status bar
|
2021-04-17 10:38:34 +03:00
|
|
|
O_NOX11 := 0 # disable X11 integration
|
2021-08-05 19:45:02 +03:00
|
|
|
O_MATCHFLTR := 0 # allow filters without matches
|
2022-01-23 08:22:33 +03:00
|
|
|
O_NOSORT := 0 # disable sorting entries on dir load
|
2019-10-08 17:24:40 +03:00
|
|
|
|
2021-06-02 07:27:06 +03:00
|
|
|
# User patches
|
2022-07-09 14:42:38 +03:00
|
|
|
O_COLEMAK := 0 # change key bindings to colemak compatible layout
|
2021-06-02 07:27:06 +03:00
|
|
|
O_GITSTATUS := 0 # add git status to detail view
|
|
|
|
O_NAMEFIRST := 0 # print file name first, add uid and guid to detail view
|
2021-09-22 05:13:57 +03:00
|
|
|
O_RESTOREPREVIEW := 0 # add preview pipe to close and restore preview pane
|
2021-06-02 07:27:06 +03:00
|
|
|
|
2024-03-28 20:20:21 +03:00
|
|
|
T_ICONS := 0 # test if multiple icons options are set and fail
|
|
|
|
|
2019-10-08 17:24:40 +03:00
|
|
|
# convert targets to flags for backwards compatibility
|
2019-10-09 18:45:40 +03:00
|
|
|
ifneq ($(filter debug,$(MAKECMDGOALS)),)
|
2019-10-08 17:24:40 +03:00
|
|
|
O_DEBUG := 1
|
|
|
|
endif
|
2019-10-09 18:45:40 +03:00
|
|
|
ifneq ($(filter norl,$(MAKECMDGOALS)),)
|
2019-10-08 17:24:40 +03:00
|
|
|
O_NORL := 1
|
|
|
|
endif
|
2021-05-24 20:08:08 +03:00
|
|
|
ifneq ($(filter nolc,$(MAKECMDGOALS)),)
|
2019-10-08 17:24:40 +03:00
|
|
|
O_NORL := 1
|
2021-05-24 20:08:08 +03:00
|
|
|
O_NOLC := 1
|
2019-10-08 17:24:40 +03:00
|
|
|
endif
|
|
|
|
|
2021-01-13 17:13:07 +03:00
|
|
|
ifeq ($(strip $(O_DEBUG)),1)
|
2021-05-13 21:50:59 +03:00
|
|
|
CPPFLAGS += -DDEBUG
|
2023-05-14 19:13:44 +03:00
|
|
|
CFLAGS += -g3
|
2019-10-08 17:24:40 +03:00
|
|
|
endif
|
|
|
|
|
2021-01-13 17:13:07 +03:00
|
|
|
ifeq ($(strip $(O_NORL)),1)
|
2019-10-08 17:24:40 +03:00
|
|
|
CPPFLAGS += -DNORL
|
2021-01-13 17:13:07 +03:00
|
|
|
else ifeq ($(strip $(O_STATIC)),1)
|
2020-01-25 21:14:28 +03:00
|
|
|
CPPFLAGS += -DNORL
|
2019-10-08 17:24:40 +03:00
|
|
|
else
|
|
|
|
LDLIBS += -lreadline
|
|
|
|
endif
|
|
|
|
|
2021-01-13 17:13:07 +03:00
|
|
|
ifeq ($(strip $(O_PCRE)),1)
|
2020-01-24 20:58:30 +03:00
|
|
|
CPPFLAGS += -DPCRE
|
|
|
|
LDLIBS += -lpcre
|
|
|
|
endif
|
|
|
|
|
2021-05-24 20:08:08 +03:00
|
|
|
ifeq ($(strip $(O_NOLC)),1)
|
2021-05-26 21:17:38 +03:00
|
|
|
ifeq ($(strip $(O_ICONS)),1)
|
|
|
|
$(info *** Ignoring O_NOLC since O_ICONS is set ***)
|
|
|
|
else ifeq ($(strip $(O_NERD)),1)
|
|
|
|
$(info *** Ignoring O_NOLC since O_NERD is set ***)
|
2022-05-05 22:52:27 +03:00
|
|
|
else ifeq ($(strip $(O_EMOJI)),1)
|
|
|
|
$(info *** Ignoring O_NOLC since O_EMOJI is set ***)
|
2021-05-26 21:17:38 +03:00
|
|
|
else
|
|
|
|
CPPFLAGS += -DNOLC
|
|
|
|
endif
|
2019-10-08 17:24:40 +03:00
|
|
|
endif
|
|
|
|
|
2021-01-13 17:13:07 +03:00
|
|
|
ifeq ($(strip $(O_NOMOUSE)),1)
|
2020-02-14 05:51:30 +03:00
|
|
|
CPPFLAGS += -DNOMOUSE
|
|
|
|
endif
|
|
|
|
|
2021-01-13 17:13:07 +03:00
|
|
|
ifeq ($(strip $(O_NOBATCH)),1)
|
2020-03-30 19:39:39 +03:00
|
|
|
CPPFLAGS += -DNOBATCH
|
|
|
|
endif
|
|
|
|
|
2021-01-13 17:13:07 +03:00
|
|
|
ifeq ($(strip $(O_NOFIFO)),1)
|
2020-05-04 07:05:13 +03:00
|
|
|
CPPFLAGS += -DNOFIFO
|
|
|
|
endif
|
|
|
|
|
2021-01-13 17:13:07 +03:00
|
|
|
ifeq ($(strip $(O_CTX8)),1)
|
2020-05-30 04:29:45 +03:00
|
|
|
CPPFLAGS += -DCTX8
|
|
|
|
endif
|
|
|
|
|
2021-01-13 17:13:07 +03:00
|
|
|
ifeq ($(strip $(O_ICONS)),1)
|
2022-07-26 17:56:49 +03:00
|
|
|
ICONS_INCLUDE = icons-generated-icons-in-term.h
|
|
|
|
CPPFLAGS += -DICONS_IN_TERM -DICONS_INCLUDE=\"$(ICONS_INCLUDE)\"
|
2024-03-28 20:20:21 +03:00
|
|
|
ifeq ($(strip $(T_ICONS)),1)
|
|
|
|
$(error Choose only one system for icons (O_ICONS, O_NERD or O_EMOJI))
|
|
|
|
endif
|
|
|
|
T_ICONS := 1
|
2020-08-16 04:00:58 +03:00
|
|
|
endif
|
|
|
|
|
2021-01-13 17:13:07 +03:00
|
|
|
ifeq ($(strip $(O_NERD)),1)
|
2022-07-26 17:56:49 +03:00
|
|
|
ICONS_INCLUDE = icons-generated-nerd.h
|
|
|
|
CPPFLAGS += -DNERD -DICONS_INCLUDE=\"$(ICONS_INCLUDE)\"
|
2024-03-28 20:20:21 +03:00
|
|
|
ifeq ($(strip $(T_ICONS)),1)
|
|
|
|
$(error Choose only one system for icons (O_ICONS, O_NERD or O_EMOJI))
|
|
|
|
endif
|
|
|
|
T_ICONS := 1
|
2020-09-14 05:59:51 +03:00
|
|
|
endif
|
|
|
|
|
2022-05-05 22:52:27 +03:00
|
|
|
ifeq ($(strip $(O_EMOJI)),1)
|
2022-07-26 17:56:49 +03:00
|
|
|
ICONS_INCLUDE = icons-generated-emoji.h
|
|
|
|
CPPFLAGS += -DEMOJI -DICONS_INCLUDE=\"$(ICONS_INCLUDE)\"
|
2024-03-28 20:20:21 +03:00
|
|
|
ifeq ($(strip $(T_ICONS)),1)
|
|
|
|
$(error Choose only one system for icons (O_ICONS, O_NERD or O_EMOJI))
|
|
|
|
endif
|
|
|
|
T_ICONS := 1
|
2022-05-05 22:52:27 +03:00
|
|
|
endif
|
|
|
|
|
2021-01-13 17:13:07 +03:00
|
|
|
ifeq ($(strip $(O_QSORT)),1)
|
2020-08-21 05:45:45 +03:00
|
|
|
CPPFLAGS += -DTOURBIN_QSORT
|
|
|
|
endif
|
|
|
|
|
2021-01-13 17:13:07 +03:00
|
|
|
ifeq ($(strip $(O_BENCH)),1)
|
2020-08-21 05:45:45 +03:00
|
|
|
CPPFLAGS += -DBENCH
|
|
|
|
endif
|
|
|
|
|
2021-01-13 17:13:07 +03:00
|
|
|
ifeq ($(strip $(O_NOSSN)),1)
|
2020-09-20 09:43:00 +03:00
|
|
|
CPPFLAGS += -DNOSSN
|
|
|
|
endif
|
|
|
|
|
2021-01-13 17:13:07 +03:00
|
|
|
ifeq ($(strip $(O_NOUG)),1)
|
2020-10-31 18:52:01 +03:00
|
|
|
CPPFLAGS += -DNOUG
|
|
|
|
endif
|
|
|
|
|
2021-04-17 10:38:34 +03:00
|
|
|
ifeq ($(strip $(O_NOX11)),1)
|
|
|
|
CPPFLAGS += -DNOX11
|
|
|
|
endif
|
|
|
|
|
2021-08-05 19:45:02 +03:00
|
|
|
ifeq ($(strip $(O_MATCHFLTR)),1)
|
|
|
|
CPPFLAGS += -DMATCHFLTR
|
|
|
|
endif
|
|
|
|
|
2022-01-23 08:22:33 +03:00
|
|
|
ifeq ($(strip $(O_NOSORT)),1)
|
|
|
|
CPPFLAGS += -DNOSORT
|
|
|
|
endif
|
|
|
|
|
2018-01-22 16:09:17 +03:00
|
|
|
ifeq ($(shell $(PKG_CONFIG) ncursesw && echo 1),1)
|
2018-12-16 20:01:24 +03:00
|
|
|
CFLAGS_CURSES ?= $(shell $(PKG_CONFIG) --cflags ncursesw)
|
|
|
|
LDLIBS_CURSES ?= $(shell $(PKG_CONFIG) --libs ncursesw)
|
2018-12-16 19:59:20 +03:00
|
|
|
else ifeq ($(shell $(PKG_CONFIG) ncurses && echo 1),1)
|
2018-12-16 20:01:24 +03:00
|
|
|
CFLAGS_CURSES ?= $(shell $(PKG_CONFIG) --cflags ncurses)
|
|
|
|
LDLIBS_CURSES ?= $(shell $(PKG_CONFIG) --libs ncurses)
|
2017-04-16 09:17:50 +03:00
|
|
|
else
|
2018-12-16 20:01:24 +03:00
|
|
|
LDLIBS_CURSES ?= -lncurses
|
2017-04-16 09:17:50 +03:00
|
|
|
endif
|
2014-10-22 15:52:45 +04:00
|
|
|
|
2020-06-22 06:47:59 +03:00
|
|
|
CFLAGS += -std=c11 -Wall -Wextra -Wshadow
|
2018-12-16 20:01:24 +03:00
|
|
|
CFLAGS += $(CFLAGS_OPTIMIZATION)
|
|
|
|
CFLAGS += $(CFLAGS_CURSES)
|
|
|
|
|
2021-05-26 19:26:59 +03:00
|
|
|
LDLIBS += $(LDLIBS_CURSES) -lpthread
|
2018-12-16 20:01:24 +03:00
|
|
|
|
2020-01-23 19:52:07 +03:00
|
|
|
# static compilation needs libgpm development package
|
2021-01-13 17:13:07 +03:00
|
|
|
ifeq ($(strip $(O_STATIC)),1)
|
2020-01-23 19:52:07 +03:00
|
|
|
LDFLAGS += -static
|
|
|
|
LDLIBS += -lgpm
|
|
|
|
endif
|
|
|
|
|
2019-12-29 21:13:09 +03:00
|
|
|
DISTFILES = src nnn.1 Makefile README.md LICENSE
|
2018-11-10 11:09:45 +03:00
|
|
|
SRC = src/nnn.c
|
2019-10-13 00:37:53 +03:00
|
|
|
HEADERS = src/nnn.h
|
2017-03-30 21:25:30 +03:00
|
|
|
BIN = nnn
|
2020-03-31 23:59:21 +03:00
|
|
|
DESKTOPFILE = misc/desktop/nnn.desktop
|
2020-05-01 18:58:07 +03:00
|
|
|
LOGOSVG = misc/logo/logo.svg
|
|
|
|
LOGO64X64 = misc/logo/logo-64x64.png
|
2014-10-07 10:05:30 +04:00
|
|
|
|
2022-07-09 14:42:38 +03:00
|
|
|
COLEMAK = patches/colemak
|
2021-06-02 08:42:01 +03:00
|
|
|
GITSTATUS = patches/gitstatus
|
|
|
|
NAMEFIRST = patches/namefirst
|
2021-09-22 05:13:57 +03:00
|
|
|
RESTOREPREVIEW = patches/restorepreview
|
2021-06-02 07:27:06 +03:00
|
|
|
|
2021-08-22 09:39:30 +03:00
|
|
|
# test if we are on Mac OS X and get X.Y.Z OS version with system binary /usr/bin/sw_vers
|
|
|
|
MACOS_VERSION := $(strip $(shell command -v sw_vers >/dev/null && [ "`sw_vers -productName`" = "Mac OS X" ] && sw_vers -productVersion))
|
|
|
|
# if Mac OS X detected, test if its version is below 10.12.0 relying on "sort -c" returning "disorder" message if the input is not sorted
|
|
|
|
ifneq ($(MACOS_VERSION),)
|
|
|
|
MACOS_BELOW_1012 := $(if $(strip $(shell printf '10.12.0\n%s' "$(MACOS_VERSION)" | sort -ct. -k1,1n -k2,2n -k3,3n 2>&1)),1)
|
|
|
|
endif
|
|
|
|
# if Mac OS X version is below 10.12.0, compile in the replacement clock_gettime and define MACOS_BELOW_1012 so that it's included in nnn.c
|
|
|
|
ifneq ($(MACOS_BELOW_1012),)
|
|
|
|
GETTIME_C = misc/macos-legacy/mach_gettime.c
|
|
|
|
GETTIME_H = misc/macos-legacy/mach_gettime.h
|
|
|
|
SRC += $(GETTIME_C)
|
|
|
|
HEADERS += $(GETTIME_H)
|
|
|
|
CPPFLAGS += -DMACOS_BELOW_1012
|
|
|
|
endif
|
|
|
|
|
2022-04-23 22:54:09 +03:00
|
|
|
ifeq ($(strip $(O_DEBUG)),1)
|
|
|
|
HEADERS += src/dbg.h
|
|
|
|
endif
|
2022-07-20 12:57:05 +03:00
|
|
|
ifeq ($(strip $(O_QSORT)),1)
|
|
|
|
HEADERS += src/qsort.h
|
|
|
|
endif
|
2022-04-23 22:54:09 +03:00
|
|
|
ifeq ($(strip $(O_EMOJI)),1)
|
2022-07-26 17:56:49 +03:00
|
|
|
HEADERS += src/icons.h src/$(ICONS_INCLUDE)
|
2022-04-23 22:54:09 +03:00
|
|
|
endif
|
|
|
|
ifeq ($(strip $(O_NERD)),1)
|
2022-07-26 17:56:49 +03:00
|
|
|
HEADERS += src/icons.h src/$(ICONS_INCLUDE)
|
2022-04-23 22:54:09 +03:00
|
|
|
endif
|
|
|
|
ifeq ($(strip $(O_ICONS)),1)
|
2022-07-26 17:56:49 +03:00
|
|
|
HEADERS += src/icons.h src/$(ICONS_INCLUDE) src/icons-in-terminal.h
|
2022-04-23 22:54:09 +03:00
|
|
|
endif
|
|
|
|
|
2019-05-02 16:53:49 +03:00
|
|
|
all: $(BIN)
|
2014-10-07 10:05:30 +04:00
|
|
|
|
2022-02-03 19:20:55 +03:00
|
|
|
$(BIN): $(SRC) $(HEADERS) Makefile
|
2021-06-02 07:27:06 +03:00
|
|
|
@$(MAKE) --silent prepatch
|
2021-08-22 09:39:30 +03:00
|
|
|
$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ $(GETTIME_C) $< $(LDLIBS)
|
2021-06-02 07:27:06 +03:00
|
|
|
@$(MAKE) --silent postpatch
|
2017-06-19 19:51:08 +03:00
|
|
|
|
2019-10-08 17:24:40 +03:00
|
|
|
# targets for backwards compatibility
|
|
|
|
debug: $(BIN)
|
|
|
|
norl: $(BIN)
|
2021-05-24 20:08:08 +03:00
|
|
|
nolc: $(BIN)
|
2019-10-04 05:13:07 +03:00
|
|
|
|
2022-07-26 17:56:49 +03:00
|
|
|
src/$(ICONS_INCLUDE): src/icons-hash.c src/icons.h src/icons-in-terminal.h
|
2022-11-25 18:38:37 +03:00
|
|
|
$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -DICONS_GENERATE -o src/icons-hash-gen src/icons-hash.c
|
2022-07-26 17:56:49 +03:00
|
|
|
./src/icons-hash-gen > $@
|
|
|
|
|
2020-03-31 23:59:21 +03:00
|
|
|
install-desktop: $(DESKTOPFILE)
|
|
|
|
$(INSTALL) -m 0755 -d $(DESTDIR)$(DESKTOPPREFIX)
|
|
|
|
$(INSTALL) -m 0644 $(DESKTOPFILE) $(DESTDIR)$(DESKTOPPREFIX)
|
2020-05-01 18:58:07 +03:00
|
|
|
$(INSTALL) -m 0755 -d $(DESTDIR)$(DESKTOPICONPREFIX)/scalable/apps
|
|
|
|
$(INSTALL) -m 0644 $(LOGOSVG) $(DESTDIR)$(DESKTOPICONPREFIX)/scalable/apps/nnn.svg
|
|
|
|
$(INSTALL) -m 0755 -d $(DESTDIR)$(DESKTOPICONPREFIX)/64x64/apps
|
|
|
|
$(INSTALL) -m 0644 $(LOGO64X64) $(DESTDIR)$(DESKTOPICONPREFIX)/64x64/apps/nnn.png
|
2020-03-31 23:59:21 +03:00
|
|
|
|
|
|
|
uninstall-desktop:
|
|
|
|
$(RM) $(DESTDIR)$(DESKTOPPREFIX)/$(DESKTOPFILE)
|
2020-05-01 18:58:07 +03:00
|
|
|
$(RM) $(DESTDIR)$(DESKTOPICONPREFIX)/scalable/apps/nnn.svg
|
|
|
|
$(RM) $(DESTDIR)$(DESKTOPICONPREFIX)/64x64/apps/nnn.png
|
2020-03-31 23:59:21 +03:00
|
|
|
|
2014-10-21 19:52:40 +04:00
|
|
|
install: all
|
2018-03-14 13:41:30 +03:00
|
|
|
$(INSTALL) -m 0755 -d $(DESTDIR)$(PREFIX)/bin
|
2018-11-10 09:36:21 +03:00
|
|
|
$(INSTALL) -m 0755 $(BIN) $(DESTDIR)$(PREFIX)/bin
|
2018-03-14 13:41:30 +03:00
|
|
|
$(INSTALL) -m 0755 -d $(DESTDIR)$(MANPREFIX)/man1
|
|
|
|
$(INSTALL) -m 0644 $(BIN).1 $(DESTDIR)$(MANPREFIX)/man1
|
2014-10-21 19:52:40 +04:00
|
|
|
|
|
|
|
uninstall:
|
2018-01-10 19:32:48 +03:00
|
|
|
$(RM) $(DESTDIR)$(PREFIX)/bin/$(BIN)
|
|
|
|
$(RM) $(DESTDIR)$(MANPREFIX)/man1/$(BIN).1
|
|
|
|
|
|
|
|
strip: $(BIN)
|
|
|
|
$(STRIP) $^
|
2014-10-21 19:52:40 +04:00
|
|
|
|
2020-11-01 21:31:28 +03:00
|
|
|
upx: $(BIN)
|
|
|
|
$(STRIP) $^
|
|
|
|
upx -qqq $^
|
|
|
|
|
2020-01-31 00:46:06 +03:00
|
|
|
static:
|
2020-10-20 15:29:39 +03:00
|
|
|
# regular static binary
|
2020-01-31 00:46:06 +03:00
|
|
|
make O_STATIC=1 strip
|
|
|
|
mv $(BIN) $(BIN)-static
|
2020-10-20 15:29:39 +03:00
|
|
|
# static binary with icons-in-terminal support
|
|
|
|
make O_STATIC=1 O_ICONS=1 strip
|
|
|
|
mv $(BIN) $(BIN)-icons-static
|
|
|
|
# static binary with patched nerd font support
|
|
|
|
make O_STATIC=1 O_NERD=1 strip
|
|
|
|
mv $(BIN) $(BIN)-nerd-static
|
2022-05-05 22:52:27 +03:00
|
|
|
# static binary with emoji support
|
|
|
|
make O_STATIC=1 O_EMOJI=1 strip
|
|
|
|
mv $(BIN) $(BIN)-emoji-static
|
2020-01-31 00:46:06 +03:00
|
|
|
|
2021-06-03 02:03:17 +03:00
|
|
|
musl:
|
|
|
|
cp misc/musl/musl-static-ubuntu.sh .
|
|
|
|
./musl-static-ubuntu.sh 1
|
|
|
|
rm ./musl-static-ubuntu.sh
|
|
|
|
|
2022-07-16 20:47:32 +03:00
|
|
|
shellcheck:
|
|
|
|
find ./plugins/ -type f -not -name "*.md" -exec shellcheck {} +
|
|
|
|
|
2014-11-14 15:20:37 +03:00
|
|
|
dist:
|
2017-03-30 21:25:30 +03:00
|
|
|
mkdir -p nnn-$(VERSION)
|
2018-11-10 11:09:45 +03:00
|
|
|
$(CP) -r $(DISTFILES) nnn-$(VERSION)
|
2019-12-29 22:52:21 +03:00
|
|
|
tar -cf - nnn-$(VERSION) | gzip > nnn-$(VERSION).tar.gz
|
2018-01-10 19:32:48 +03:00
|
|
|
$(RM) -r nnn-$(VERSION)
|
2014-11-14 15:20:37 +03:00
|
|
|
|
2019-12-21 02:32:39 +03:00
|
|
|
sign:
|
|
|
|
git archive -o nnn-$(VERSION).tar.gz --format tar.gz --prefix=nnn-$(VERSION)/ v$(VERSION)
|
|
|
|
gpg --detach-sign --yes nnn-$(VERSION).tar.gz
|
|
|
|
rm -f nnn-$(VERSION).tar.gz
|
|
|
|
|
2021-06-03 20:24:12 +03:00
|
|
|
upload-local: sign static musl
|
2019-12-21 02:32:39 +03:00
|
|
|
$(eval ID=$(shell curl -s 'https://api.github.com/repos/jarun/nnn/releases/tags/v$(VERSION)' | jq .id))
|
2020-10-20 15:29:39 +03:00
|
|
|
# upload sign file
|
2019-12-21 02:32:39 +03:00
|
|
|
curl -XPOST 'https://uploads.github.com/repos/jarun/nnn/releases/$(ID)/assets?name=nnn-$(VERSION).tar.gz.sig' \
|
|
|
|
-H 'Authorization: token $(NNN_SIG_UPLOAD_TOKEN)' -H 'Content-Type: application/pgp-signature' \
|
|
|
|
--upload-file nnn-$(VERSION).tar.gz.sig
|
2020-11-14 08:26:18 +03:00
|
|
|
# upx compress all static binaries
|
|
|
|
upx -qqq $(BIN)-static
|
|
|
|
upx -qqq $(BIN)-icons-static
|
|
|
|
upx -qqq $(BIN)-nerd-static
|
2022-05-05 22:52:27 +03:00
|
|
|
upx -qqq $(BIN)-emoji-static
|
2020-10-20 15:29:39 +03:00
|
|
|
# upload static binary
|
2021-06-03 02:03:17 +03:00
|
|
|
tar -zcf $(BIN)-static-$(VERSION).x86_64.tar.gz $(BIN)-static
|
2020-05-26 03:51:01 +03:00
|
|
|
curl -XPOST 'https://uploads.github.com/repos/jarun/nnn/releases/$(ID)/assets?name=$(BIN)-static-$(VERSION).x86_64.tar.gz' \
|
2020-01-31 00:46:06 +03:00
|
|
|
-H 'Authorization: token $(NNN_SIG_UPLOAD_TOKEN)' -H 'Content-Type: application/x-sharedlib' \
|
2020-05-26 03:51:01 +03:00
|
|
|
--upload-file $(BIN)-static-$(VERSION).x86_64.tar.gz
|
2020-10-20 15:29:39 +03:00
|
|
|
# upload icons-in-terminal compiled static binary
|
2021-06-03 02:03:17 +03:00
|
|
|
tar -zcf $(BIN)-icons-static-$(VERSION).x86_64.tar.gz $(BIN)-icons-static
|
2020-10-20 15:29:39 +03:00
|
|
|
curl -XPOST 'https://uploads.github.com/repos/jarun/nnn/releases/$(ID)/assets?name=$(BIN)-icons-static-$(VERSION).x86_64.tar.gz' \
|
|
|
|
-H 'Authorization: token $(NNN_SIG_UPLOAD_TOKEN)' -H 'Content-Type: application/x-sharedlib' \
|
|
|
|
--upload-file $(BIN)-icons-static-$(VERSION).x86_64.tar.gz
|
|
|
|
# upload patched nerd font compiled static binary
|
|
|
|
tar -zcf $(BIN)-nerd-static-$(VERSION).x86_64.tar.gz $(BIN)-nerd-static
|
|
|
|
curl -XPOST 'https://uploads.github.com/repos/jarun/nnn/releases/$(ID)/assets?name=$(BIN)-nerd-static-$(VERSION).x86_64.tar.gz' \
|
|
|
|
-H 'Authorization: token $(NNN_SIG_UPLOAD_TOKEN)' -H 'Content-Type: application/x-sharedlib' \
|
|
|
|
--upload-file $(BIN)-nerd-static-$(VERSION).x86_64.tar.gz
|
2022-05-05 22:52:27 +03:00
|
|
|
# upload emoji compiled static binary
|
2022-07-26 18:37:38 +03:00
|
|
|
tar -zcf $(BIN)-emoji-static-$(VERSION).x86_64.tar.gz $(BIN)-emoji-static
|
2022-05-05 22:52:27 +03:00
|
|
|
curl -XPOST 'https://uploads.github.com/repos/jarun/nnn/releases/$(ID)/assets?name=$(BIN)-emoji-static-$(VERSION).x86_64.tar.gz' \
|
|
|
|
-H 'Authorization: token $(NNN_SIG_UPLOAD_TOKEN)' -H 'Content-Type: application/x-sharedlib' \
|
|
|
|
--upload-file $(BIN)-emoji-static-$(VERSION).x86_64.tar.gz
|
2021-06-03 02:03:17 +03:00
|
|
|
# upload musl static binary
|
|
|
|
tar -zcf $(BIN)-musl-static-$(VERSION).x86_64.tar.gz $(BIN)-musl-static
|
|
|
|
curl -XPOST 'https://uploads.github.com/repos/jarun/nnn/releases/$(ID)/assets?name=$(BIN)-musl-static-$(VERSION).x86_64.tar.gz' \
|
|
|
|
-H 'Authorization: token $(NNN_SIG_UPLOAD_TOKEN)' -H 'Content-Type: application/x-sharedlib' \
|
|
|
|
--upload-file $(BIN)-musl-static-$(VERSION).x86_64.tar.gz
|
2019-12-21 02:32:39 +03:00
|
|
|
|
2014-10-07 10:05:30 +04:00
|
|
|
clean:
|
2022-07-26 17:56:49 +03:00
|
|
|
$(RM) -f $(BIN) nnn-$(VERSION).tar.gz *.sig $(BIN)-static $(BIN)-static-$(VERSION).x86_64.tar.gz $(BIN)-icons-static $(BIN)-icons-static-$(VERSION).x86_64.tar.gz $(BIN)-nerd-static $(BIN)-nerd-static-$(VERSION).x86_64.tar.gz $(BIN)-emoji-static $(BIN)-emoji-static-$(VERSION).x86_64.tar.gz $(BIN)-musl-static $(BIN)-musl-static-$(VERSION).x86_64.tar.gz src/icons-hash-gen src/icons-generated-*.h
|
2018-01-10 19:32:48 +03:00
|
|
|
|
2022-06-29 22:23:32 +03:00
|
|
|
checkpatches:
|
|
|
|
./patches/check-patches.sh
|
|
|
|
|
2021-06-02 07:27:06 +03:00
|
|
|
prepatch:
|
|
|
|
ifeq ($(strip $(O_NAMEFIRST)),1)
|
2022-05-31 12:07:31 +03:00
|
|
|
patch --forward $(PATCH_OPTS) --strip=1 --input=$(NAMEFIRST)/mainline.diff
|
2021-06-02 07:27:06 +03:00
|
|
|
ifeq ($(strip $(O_GITSTATUS)),1)
|
2022-05-31 12:07:31 +03:00
|
|
|
patch --forward $(PATCH_OPTS) --strip=1 --input=$(GITSTATUS)/namefirst.diff
|
2021-06-02 07:27:06 +03:00
|
|
|
endif
|
|
|
|
else ifeq ($(strip $(O_GITSTATUS)),1)
|
2022-05-31 12:07:31 +03:00
|
|
|
patch --forward $(PATCH_OPTS) --strip=1 --input=$(GITSTATUS)/mainline.diff
|
2021-06-02 07:27:06 +03:00
|
|
|
endif
|
2021-09-22 05:13:57 +03:00
|
|
|
ifeq ($(strip $(O_RESTOREPREVIEW)),1)
|
2022-05-31 12:07:31 +03:00
|
|
|
patch --forward $(PATCH_OPTS) --strip=1 --input=$(RESTOREPREVIEW)/mainline.diff
|
2021-09-22 05:13:57 +03:00
|
|
|
endif
|
2022-07-09 14:42:38 +03:00
|
|
|
ifeq ($(strip $(O_COLEMAK)),1)
|
|
|
|
patch --forward $(PATCH_OPTS) --strip=1 --input=$(COLEMAK)/mainline.diff
|
|
|
|
endif
|
2021-06-02 07:27:06 +03:00
|
|
|
|
|
|
|
postpatch:
|
|
|
|
ifeq ($(strip $(O_NAMEFIRST)),1)
|
|
|
|
ifeq ($(strip $(O_GITSTATUS)),1)
|
2022-05-31 12:07:31 +03:00
|
|
|
patch --reverse $(PATCH_OPTS) --strip=1 --input=$(GITSTATUS)/namefirst.diff
|
2021-06-02 07:27:06 +03:00
|
|
|
endif
|
2022-05-31 12:07:31 +03:00
|
|
|
patch --reverse $(PATCH_OPTS) --strip=1 --input=$(NAMEFIRST)/mainline.diff
|
2021-06-02 07:27:06 +03:00
|
|
|
else ifeq ($(strip $(O_GITSTATUS)),1)
|
2022-05-31 12:07:31 +03:00
|
|
|
patch --reverse $(PATCH_OPTS) --strip=1 --input=$(GITSTATUS)/mainline.diff
|
2021-06-02 07:27:06 +03:00
|
|
|
endif
|
2021-09-22 05:13:57 +03:00
|
|
|
ifeq ($(strip $(O_RESTOREPREVIEW)),1)
|
2022-05-31 12:07:31 +03:00
|
|
|
patch --reverse $(PATCH_OPTS) --strip=1 --input=$(RESTOREPREVIEW)/mainline.diff
|
2021-09-22 05:13:57 +03:00
|
|
|
endif
|
2022-07-09 14:42:38 +03:00
|
|
|
ifeq ($(strip $(O_COLEMAK)),1)
|
|
|
|
patch --reverse $(PATCH_OPTS) --strip=1 --input=$(COLEMAK)/mainline.diff
|
|
|
|
endif
|
2021-06-02 07:27:06 +03:00
|
|
|
|
2018-11-03 09:15:36 +03:00
|
|
|
skip: ;
|
|
|
|
|
2020-03-31 23:59:21 +03:00
|
|
|
.PHONY: all install uninstall strip static dist sign upload-local clean install-desktop uninstall-desktop
|