aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorGuilherme Rugai Freire <41879254+GRFreire@users.noreply.github.com>2021-09-22 23:17:52 -0300
committerGitHub <noreply@github.com>2021-09-23 02:17:52 +0000
commitde9a285ff2d1d31e87a70003588595e443c7fabd (patch)
tree0c68e943e9ca60ba45687e44af999c524d7a7dc0 /Makefile
parent9e22f32c07db0b3b2d72fb252872c9f7bc7141e3 (diff)
Add desktop and icon rules to Makefile, document icon installation (#80)
Co-authored-by: NRK <nrk@disroot.org>
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile30
1 files changed, 28 insertions, 2 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)