From 2a0f64d3d9f401c9a25abfa5d78cbeff56a092ef Mon Sep 17 00:00:00 2001 From: "S. Gilles" Date: Tue, 5 Feb 2019 23:43:42 -0500 Subject: [PATCH] Makefile: use pkg-config for library detection --- Makefile | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 1174c3a..673651a 100644 --- a/Makefile +++ b/Makefile @@ -2,6 +2,7 @@ PREFIX = . CC = cc CFLAGS = -Wall -O2 -I$(PREFIX)/include LDFLAGS = -L$(PREFIX)/lib +PKG_CONFIG = pkg-config all: fbpdf fbdjvu %.o: %.c doc.h @@ -11,14 +12,14 @@ clean: # pdf support using mupdf fbpdf: fbpdf.o mupdf.o draw.o - $(CC) -o $@ $^ $(LDFLAGS) -lmupdf -lmupdf-third -lmupdf-pkcs7 -lmupdf-threads -lm + $(CC) -o $@ $^ $(LDFLAGS) $(shell $(PKG_CONFIG) --libs mupdf) -lm # djvu support fbdjvu: fbpdf.o djvulibre.o draw.o - $(CXX) -o $@ $^ $(LDFLAGS) -ldjvulibre -ljpeg -lm -lpthread + $(CXX) -o $@ $^ $(LDFLAGS) $(shell $(PKG_CONFIG) --libs ddjvuapi libjpeg) -lm -lpthread # pdf support using poppler poppler.o: poppler.c - $(CXX) -c $(CFLAGS) `pkg-config --cflags poppler-cpp` $< + $(CXX) -c $(CFLAGS) $(shell $(PKG_CONFIG) --cflags poppler-cpp) $< fbpdf2: fbpdf.o poppler.o draw.o - $(CXX) -o $@ $^ $(LDFLAGS) `pkg-config --libs poppler-cpp` + $(CXX) -o $@ $^ $(LDFLAGS) $(shell $(PKG_CONFIG) --libs poppler-cpp)