aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile30
-rw-r--r--README.md14
-rw-r--r--icon/Makefile12
3 files changed, 40 insertions, 16 deletions
diff --git a/Makefile b/Makefile
index 68068e1..3b4ba0a 100644
--- a/Makefile
+++ b/Makefile
@@ -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)
diff --git a/README.md b/README.md
index 69e4632..9a1410e 100644
--- a/README.md
+++ b/README.md
@@ -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