2021-09-16 10:32:59 +01:00
|
|
|
# nsxiv version
|
2021-09-17 00:25:19 +01:00
|
|
|
VERSION = 27.1
|
2017-09-06 19:12:09 +01:00
|
|
|
|
2021-09-14 15:42:57 +01:00
|
|
|
# PREFIX for install
|
|
|
|
PREFIX ?= /usr/local
|
2021-10-03 17:52:12 +01:00
|
|
|
MANPREFIX ?= $(PREFIX)/share/man
|
|
|
|
EGPREFIX ?= $(PREFIX)/share/doc/nsxiv/examples
|
|
|
|
|
|
|
|
# default value for optional dependencies. 1 = enabled, 0 = disabled
|
|
|
|
OPT_DEP_DEFAULT ?= 1
|
2017-01-26 21:18:32 +00:00
|
|
|
|
2021-10-03 17:52:12 +01:00
|
|
|
# autoreload backend: 1 = inotify, 0 = none
|
|
|
|
HAVE_INOTIFY ?= $(OPT_DEP_DEFAULT)
|
|
|
|
|
|
|
|
# optional dependencies, see README for more info
|
2021-09-19 09:49:56 +01:00
|
|
|
HAVE_LIBFONTS ?= $(OPT_DEP_DEFAULT)
|
2021-10-03 17:52:12 +01:00
|
|
|
HAVE_LIBGIF ?= $(OPT_DEP_DEFAULT)
|
|
|
|
HAVE_LIBEXIF ?= $(OPT_DEP_DEFAULT)
|
|
|
|
HAVE_LIBWEBP ?= $(OPT_DEP_DEFAULT)
|
2017-09-08 14:56:55 +01:00
|
|
|
|
2021-09-14 15:42:57 +01:00
|
|
|
# CFLAGS, any optimization flags goes here
|
|
|
|
CFLAGS ?= -std=c99 -Wall -pedantic
|
|
|
|
|
2021-09-23 03:17:52 +01:00
|
|
|
# icons that will be installed via `make icon`
|
|
|
|
ICONS = 16x16.png 32x32.png 48x48.png 64x64.png 128x128.png
|
|
|
|
|
2021-09-19 09:49:56 +01:00
|
|
|
inc_fonts_0 =
|
|
|
|
inc_fonts_1 = -I/usr/include/freetype2 -I$(PREFIX)/include/freetype2
|
|
|
|
|
2021-09-14 15:42:57 +01:00
|
|
|
CPPFLAGS = -D_XOPEN_SOURCE=700 \
|
|
|
|
-DHAVE_LIBGIF=$(HAVE_LIBGIF) -DHAVE_LIBEXIF=$(HAVE_LIBEXIF) \
|
2021-09-19 09:49:56 +01:00
|
|
|
-DHAVE_LIBWEBP=$(HAVE_LIBWEBP) -DHAVE_LIBFONTS=$(HAVE_LIBFONTS) \
|
|
|
|
$(inc_fonts_$(HAVE_LIBFONTS))
|
2014-10-24 09:50:14 +01:00
|
|
|
|
2021-09-19 09:49:56 +01:00
|
|
|
lib_fonts_0 =
|
|
|
|
lib_fonts_1 = -lXft -lfontconfig
|
2021-10-03 17:52:12 +01:00
|
|
|
lib_exif_0 =
|
|
|
|
lib_exif_1 = -lexif
|
|
|
|
lib_gif_0 =
|
|
|
|
lib_gif_1 = -lgif
|
|
|
|
lib_webp_0 =
|
|
|
|
lib_webp_1 = -lwebpdemux -lwebp
|
|
|
|
autoreload_0 = nop
|
|
|
|
autoreload_1 = inotify
|
|
|
|
# using += because certain *BSD distros may need to add additional flags
|
2021-09-19 09:49:56 +01:00
|
|
|
LDLIBS += -lImlib2 -lX11 \
|
2021-10-03 17:52:12 +01:00
|
|
|
$(lib_exif_$(HAVE_LIBEXIF)) $(lib_gif_$(HAVE_LIBGIF)) \
|
2021-09-19 09:49:56 +01:00
|
|
|
$(lib_webp_$(HAVE_LIBWEBP)) $(lib_fonts_$(HAVE_LIBFONTS))
|
2021-10-03 17:52:12 +01:00
|
|
|
|
|
|
|
OBJS = autoreload_$(autoreload_$(HAVE_INOTIFY)).o commands.o image.o main.o options.o \
|
2017-10-23 09:28:28 +01:00
|
|
|
thumbs.o util.o window.o
|
2017-10-12 09:56:03 +01:00
|
|
|
|
2021-09-25 06:00:21 +01:00
|
|
|
.PHONY: all clean install uninstall install-all install-icon uninstall-icon install-desktop
|
2017-10-12 09:56:03 +01:00
|
|
|
.SUFFIXES:
|
|
|
|
.SUFFIXES: .c .o
|
|
|
|
|
2021-09-16 10:32:59 +01:00
|
|
|
all: nsxiv
|
2021-09-14 15:42:57 +01:00
|
|
|
|
2021-09-16 10:32:59 +01:00
|
|
|
nsxiv: $(OBJS)
|
2017-09-08 15:49:31 +01:00
|
|
|
@echo "LINK $@"
|
2021-09-14 15:42:57 +01:00
|
|
|
$(CC) $(LDFLAGS) -o $@ $^ $(LDLIBS)
|
2017-10-12 09:56:03 +01:00
|
|
|
|
2021-09-14 15:42:57 +01:00
|
|
|
.c.o:
|
|
|
|
@echo "CC $@"
|
|
|
|
$(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $<
|
|
|
|
|
Add ability to bind arbitrary functions.
Before all the predated commands where kept in an array and their
indexes were used in bindings. This meant that users couldn't add their
own functions from the config file. Now key/mouse bindings have been
changed to to store the function ptr (wrapped in a cmd_t struct to also
store the mode) directly instead.
General cleanup done in this commit:
Defined `MODE_ALL` instead of using magic number.
For example, suppose one had bindings like:
{ 0, XK_q, g_quit, None },
{ ShitMask, XK_q, {quit_err}, None }
{ ControlMask, XK_q, {quit_err, .mode=MODE_IMAGE}, None }
The existing binding `q` has been left unchanged and is defined the same
way. However, the new hypothetical binding `Shift-q` can be used to call
the custom function quit_err in any mode (default). `Ctrl-q` on the
other hand will be called only on image mode.
Closes #50
2021-09-18 20:27:12 +01:00
|
|
|
$(OBJS): Makefile nsxiv.h config.h
|
2018-06-09 10:33:30 +01:00
|
|
|
options.o: version.h
|
2017-10-19 12:29:25 +01:00
|
|
|
window.o: icon/data.h
|
2017-10-12 09:56:03 +01:00
|
|
|
|
|
|
|
config.h:
|
|
|
|
@echo "GEN $@"
|
2021-09-14 15:42:57 +01:00
|
|
|
cp config.def.h $@
|
2011-01-17 13:57:59 +00:00
|
|
|
|
2018-06-09 10:33:30 +01:00
|
|
|
version.h: Makefile .git/index
|
|
|
|
@echo "GEN $@"
|
2021-09-14 15:42:57 +01:00
|
|
|
v="$$(git describe 2>/dev/null)"; \
|
|
|
|
echo "#define VERSION \"$${v:-$(VERSION)}\"" >$@
|
2018-06-09 10:33:30 +01:00
|
|
|
|
2021-09-16 22:35:29 +01:00
|
|
|
.git/index:
|
|
|
|
|
2011-01-17 13:57:59 +00:00
|
|
|
clean:
|
2021-10-03 17:52:12 +01:00
|
|
|
rm -f *.o nsxiv version.h
|
2011-09-08 14:41:18 +01:00
|
|
|
|
2021-09-25 06:00:21 +01:00
|
|
|
install-all: install install-desktop install-icon
|
|
|
|
|
|
|
|
install-desktop:
|
2021-09-23 03:17:52 +01:00
|
|
|
@echo "INSTALL nsxiv.desktop"
|
|
|
|
mkdir -p $(DESTDIR)$(PREFIX)/share/applications
|
|
|
|
cp nsxiv.desktop $(DESTDIR)$(PREFIX)/share/applications
|
|
|
|
|
2021-09-25 06:00:21 +01:00
|
|
|
install-icon:
|
2021-09-23 03:17:52 +01:00
|
|
|
@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
|
|
|
|
|
2021-09-25 06:00:21 +01:00
|
|
|
uninstall-icon:
|
2021-09-23 03:17:52 +01:00
|
|
|
@echo "REMOVE icon"
|
|
|
|
for f in $(ICONS); do \
|
|
|
|
dir="$(DESTDIR)$(PREFIX)/share/icons/hicolor/$${f%.png}/apps"; \
|
|
|
|
rm -f "$$dir/nsxiv.png"; \
|
|
|
|
done
|
|
|
|
|
2011-09-08 14:41:18 +01:00
|
|
|
install: all
|
2021-09-16 10:32:59 +01:00
|
|
|
@echo "INSTALL bin/nsxiv"
|
2021-10-03 17:52:12 +01:00
|
|
|
mkdir -p $(DESTDIR)$(PREFIX)/bin
|
|
|
|
cp nsxiv $(DESTDIR)$(PREFIX)/bin/
|
|
|
|
chmod 755 $(DESTDIR)$(PREFIX)/bin/nsxiv
|
2021-09-16 10:32:59 +01:00
|
|
|
@echo "INSTALL nsxiv.1"
|
2013-01-10 18:11:57 +00:00
|
|
|
mkdir -p $(DESTDIR)$(MANPREFIX)/man1
|
2021-10-03 17:52:12 +01:00
|
|
|
sed "s!EGPREFIX!$(EGPREFIX)!g; s!PREFIX!$(PREFIX)!g; s!VERSION!$(VERSION)!g" nsxiv.1 \
|
2021-09-16 10:32:59 +01:00
|
|
|
>$(DESTDIR)$(MANPREFIX)/man1/nsxiv.1
|
|
|
|
chmod 644 $(DESTDIR)$(MANPREFIX)/man1/nsxiv.1
|
|
|
|
@echo "INSTALL share/nsxiv/"
|
2021-10-03 17:52:12 +01:00
|
|
|
mkdir -p $(DESTDIR)$(EGPREFIX)
|
|
|
|
cp examples/* $(DESTDIR)$(EGPREFIX)
|
|
|
|
chmod 755 $(DESTDIR)$(EGPREFIX)/*
|
2011-09-08 14:41:18 +01:00
|
|
|
|
2021-09-25 06:00:21 +01:00
|
|
|
uninstall: uninstall-icon
|
2021-09-16 10:32:59 +01:00
|
|
|
@echo "REMOVE bin/nsxiv"
|
|
|
|
rm -f $(DESTDIR)$(PREFIX)/bin/nsxiv
|
|
|
|
@echo "REMOVE nsxiv.1"
|
|
|
|
rm -f $(DESTDIR)$(MANPREFIX)/man1/nsxiv.1
|
2021-09-23 03:17:52 +01:00
|
|
|
@echo "REMOVE nsxiv.desktop"
|
|
|
|
rm -f $(DESTDIR)$(PREFIX)/share/applications/nsxiv.desktop
|
2021-09-16 10:32:59 +01:00
|
|
|
@echo "REMOVE share/nsxiv/"
|
2021-10-03 17:52:12 +01:00
|
|
|
rm -rf $(DESTDIR)$(EGPREFIX)
|
2017-09-08 15:49:31 +01:00
|
|
|
|