aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorHarry Jeffery <harry@exec64.co.uk>2019-01-21 22:19:16 +0000
committerHarry Jeffery <harry@exec64.co.uk>2019-01-29 22:26:22 +0000
commitc65f6f49039885856ad823dcbe2e8fd3fe2c8210 (patch)
treec86c2b02645031cdb4baa8e5d435a72871561934 /Makefile
parent269fb9bca7bef679935001e30dcf60031253bbf9 (diff)
downloadimv-c65f6f49039885856ad823dcbe2e8fd3fe2c8210.tar.gz
Make backends optional
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile21
1 files changed, 18 insertions, 3 deletions
diff --git a/Makefile b/Makefile
index ca41af0..9e16cfd 100644
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,7 @@
.PHONY: imv clean check install uninstall doc
+include config.mk
+
PREFIX ?= /usr
BINPREFIX ?= $(PREFIX)/bin
MANPREFIX ?= $(PREFIX)/share/man
@@ -8,11 +10,8 @@ CONFIGPREFIX ?= /etc
CFLAGS ?= -W -Wall -pedantic -Wmissing-prototypes
CFLAGS += -std=c99
-CFLAGS += $(shell pkg-config --cflags librsvg-2.0)
CPPFLAGS += $(shell sdl2-config --cflags) -D_XOPEN_SOURCE=700
LIBS := $(shell sdl2-config --libs)
-LIBS += -lfreeimage -lpng
-LIBS += $(shell pkg-config --libs librsvg-2.0)
LIBS += -lSDL2_ttf -lfontconfig -lpthread
BUILDDIR ?= build
@@ -28,6 +27,22 @@ VERSION != git describe --dirty --always --tags 2> /dev/null || echo v3.0.0
CFLAGS += -DIMV_VERSION=\""$(VERSION)"\"
+# Add backends to build as configured
+ifeq ($(BACKEND_FREEIMAGE),yes)
+ CFLAGS += -DIMV_BACKEND_FREEIMAGE
+ LIBS += -lfreeimage
+endif
+
+ifeq ($(BACKEND_LIBPNG),yes)
+ CFLAGS += -DIMV_BACKEND_LIBPNG
+ LIBS += -lpng
+endif
+
+ifeq ($(BACKEND_LIBRSVG),yes)
+ CFLAGS += -DIMV_BACKEND_LIBRSVG $(shell pkg-config --cflags librsvg-2.0)
+ LIBS += $(shell pkg-config --libs librsvg-2.0)
+endif
+
imv: $(TARGET)
$(TARGET): $(OBJECTS)