2009-10-10 14:15:09 +00:00
|
|
|
# --- Required interface definitions ---
|
|
|
|
|
2012-06-20 12:38:10 +00:00
|
|
|
# LIBTOOL needs bash
|
|
|
|
SHELL=/bin/bash
|
|
|
|
|
2009-10-10 14:15:09 +00:00
|
|
|
OBJ=o
|
|
|
|
LOBJ=lo
|
|
|
|
|
|
|
|
# Usage: $(call libname,base)
|
|
|
|
define libname
|
|
|
|
lib$(1).la
|
|
|
|
endef
|
|
|
|
|
|
|
|
# Usage: $(call binname,base)
|
|
|
|
define binname
|
|
|
|
$(1)
|
|
|
|
endef
|
|
|
|
|
|
|
|
# --- Private definitions ---
|
|
|
|
|
2012-06-20 16:48:27 +00:00
|
|
|
ifeq ($(HAVE_LD_VERSION_SCRIPT), 1)
|
|
|
|
LD_VERSION_FLAGS=-Wl,--version-script=libqpdf.map
|
|
|
|
else
|
|
|
|
LD_VERSION_FLAGS=
|
|
|
|
endif
|
|
|
|
|
2009-10-10 14:15:09 +00:00
|
|
|
# Usage: $(call libdepflags,$(basename obj))
|
|
|
|
# Usage: $(call fixdeps,$(basename obj))
|
|
|
|
ifeq ($(GENDEPS),1)
|
|
|
|
libdepflags=-MD -MF $(1).tdep -MP
|
|
|
|
fixdeps=sed -e 's/\.o:/.lo:/' < $(1).tdep > $(1).dep
|
|
|
|
|
|
|
|
else
|
|
|
|
libdepflags=
|
|
|
|
fixdeps=
|
|
|
|
endif
|
|
|
|
|
|
|
|
# --- Required rule definitions ---
|
|
|
|
|
2019-01-14 02:29:12 +00:00
|
|
|
# 1 2 3
|
|
|
|
# Usage: $(call compile,src,includes,xflags)
|
2009-10-10 14:15:09 +00:00
|
|
|
define compile
|
2019-01-14 02:29:12 +00:00
|
|
|
$(CXX) $(CXXFLAGS) $(3) \
|
2009-10-10 14:15:09 +00:00
|
|
|
$(call depflags,$(basename $(call src_to_obj,$(1)))) \
|
|
|
|
$(foreach I,$(2),-I$(I)) \
|
2012-06-22 01:20:35 +00:00
|
|
|
$(CPPFLAGS) \
|
2009-10-10 14:15:09 +00:00
|
|
|
-c $(1) -o $(call src_to_obj,$(1))
|
|
|
|
endef
|
|
|
|
|
2020-10-15 20:47:35 +00:00
|
|
|
# 1 2 3
|
|
|
|
# Usage: $(call c_compile,src,includes,xflags)
|
2009-10-10 14:15:09 +00:00
|
|
|
define c_compile
|
2020-10-15 20:47:35 +00:00
|
|
|
$(CC) $(CFLAGS) $(3) \
|
2009-10-10 17:03:52 +00:00
|
|
|
$(call depflags,$(basename $(call c_src_to_obj,$(1)))) \
|
2009-10-10 14:15:09 +00:00
|
|
|
$(foreach I,$(2),-I$(I)) \
|
2012-06-22 01:20:35 +00:00
|
|
|
$(CPPFLAGS) \
|
2009-10-10 14:15:09 +00:00
|
|
|
-c $(1) -o $(call c_src_to_obj,$(1))
|
|
|
|
endef
|
|
|
|
|
|
|
|
# 1 2
|
|
|
|
# Usage: $(call libcompile,src,includes)
|
|
|
|
define libcompile
|
2021-05-28 08:46:18 +00:00
|
|
|
$(LIBTOOL) --quiet --mode=compile --tag=CXX \
|
2012-06-22 01:20:35 +00:00
|
|
|
$(CXX) $(CXXFLAGS) \
|
2009-10-10 14:15:09 +00:00
|
|
|
$(call libdepflags,$(basename $(call src_to_obj,$(1)))) \
|
|
|
|
$(foreach I,$(2),-I$(I)) \
|
2012-06-22 01:20:35 +00:00
|
|
|
$(CPPFLAGS) \
|
2009-10-10 14:15:09 +00:00
|
|
|
-c $(1) -o $(call src_to_obj,$(1)); \
|
|
|
|
$(call fixdeps,$(basename $(call src_to_obj,$(1))))
|
|
|
|
endef
|
|
|
|
|
2009-10-10 17:03:52 +00:00
|
|
|
# 1 2
|
|
|
|
# Usage: $(call libcompile,src,includes)
|
|
|
|
define c_libcompile
|
2021-05-28 08:46:18 +00:00
|
|
|
$(LIBTOOL) --quiet --mode=compile --tag=CC \
|
2013-02-24 20:29:17 +00:00
|
|
|
$(CC) $(CFLAGS) \
|
2009-10-10 17:03:52 +00:00
|
|
|
$(call libdepflags,$(basename $(call c_src_to_obj,$(1)))) \
|
|
|
|
$(foreach I,$(2),-I$(I)) \
|
2012-06-22 01:20:35 +00:00
|
|
|
$(CPPFLAGS) \
|
2009-10-10 17:03:52 +00:00
|
|
|
-c $(1) -o $(call c_src_to_obj,$(1)); \
|
|
|
|
$(call fixdeps,$(basename $(call src_to_obj,$(1))))
|
|
|
|
endef
|
|
|
|
|
2009-10-10 15:28:33 +00:00
|
|
|
# 1 2
|
|
|
|
# Usage: $(call makeslib,objs,library)
|
|
|
|
define makeslib
|
|
|
|
$(RM) $2
|
2009-10-10 15:32:59 +00:00
|
|
|
$(AR) cru $(2) $(1)
|
|
|
|
$(RANLIB) $(2)
|
2009-10-10 15:28:33 +00:00
|
|
|
endef
|
|
|
|
|
2009-10-11 00:24:22 +00:00
|
|
|
# 1 2 3 4 5 6 7
|
|
|
|
# Usage: $(call makelib,objs,library,ldflags,libs,current,revision,age)
|
2009-10-10 14:15:09 +00:00
|
|
|
define makelib
|
2021-05-28 08:46:18 +00:00
|
|
|
$(LIBTOOL) --mode=link --tag=CXX \
|
2012-06-20 16:48:27 +00:00
|
|
|
$(CXX) $(CXXFLAGS) $(LD_VERSION_FLAGS) \
|
2018-02-04 19:01:57 +00:00
|
|
|
-o $(2) $(1) $(3) $(4) \
|
2020-10-20 21:17:46 +00:00
|
|
|
$(RPATH) -version-info $(5):$(6):$(7) -no-undefined
|
2009-10-10 14:15:09 +00:00
|
|
|
endef
|
|
|
|
|
2019-11-09 20:01:15 +00:00
|
|
|
# 1 2 3 4 5
|
|
|
|
# Usage: $(call makebin,objs,binary,ldflags,libs,xlinkflags)
|
2009-10-10 14:15:09 +00:00
|
|
|
define makebin
|
2021-05-28 08:46:18 +00:00
|
|
|
$(LIBTOOL) --mode=link --tag=CXX \
|
|
|
|
$(CXX) $(CXXFLAGS) $(5) $(1) -o $(2) $(3) $(4)
|
2009-10-10 14:15:09 +00:00
|
|
|
endef
|
2009-10-22 15:20:41 +00:00
|
|
|
|
2021-06-03 07:48:03 +00:00
|
|
|
install-libs: build_libqpdf
|
|
|
|
./mkinstalldirs -m 0755 $(DESTDIR)$(libdir)/pkgconfig
|
|
|
|
./mkinstalldirs -m 0755 $(DESTDIR)$(includedir)/qpdf
|
|
|
|
$(LIBTOOL) --mode=install ./install-sh \
|
|
|
|
libqpdf/$(OUTPUT_DIR)/libqpdf.la \
|
|
|
|
$(DESTDIR)$(libdir)/libqpdf.la
|
|
|
|
$(LIBTOOL) --finish $(DESTDIR)$(libdir)
|
|
|
|
./install-sh -m 0644 include/qpdf/*.h $(DESTDIR)$(includedir)/qpdf
|
|
|
|
./install-sh -m 0644 include/qpdf/*.hh $(DESTDIR)$(includedir)/qpdf
|
|
|
|
./install-sh -m 0644 libqpdf.pc $(DESTDIR)$(libdir)/pkgconfig
|
|
|
|
|
2009-10-22 15:20:41 +00:00
|
|
|
# Install target
|
|
|
|
|
2020-10-21 14:07:34 +00:00
|
|
|
# NOTE: If installing any new executables, remember to update the
|
|
|
|
# lambda layer code in build-scripts/build-appimage.
|
2021-06-03 07:48:03 +00:00
|
|
|
install: all install-libs
|
2019-06-22 17:28:27 +00:00
|
|
|
./mkinstalldirs -m 0755 $(DESTDIR)$(bindir)
|
|
|
|
./mkinstalldirs -m 0755 $(DESTDIR)$(docdir)
|
|
|
|
./mkinstalldirs -m 0755 $(DESTDIR)$(mandir)/man1
|
2013-03-07 16:28:06 +00:00
|
|
|
$(LIBTOOL) --mode=install ./install-sh \
|
2009-10-22 15:20:41 +00:00
|
|
|
qpdf/$(OUTPUT_DIR)/qpdf \
|
|
|
|
$(DESTDIR)$(bindir)/qpdf
|
2013-03-07 16:28:06 +00:00
|
|
|
$(LIBTOOL) --mode=install ./install-sh \
|
2009-10-22 15:20:41 +00:00
|
|
|
zlib-flate/$(OUTPUT_DIR)/zlib-flate \
|
|
|
|
$(DESTDIR)$(bindir)/zlib-flate
|
2020-01-03 03:01:10 +00:00
|
|
|
$(LIBTOOL) --mode=install ./install-sh \
|
|
|
|
qpdf/$(OUTPUT_DIR)/fix-qdf \
|
|
|
|
$(DESTDIR)$(bindir)/fix-qdf
|
2019-06-22 17:28:27 +00:00
|
|
|
./install-sh -m 0644 doc/stylesheet.css $(DESTDIR)$(docdir)
|
2017-08-22 20:50:41 +00:00
|
|
|
if [ -f doc/qpdf-manual.html ]; then \
|
2019-06-22 17:28:27 +00:00
|
|
|
./install-sh -m 0644 doc/qpdf-manual.html $(DESTDIR)$(docdir); \
|
2016-09-10 18:30:07 +00:00
|
|
|
fi
|
2017-08-22 20:50:41 +00:00
|
|
|
if [ -f doc/qpdf-manual.pdf ]; then \
|
2019-06-22 17:28:27 +00:00
|
|
|
./install-sh -m 0644 doc/qpdf-manual.pdf $(DESTDIR)$(docdir); \
|
2016-09-10 18:30:07 +00:00
|
|
|
fi
|
2019-06-22 17:28:27 +00:00
|
|
|
./install-sh -m 0644 doc/*.1 $(DESTDIR)$(mandir)/man1
|