2008-04-29 12:55:25 +00:00
|
|
|
# This makefile is inspired by abuild (http://www.abuild.org), which
|
|
|
|
# was used during the development of qpdf. The goal here is to have a
|
|
|
|
# non-recursive build with all the proper dependencies so we can start
|
|
|
|
# the build from anywhere and get the right stuff. Each directory has
|
|
|
|
# a build.mk that is included from here and is written from this
|
|
|
|
# directory's perspective. Each directory also has a proxy Makefile
|
|
|
|
# that allows you to start the build from any directory and get
|
|
|
|
# reasonable semantics for the all, check, and clean targets.
|
|
|
|
|
|
|
|
# Our "build items" are directories. They are listed here such that
|
|
|
|
# no item precedes any item it depends on. Therefore, each item can
|
|
|
|
# safely reference variables set in its predecessors.
|
|
|
|
|
|
|
|
# For each build item B, you can run make build_B, make check_B, or
|
|
|
|
# make clean_B to build, test, or clean B. Full dependencies are
|
|
|
|
# represented across all the items, so it is possible to start
|
|
|
|
# anywhere. From the top level, the "all", "check", and "clean"
|
|
|
|
# targets build, test, or clean everything.
|
|
|
|
|
2017-08-14 12:04:53 +00:00
|
|
|
# To run test suites without rebuilding, pass NO_REBUILD=1 to the
|
|
|
|
# build. This can be useful for testing binary interface compatibility
|
|
|
|
# as it enables you to rebuild libraries and rerun tests without
|
|
|
|
# relinking.
|
|
|
|
|
2008-04-29 12:55:25 +00:00
|
|
|
# Although this is not a GNU package and does not use automake, you
|
|
|
|
# can still run make clean to remove everything that is compiled, make
|
|
|
|
# distclean to remove everything that is generated by the end user,
|
|
|
|
# and make maintainer-clean to remove everything that is generated
|
|
|
|
# including things distributed with the source distribution. You can
|
|
|
|
# pass CLEAN=1 to prevent this Makefile from complaining if
|
2009-10-23 03:20:03 +00:00
|
|
|
# ./configure has not been run.
|
2008-04-29 12:55:25 +00:00
|
|
|
|
|
|
|
# The install target works as usual and obeys --prefix and so forth
|
|
|
|
# passed to ./configure. You can also pass DESTDIR=/dir to make
|
|
|
|
# install to install in a separate location. This is useful for
|
|
|
|
# packagers.
|
|
|
|
|
2020-10-24 21:19:25 +00:00
|
|
|
BUILD_ITEMS := manual libqpdf qpdf zlib-flate libtests fuzz examples
|
2008-04-29 12:55:25 +00:00
|
|
|
OUTPUT_DIR = build
|
|
|
|
ALL_TARGETS =
|
|
|
|
|
|
|
|
.PHONY: default
|
|
|
|
default: all
|
|
|
|
|
|
|
|
CLEAN ?=
|
|
|
|
ifneq ($(CLEAN),1)
|
|
|
|
ifeq ($(words $(wildcard autoconf.mk)),0)
|
|
|
|
DUMMY := $(shell echo 1>&2)
|
|
|
|
DUMMY := $(shell echo 1>&2 Please run ./configure before running $(MAKE))
|
|
|
|
DUMMY := $(shell echo 1>&2)
|
|
|
|
$(error unable to continue with build)
|
|
|
|
endif
|
|
|
|
|
|
|
|
autoconf.mk:
|
|
|
|
|
|
|
|
include autoconf.mk
|
|
|
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
# Prevent gnu make from trying to rebuild .dep files
|
|
|
|
$(foreach B,$(BUILD_ITEMS),$(eval \
|
|
|
|
$(B)/$(OUTPUT_DIR)/%.dep: ;))
|
|
|
|
|
|
|
|
# Prevent gnu make from trying to rebuild .mk files
|
|
|
|
$(foreach B,$(BUILD_ITEMS),$(eval \
|
|
|
|
$(B)/%.mk: ;))
|
|
|
|
%.mk: ;
|
|
|
|
make/%.mk: ;
|
|
|
|
|
2009-10-10 18:26:15 +00:00
|
|
|
BUILDRULES ?= libtool
|
2008-04-29 12:55:25 +00:00
|
|
|
include make/rules.mk
|
|
|
|
|
|
|
|
DUMMY := $(shell mkdir $(foreach B,$(BUILD_ITEMS),$(B)/$(OUTPUT_DIR)) 2>/dev/null)
|
|
|
|
|
|
|
|
include $(foreach B,$(BUILD_ITEMS),$(B)/build.mk)
|
|
|
|
|
|
|
|
ALL_TARGETS = $(foreach B,$(BUILD_ITEMS),$(TARGETS_$(B)))
|
|
|
|
|
|
|
|
TEST_ITEMS = $(foreach D,\
|
|
|
|
$(wildcard $(foreach B,$(BUILD_ITEMS),$(B)/qtest)),\
|
|
|
|
$(subst /,,$(dir $(D))))
|
|
|
|
|
|
|
|
TEST_TARGETS = $(foreach B,$(TEST_ITEMS),check_$(B))
|
|
|
|
|
|
|
|
CLEAN_TARGETS = $(foreach B,$(BUILD_ITEMS),clean_$(B))
|
|
|
|
|
2017-08-14 12:02:35 +00:00
|
|
|
# For test suites
|
2008-04-29 12:55:25 +00:00
|
|
|
export QPDF_BIN = $(abspath qpdf/$(OUTPUT_DIR)/qpdf)
|
2012-07-28 23:06:03 +00:00
|
|
|
export QPDF_SKIP_TEST_COMPARE_IMAGES
|
|
|
|
export QPDF_LARGE_FILE_TEST_PATH
|
2008-04-29 12:55:25 +00:00
|
|
|
|
2009-10-12 02:13:13 +00:00
|
|
|
clean:: $(CLEAN_TARGETS)
|
2018-02-18 03:41:02 +00:00
|
|
|
$(RM) -r appimage/build
|
2008-04-29 12:55:25 +00:00
|
|
|
|
|
|
|
.PHONY: $(CLEAN_TARGETS)
|
|
|
|
$(foreach B,$(BUILD_ITEMS),$(eval \
|
|
|
|
clean_$(B): ; \
|
|
|
|
$(RM) -r $(B)/$(OUTPUT_DIR)))
|
|
|
|
|
2018-10-11 21:23:31 +00:00
|
|
|
DISTFILES = doc/qpdf-manual.html doc/qpdf-manual.pdf
|
2018-10-11 17:34:29 +00:00
|
|
|
distfiles.zip: $(DISTFILES)
|
|
|
|
$(RM) distfiles.zip
|
|
|
|
zip distfiles.zip $(DISTFILES)
|
|
|
|
|
2008-04-29 12:55:25 +00:00
|
|
|
distclean: clean
|
|
|
|
$(RM) -r autoconf.mk autom4te.cache config.log config.status libtool
|
2008-05-05 14:29:12 +00:00
|
|
|
$(RM) libqpdf/qpdf/qpdf-config.h
|
2008-04-29 12:55:25 +00:00
|
|
|
$(RM) manual/html.xsl
|
|
|
|
$(RM) manual/print.xsl
|
|
|
|
$(RM) doc/*.1
|
2017-08-11 08:56:22 +00:00
|
|
|
$(RM) libqpdf.pc libqpdf.map
|
2008-04-29 12:55:25 +00:00
|
|
|
|
|
|
|
maintainer-clean: distclean
|
2018-10-11 21:23:31 +00:00
|
|
|
$(RM) doc/qpdf-manual.*
|
|
|
|
$(RM) -r install-mingw* install-msvc* external-libs
|
|
|
|
$(RM) distfiles.zip
|
2008-04-29 12:55:25 +00:00
|
|
|
|
|
|
|
.PHONY: $(TEST_TARGETS)
|
2017-08-14 12:04:53 +00:00
|
|
|
|
|
|
|
NO_REBUILD ?=
|
|
|
|
ifneq ($(NO_REBUILD),1)
|
2008-04-29 12:55:25 +00:00
|
|
|
$(foreach B,$(TEST_ITEMS),$(eval \
|
|
|
|
check_$(B): $(TARGETS_$(B))))
|
2017-08-14 12:04:53 +00:00
|
|
|
endif
|
2008-04-29 12:55:25 +00:00
|
|
|
|
|
|
|
.PHONY: $(foreach B,$(BUILD_ITEMS),build_$(B))
|
|
|
|
$(foreach B,$(BUILD_ITEMS),$(eval \
|
|
|
|
build_$(B): $(TARGETS_$(B))))
|
|
|
|
|
|
|
|
.PHONY: all
|
|
|
|
all: $(ALL_TARGETS) ;
|
|
|
|
|
|
|
|
check: $(TEST_TARGETS)
|
|
|
|
|
2021-09-13 15:10:09 +00:00
|
|
|
.PHONY: spell
|
|
|
|
# npm install -g cspell; add exceptions to cSpell.json
|
|
|
|
spell:
|
|
|
|
cspell **/*.hh **/*.cc manual/* ChangeLog README* TODO
|
|
|
|
|
2009-10-22 15:20:41 +00:00
|
|
|
# Install targets are in the make directory in the rules-specific make
|
|
|
|
# fragments.
|
|
|
|
|
2008-04-29 12:55:25 +00:00
|
|
|
QTEST=$(abspath qtest/bin/qtest-driver)
|
|
|
|
$(TEST_TARGETS):
|
2017-08-14 12:02:35 +00:00
|
|
|
$(call run_qtest,$(subst check_,,$@))
|