| @@ -17,6 +17,9 @@ AUTORELOAD = inotify |
| 17 | 17 | | # CFLAGS, any optimization flags goes here |
| 18 | 18 | | CFLAGS ?= -std=c99 -Wall -pedantic |
| 19 | 19 | | |
| 20 | + | # icons that will be installed via `make icon` |
| 21 | + | ICONS = 16x16.png 32x32.png 48x48.png 64x64.png 128x128.png |
| 22 | + | |
| 20 | 23 | | ifeq ($(HAVE_LIBEXIF), 1) |
| 21 | 24 | | OPTIONAL_LIBS += -lexif |
| 22 | 25 | | else |
| @@ -37,7 +40,7 @@ LDLIBS = -lImlib2 -lX11 -lXft -lfontconfig $(OPTIONAL_LIBS) |
| 37 | 40 | | OBJS = autoreload_$(AUTORELOAD).o commands.o image.o main.o options.o \ |
| 38 | 41 | | thumbs.o util.o window.o |
| 39 | 42 | | |
| 40 | | − | .PHONY: all clean install uninstall |
| 43 | + | .PHONY: all clean install uninstall icon |
| 41 | 44 | | .SUFFIXES: |
| 42 | 45 | | .SUFFIXES: .c .o |
| 43 | 46 | | |
| @@ -78,6 +81,27 @@ version.h: Makefile .git/index |
| 78 | 81 | | clean: |
| 79 | 82 | | $(RM) *.o nsxiv |
| 80 | 83 | | |
| 84 | + | desktop: |
| 85 | + | @echo "INSTALL nsxiv.desktop" |
| 86 | + | mkdir -p $(DESTDIR)$(PREFIX)/share/applications |
| 87 | + | cp nsxiv.desktop $(DESTDIR)$(PREFIX)/share/applications |
| 88 | + | |
| 89 | + | icon: |
| 90 | + | @echo "INSTALL icon" |
| 91 | + | for f in $(ICONS); do \ |
| 92 | + | dir="$(DESTDIR)$(PREFIX)/share/icons/hicolor/$${f%.png}/apps"; \ |
| 93 | + | mkdir -p "$$dir"; \ |
| 94 | + | cp "icon/$$f" "$$dir/nsxiv.png"; \ |
| 95 | + | chmod 644 "$$dir/nsxiv.png"; \ |
| 96 | + | done |
| 97 | + | |
| 98 | + | icon_cleanup: |
| 99 | + | @echo "REMOVE icon" |
| 100 | + | for f in $(ICONS); do \ |
| 101 | + | dir="$(DESTDIR)$(PREFIX)/share/icons/hicolor/$${f%.png}/apps"; \ |
| 102 | + | rm -f "$$dir/nsxiv.png"; \ |
| 103 | + | done |
| 104 | + | |
| 81 | 105 | | install: all |
| 82 | 106 | | @echo "INSTALL bin/nsxiv" |
| 83 | 107 | | install -Dt $(DESTDIR)$(PREFIX)/bin nsxiv |
| @@ -89,11 +113,13 @@ install: all |
| 89 | 113 | | @echo "INSTALL share/nsxiv/" |
| 90 | 114 | | install -Dt $(DESTDIR)$(DOCPREFIX)/examples examples/* |
| 91 | 115 | | |
| 92 | | − | uninstall: |
| 116 | + | uninstall: icon_cleanup |
| 93 | 117 | | @echo "REMOVE bin/nsxiv" |
| 94 | 118 | | rm -f $(DESTDIR)$(PREFIX)/bin/nsxiv |
| 95 | 119 | | @echo "REMOVE nsxiv.1" |
| 96 | 120 | | rm -f $(DESTDIR)$(MANPREFIX)/man1/nsxiv.1 |
| 121 | + | @echo "REMOVE nsxiv.desktop" |
| 122 | + | rm -f $(DESTDIR)$(PREFIX)/share/applications/nsxiv.desktop |
| 97 | 123 | | @echo "REMOVE share/nsxiv/" |
| 98 | 124 | | rm -rf $(DESTDIR)$(DOCPREFIX) |
| 99 | 125 | | |