2021-09-14 16:42:57 +02:00
|
|
|
# Include configure options
|
|
|
|
ifneq (clean,$(filter clean,$(MAKECMDGOALS)))
|
|
|
|
-include config.mk
|
|
|
|
endif
|
2012-05-13 21:39:36 +02:00
|
|
|
|
2021-09-16 11:32:59 +02:00
|
|
|
# nsxiv version
|
2021-09-17 01:25:19 +02:00
|
|
|
VERSION = 27.1
|
2017-09-06 20:12:09 +02:00
|
|
|
|
2021-09-14 16:42:57 +02:00
|
|
|
# PREFIX for install
|
|
|
|
PREFIX ?= /usr/local
|
2017-10-12 10:56:03 +02:00
|
|
|
MANPREFIX = $(PREFIX)/share/man
|
2021-09-22 20:36:55 +02:00
|
|
|
DOCPREFIX = $(PREFIX)/share/doc/nsxiv
|
2017-01-26 22:18:32 +01:00
|
|
|
|
2017-10-12 10:56:03 +02:00
|
|
|
# autoreload backend: inotify/nop
|
|
|
|
AUTORELOAD = inotify
|
2017-09-08 15:56:55 +02:00
|
|
|
|
2021-09-14 16:42:57 +02:00
|
|
|
# CFLAGS, any optimization flags goes here
|
|
|
|
CFLAGS ?= -std=c99 -Wall -pedantic
|
|
|
|
|
2021-09-23 04:17:52 +02:00
|
|
|
# icons that will be installed via `make icon`
|
|
|
|
ICONS = 16x16.png 32x32.png 48x48.png 64x64.png 128x128.png
|
|
|
|
|
2021-09-14 16:42:57 +02:00
|
|
|
ifeq ($(HAVE_LIBEXIF), 1)
|
|
|
|
OPTIONAL_LIBS += -lexif
|
|
|
|
else
|
|
|
|
HAVE_LIBEXIF = 0
|
|
|
|
endif
|
|
|
|
ifeq ($(HAVE_LIBGIF), 1)
|
|
|
|
OPTIONAL_LIBS += -lgif
|
|
|
|
else
|
|
|
|
HAVE_LIBGIF = 0
|
|
|
|
endif
|
2021-09-24 13:20:55 +02:00
|
|
|
ifeq ($(HAVE_LIBWEBP), 1)
|
|
|
|
OPTIONAL_LIBS += -lwebpdemux -lwebp
|
|
|
|
else
|
|
|
|
HAVE_LIBWEBP = 0
|
|
|
|
endif
|
2021-09-14 16:42:57 +02:00
|
|
|
|
|
|
|
CPPFLAGS = -D_XOPEN_SOURCE=700 \
|
|
|
|
-DHAVE_LIBGIF=$(HAVE_LIBGIF) -DHAVE_LIBEXIF=$(HAVE_LIBEXIF) \
|
2021-09-24 13:20:55 +02:00
|
|
|
-DHAVE_LIBWEBP=$(HAVE_LIBWEBP) \
|
2019-02-16 12:47:53 +01:00
|
|
|
-I/usr/include/freetype2 -I$(PREFIX)/include/freetype2
|
2014-10-24 10:50:14 +02:00
|
|
|
|
2021-09-14 16:42:57 +02:00
|
|
|
LDLIBS = -lImlib2 -lX11 -lXft -lfontconfig $(OPTIONAL_LIBS)
|
2011-09-08 15:41:18 +02:00
|
|
|
|
2021-09-14 16:42:57 +02:00
|
|
|
OBJS = autoreload_$(AUTORELOAD).o commands.o image.o main.o options.o \
|
2017-10-23 10:28:28 +02:00
|
|
|
thumbs.o util.o window.o
|
2017-10-12 10:56:03 +02:00
|
|
|
|
2021-09-23 04:17:52 +02:00
|
|
|
.PHONY: all clean install uninstall icon
|
2017-10-12 10:56:03 +02:00
|
|
|
.SUFFIXES:
|
|
|
|
.SUFFIXES: .c .o
|
|
|
|
|
2021-09-16 11:32:59 +02:00
|
|
|
all: nsxiv
|
2021-09-14 16:42:57 +02:00
|
|
|
|
2021-09-16 11:32:59 +02:00
|
|
|
nsxiv: $(OBJS)
|
2017-09-08 16:49:31 +02:00
|
|
|
@echo "LINK $@"
|
2021-09-14 16:42:57 +02:00
|
|
|
$(CC) $(LDFLAGS) -o $@ $^ $(LDLIBS)
|
2017-10-12 10:56:03 +02:00
|
|
|
|
2021-09-14 16:42:57 +02:00
|
|
|
.c.o:
|
|
|
|
@echo "CC $@"
|
|
|
|
$(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $<
|
|
|
|
|
2021-09-16 11:32:59 +02:00
|
|
|
$(OBJS): Makefile nsxiv.h commands.lst config.h config.mk
|
2018-06-09 11:33:30 +02:00
|
|
|
options.o: version.h
|
2017-10-19 13:29:25 +02:00
|
|
|
window.o: icon/data.h
|
2017-10-12 10:56:03 +02:00
|
|
|
|
2021-09-14 16:42:57 +02:00
|
|
|
config.mk:
|
|
|
|
@echo "GEN $@"
|
|
|
|
@echo "# 0 = disable, 1 = enable" > config.mk
|
2021-09-24 13:20:55 +02:00
|
|
|
@for lib in exif gif webp; do \
|
2021-09-14 16:42:57 +02:00
|
|
|
if echo "int main(){}" | $(CC) "-l$$lib" -o /dev/null -x c - 2>/dev/null ; then \
|
|
|
|
echo "HAVE_LIB$$lib=1" | tr '[:lower:]' '[:upper:]' >> config.mk ; \
|
|
|
|
fi \
|
|
|
|
done
|
2017-10-12 10:56:03 +02:00
|
|
|
|
|
|
|
config.h:
|
|
|
|
@echo "GEN $@"
|
2021-09-14 16:42:57 +02:00
|
|
|
cp config.def.h $@
|
2011-01-17 14:57:59 +01:00
|
|
|
|
2018-06-09 11:33:30 +02:00
|
|
|
version.h: Makefile .git/index
|
|
|
|
@echo "GEN $@"
|
2021-09-14 16:42:57 +02:00
|
|
|
v="$$(git describe 2>/dev/null)"; \
|
|
|
|
echo "#define VERSION \"$${v:-$(VERSION)}\"" >$@
|
2018-06-09 11:33:30 +02:00
|
|
|
|
2021-09-16 23:35:29 +02:00
|
|
|
.git/index:
|
|
|
|
|
2011-01-17 14:57:59 +01:00
|
|
|
clean:
|
2021-09-16 11:32:59 +02:00
|
|
|
$(RM) *.o nsxiv
|
2011-09-08 15:41:18 +02:00
|
|
|
|
2021-09-23 04:17:52 +02:00
|
|
|
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
|
|
|
|
|
2011-09-08 15:41:18 +02:00
|
|
|
install: all
|
2021-09-16 11:32:59 +02:00
|
|
|
@echo "INSTALL bin/nsxiv"
|
|
|
|
install -Dt $(DESTDIR)$(PREFIX)/bin nsxiv
|
|
|
|
@echo "INSTALL nsxiv.1"
|
2013-01-10 19:11:57 +01:00
|
|
|
mkdir -p $(DESTDIR)$(MANPREFIX)/man1
|
2021-09-22 20:36:55 +02:00
|
|
|
sed "s!DOCPREFIX!$(DOCPREFIX)!g; s!PREFIX!$(PREFIX)!g; s!VERSION!$(VERSION)!g" nsxiv.1 \
|
2021-09-16 11:32:59 +02:00
|
|
|
>$(DESTDIR)$(MANPREFIX)/man1/nsxiv.1
|
|
|
|
chmod 644 $(DESTDIR)$(MANPREFIX)/man1/nsxiv.1
|
|
|
|
@echo "INSTALL share/nsxiv/"
|
2021-09-22 20:36:55 +02:00
|
|
|
install -Dt $(DESTDIR)$(DOCPREFIX)/examples examples/*
|
2011-09-08 15:41:18 +02:00
|
|
|
|
2021-09-23 04:17:52 +02:00
|
|
|
uninstall: icon_cleanup
|
2021-09-16 11:32:59 +02: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 04:17:52 +02:00
|
|
|
@echo "REMOVE nsxiv.desktop"
|
|
|
|
rm -f $(DESTDIR)$(PREFIX)/share/applications/nsxiv.desktop
|
2021-09-16 11:32:59 +02:00
|
|
|
@echo "REMOVE share/nsxiv/"
|
2021-09-22 20:36:55 +02:00
|
|
|
rm -rf $(DESTDIR)$(DOCPREFIX)
|
2017-09-08 16:49:31 +02:00
|
|
|
|