diff options
author | Guilherme Rugai Freire <41879254+GRFreire@users.noreply.github.com> | 2021-09-22 23:17:52 -0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-23 02:17:52 +0000 |
commit | de9a285ff2d1d31e87a70003588595e443c7fabd (patch) | |
tree | 0c68e943e9ca60ba45687e44af999c524d7a7dc0 | |
parent | 9e22f32c07db0b3b2d72fb252872c9f7bc7141e3 (diff) |
Add desktop and icon rules to Makefile, document icon installation (#80)
Co-authored-by: NRK <nrk@disroot.org>
-rw-r--r-- | Makefile | 30 | ||||
-rw-r--r-- | README.md | 14 | ||||
-rw-r--r-- | icon/Makefile | 12 |
3 files changed, 40 insertions, 16 deletions
@@ -17,6 +17,9 @@ AUTORELOAD = inotify # CFLAGS, any optimization flags goes here CFLAGS ?= -std=c99 -Wall -pedantic +# icons that will be installed via `make icon` +ICONS = 16x16.png 32x32.png 48x48.png 64x64.png 128x128.png + ifeq ($(HAVE_LIBEXIF), 1) OPTIONAL_LIBS += -lexif else @@ -37,7 +40,7 @@ LDLIBS = -lImlib2 -lX11 -lXft -lfontconfig $(OPTIONAL_LIBS) OBJS = autoreload_$(AUTORELOAD).o commands.o image.o main.o options.o \ thumbs.o util.o window.o -.PHONY: all clean install uninstall +.PHONY: all clean install uninstall icon .SUFFIXES: .SUFFIXES: .c .o @@ -78,6 +81,27 @@ version.h: Makefile .git/index clean: $(RM) *.o nsxiv +desktop: + @echo "INSTALL nsxiv.desktop" + mkdir -p $(DESTDIR)$(PREFIX)/share/applications + cp nsxiv.desktop $(DESTDIR)$(PREFIX)/share/applications + +icon: + @echo "INSTALL icon" + for f in $(ICONS); do \ + dir="$(DESTDIR)$(PREFIX)/share/icons/hicolor/$${f%.png}/apps"; \ + mkdir -p "$$dir"; \ + cp "icon/$$f" "$$dir/nsxiv.png"; \ + chmod 644 "$$dir/nsxiv.png"; \ + done + +icon_cleanup: + @echo "REMOVE icon" + for f in $(ICONS); do \ + dir="$(DESTDIR)$(PREFIX)/share/icons/hicolor/$${f%.png}/apps"; \ + rm -f "$$dir/nsxiv.png"; \ + done + install: all @echo "INSTALL bin/nsxiv" install -Dt $(DESTDIR)$(PREFIX)/bin nsxiv @@ -89,11 +113,13 @@ install: all @echo "INSTALL share/nsxiv/" install -Dt $(DESTDIR)$(DOCPREFIX)/examples examples/* -uninstall: +uninstall: icon_cleanup @echo "REMOVE bin/nsxiv" rm -f $(DESTDIR)$(PREFIX)/bin/nsxiv @echo "REMOVE nsxiv.1" rm -f $(DESTDIR)$(MANPREFIX)/man1/nsxiv.1 + @echo "REMOVE nsxiv.desktop" + rm -f $(DESTDIR)$(PREFIX)/share/applications/nsxiv.desktop @echo "REMOVE share/nsxiv/" rm -rf $(DESTDIR)$(DOCPREFIX) @@ -79,9 +79,19 @@ Installing nsxiv: # make install -Please note, that this requires root privileges. +Installing desktop entry: + + # make desktop + +Installing icons: + + # make icon + +Please note, that these requires root privileges. By default, nsxiv is installed using the prefix "/usr/local", so the full path -of the executable will be "/usr/local/bin/nsxiv". +of the executable will be "/usr/local/bin/nsxiv", the `.desktop` entry will be +"/usr/local/share/applications/nsxiv.desktop" and the icon path will be +"/usr/local/share/icons/hicolor/{size}/apps/nsxiv.png". You can install nsxiv into a directory of your choice by changing this command to: diff --git a/icon/Makefile b/icon/Makefile deleted file mode 100644 index f660cc5..0000000 --- a/icon/Makefile +++ /dev/null @@ -1,12 +0,0 @@ -PREFIX = /usr/local -ICONS = 16x16.png 32x32.png 48x48.png 64x64.png 128x128.png - -all: - -install: - for f in $(ICONS); do \ - dir="$(DESTDIR)$(PREFIX)/share/icons/hicolor/$${f%.png}/apps"; \ - mkdir -p "$$dir"; \ - cp "$$f" "$$dir/nsxiv.png"; \ - chmod 644 "$$dir/nsxiv.png"; \ - done |