From c65f6f49039885856ad823dcbe2e8fd3fe2c8210 Mon Sep 17 00:00:00 2001 From: Harry Jeffery Date: Mon, 21 Jan 2019 22:19:16 +0000 Subject: Make backends optional --- Makefile | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) (limited to 'Makefile') 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) -- cgit v1.2.3