Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Makefile: use pkg-config for library detection #4

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)