2009-10-10 14:15:09 +00:00
|
|
|
# --- Required interface definitions ---
|
|
|
|
|
|
|
|
OBJ=o
|
|
|
|
LOBJ=lo
|
|
|
|
|
|
|
|
# Usage: $(call libname,base)
|
|
|
|
define libname
|
|
|
|
lib$(1).la
|
|
|
|
endef
|
|
|
|
|
|
|
|
# Usage: $(call binname,base)
|
|
|
|
define binname
|
|
|
|
$(1)
|
|
|
|
endef
|
|
|
|
|
|
|
|
# --- Private definitions ---
|
|
|
|
|
|
|
|
# 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 ---
|
|
|
|
|
|
|
|
# 1 2
|
|
|
|
# Usage: $(call compile,src,includes)
|
|
|
|
define compile
|
|
|
|
$(CXX) $(CPPFLAGS) $(CXXFLAGS) \
|
|
|
|
$(call depflags,$(basename $(call src_to_obj,$(1)))) \
|
|
|
|
$(foreach I,$(2),-I$(I)) \
|
|
|
|
-c $(1) -o $(call src_to_obj,$(1))
|
|
|
|
endef
|
|
|
|
|
|
|
|
# 1 2
|
|
|
|
# Usage: $(call c_compile,src,includes)
|
|
|
|
define c_compile
|
|
|
|
$(CC) $(CPPFLAGS) $(CFLAGS) \
|
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)) \
|
|
|
|
-c $(1) -o $(call c_src_to_obj,$(1))
|
|
|
|
endef
|
|
|
|
|
|
|
|
# 1 2
|
|
|
|
# Usage: $(call libcompile,src,includes)
|
|
|
|
define libcompile
|
|
|
|
$(LIBTOOL) --quiet --mode=compile \
|
|
|
|
$(CXX) $(CPPFLAGS) $(CXXFLAGS) \
|
|
|
|
$(call libdepflags,$(basename $(call src_to_obj,$(1)))) \
|
|
|
|
$(foreach I,$(2),-I$(I)) \
|
|
|
|
-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
|
|
|
|
$(LIBTOOL) --quiet --mode=compile \
|
|
|
|
$(CC) $(CPPFLAGS) $(CXXFLAGS) \
|
|
|
|
$(call libdepflags,$(basename $(call c_src_to_obj,$(1)))) \
|
|
|
|
$(foreach I,$(2),-I$(I)) \
|
|
|
|
-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
|
|
|
|
$(LIBTOOL) --mode=link \
|
2009-10-11 00:24:22 +00:00
|
|
|
$(CXX) $(CXXFLAGS) -o $(2) $(1) $(3) $(4) \
|
|
|
|
-rpath $(libdir) -version-info $(5):$(6):$(7)
|
2009-10-10 14:15:09 +00:00
|
|
|
endef
|
|
|
|
|
2009-10-11 00:24:22 +00:00
|
|
|
# 1 2 3 4
|
|
|
|
# Usage: $(call makebin,objs,binary,ldflags,libs)
|
2009-10-10 14:15:09 +00:00
|
|
|
define makebin
|
2009-10-11 00:24:22 +00:00
|
|
|
$(LIBTOOL) --mode=link $(CXX) $(CXXFLAGS) $(1) -o $(2) $(3) $(4)
|
2009-10-10 14:15:09 +00:00
|
|
|
endef
|
2009-10-22 15:20:41 +00:00
|
|
|
|
|
|
|
# Install target
|
|
|
|
|
|
|
|
install: all
|
|
|
|
./mkinstalldirs $(DESTDIR)$(libdir)
|
|
|
|
./mkinstalldirs $(DESTDIR)$(bindir)
|
|
|
|
./mkinstalldirs $(DESTDIR)$(includedir)/qpdf
|
|
|
|
./mkinstalldirs $(DESTDIR)$(docdir)
|
|
|
|
./mkinstalldirs $(DESTDIR)$(mandir)/man1
|
2011-06-23 18:40:37 +00:00
|
|
|
$(LIBTOOL) --mode=install install -c \
|
2009-10-22 15:20:41 +00:00
|
|
|
libqpdf/$(OUTPUT_DIR)/libqpdf.la \
|
|
|
|
$(DESTDIR)$(libdir)/libqpdf.la
|
|
|
|
$(LIBTOOL) --finish $(DESTDIR)$(libdir)
|
|
|
|
$(RM) $(DESTDIR)$(libdir)/libqpdf.la
|
2011-06-23 18:40:37 +00:00
|
|
|
$(LIBTOOL) --mode=install install -c \
|
2009-10-22 15:20:41 +00:00
|
|
|
qpdf/$(OUTPUT_DIR)/qpdf \
|
|
|
|
$(DESTDIR)$(bindir)/qpdf
|
2011-06-23 18:40:37 +00:00
|
|
|
$(LIBTOOL) --mode=install install -c \
|
2009-10-22 15:20:41 +00:00
|
|
|
zlib-flate/$(OUTPUT_DIR)/zlib-flate \
|
|
|
|
$(DESTDIR)$(bindir)/zlib-flate
|
|
|
|
cp qpdf/fix-qdf $(DESTDIR)$(bindir)
|
|
|
|
cp include/qpdf/*.h $(DESTDIR)$(includedir)/qpdf
|
|
|
|
cp include/qpdf/*.hh $(DESTDIR)$(includedir)/qpdf
|
|
|
|
cp doc/stylesheet.css $(DESTDIR)$(docdir)
|
|
|
|
cp doc/qpdf-manual.html $(DESTDIR)$(docdir)
|
|
|
|
cp doc/qpdf-manual.pdf $(DESTDIR)$(docdir)
|
|
|
|
cp doc/*.1 $(DESTDIR)$(mandir)/man1
|