2021-09-14 15:42:57 +01:00
|
|
|
# Include configure options
|
|
|
|
ifneq (clean,$(filter clean,$(MAKECMDGOALS)))
|
|
|
|
-include config.mk
|
|
|
|
endif
|
2012-05-13 20:39:36 +01:00
|
|
|
|
2021-09-16 10:32:59 +01:00
|
|
|
# nsxiv version
|
|
|
|
VERSION = 27
|
2017-09-06 19:12:09 +01:00
|
|
|
|
2021-09-14 15:42:57 +01:00
|
|
|
# PREFIX for install
|
|
|
|
PREFIX ?= /usr/local
|
2017-10-12 09:56:03 +01:00
|
|
|
MANPREFIX = $(PREFIX)/share/man
|
2017-01-26 21:18:32 +00:00
|
|
|
|
2017-10-12 09:56:03 +01:00
|
|
|
# autoreload backend: inotify/nop
|
|
|
|
AUTORELOAD = inotify
|
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
|
|
|
|
|
|
|
|
ifeq ($(HAVE_LIBEXIF), 1)
|
|
|
|
OPTIONAL_LIBS += -lexif
|
|
|
|
else
|
|
|
|
HAVE_LIBEXIF = 0
|
|
|
|
endif
|
|
|
|
ifeq ($(HAVE_LIBGIF), 1)
|
|
|
|
OPTIONAL_LIBS += -lgif
|
|
|
|
else
|
|
|
|
HAVE_LIBGIF = 0
|
|
|
|
endif
|
|
|
|
|
|
|
|
CPPFLAGS = -D_XOPEN_SOURCE=700 \
|
|
|
|
-DHAVE_LIBGIF=$(HAVE_LIBGIF) -DHAVE_LIBEXIF=$(HAVE_LIBEXIF) \
|
2019-02-16 11:47:53 +00:00
|
|
|
-I/usr/include/freetype2 -I$(PREFIX)/include/freetype2
|
2014-10-24 09:50:14 +01:00
|
|
|
|
2021-09-14 15:42:57 +01:00
|
|
|
LDLIBS = -lImlib2 -lX11 -lXft -lfontconfig $(OPTIONAL_LIBS)
|
2011-09-08 14:41:18 +01:00
|
|
|
|
2021-09-14 15:42:57 +01:00
|
|
|
OBJS = autoreload_$(AUTORELOAD).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
|
|
|
|
|
|
|
.PHONY: all clean install uninstall
|
|
|
|
.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 $@ $<
|
|
|
|
|
2021-09-16 10:32:59 +01:00
|
|
|
$(OBJS): Makefile nsxiv.h commands.lst config.h config.mk
|
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
|
|
|
|
2021-09-14 15:42:57 +01:00
|
|
|
config.mk:
|
|
|
|
@echo "GEN $@"
|
|
|
|
@echo "# 0 = disable, 1 = enable" > config.mk
|
|
|
|
@for lib in exif gif; do \
|
|
|
|
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 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-09-16 10:32:59 +01:00
|
|
|
$(RM) *.o nsxiv
|
2011-09-08 14:41:18 +01:00
|
|
|
|
|
|
|
install: all
|
2021-09-16 10:32:59 +01:00
|
|
|
@echo "INSTALL bin/nsxiv"
|
|
|
|
install -Dt $(DESTDIR)$(PREFIX)/bin nsxiv
|
|
|
|
@echo "INSTALL nsxiv.1"
|
2013-01-10 18:11:57 +00:00
|
|
|
mkdir -p $(DESTDIR)$(MANPREFIX)/man1
|
2021-09-16 10:32:59 +01:00
|
|
|
sed "s!PREFIX!$(PREFIX)!g; s!VERSION!$(VERSION)!g" nsxiv.1 \
|
|
|
|
>$(DESTDIR)$(MANPREFIX)/man1/nsxiv.1
|
|
|
|
chmod 644 $(DESTDIR)$(MANPREFIX)/man1/nsxiv.1
|
|
|
|
@echo "INSTALL share/nsxiv/"
|
|
|
|
install -Dt $(DESTDIR)$(PREFIX)/share/nsxiv/exec exec/*
|
2011-09-08 14:41:18 +01:00
|
|
|
|
|
|
|
uninstall:
|
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
|
|
|
|
@echo "REMOVE share/nsxiv/"
|
|
|
|
rm -rf $(DESTDIR)$(PREFIX)/share/nsxiv
|
2017-09-08 15:49:31 +01:00
|
|
|
|