+# Include current directory to allow sources to include config.h.
+override CPPFLAGS += -I. -DHAVE_CONFIG_H=1
+
+# The target C++ flags should mirror the target C flags by default.
+TGT_CXXFLAGS = $(TGT_CFLAGS)
+
+# Define the default flags passed to the library archiver.
+ARFLAGS = rc
+
+# Define the default install program.
+INSTALL = install
+
+# Define the `tarname' to be used as a base filename for distributable
+# archives.
+tarname = $(TARNAME)-$(VERSION)
+
+# Define the commands needed to make several different types of files. Don't
+# used these commands directly because they don't account for verbosity;
+# instead use the commands without the `cmd_' prefix (defined below).
+cmd_compile_c = $(CC) $(PKG_CFLAGS) $(TGT_CFLAGS) $(PCH_CFLAGS) $(CFLAGS) $(MYCFLAGS) $(CPPFLAGS) \
+ $(TARGET_ARCH) -c $(OUTPUT_OPTION) $<
+cmd_compile_cc = $(CXX) $(PKG_CXXFLAGS) $(TGT_CXXFLAGS) $(PCH_CXXFLAGS) $(CXXFLAGS) $(MYCXXFLAGS) $(CPPFLAGS) \
+ $(TARGET_ARCH) -c $(OUTPUT_OPTION) $<
+cmd_link_c = $(CC) $(PKG_CFLAGS) $(TGT_CFLAGS) $(PCH_CFLAGS) $(CFLAGS) $(MYCFLAGS) $(CPPFLAGS) \
+ $(PKG_LDFLAGS) $(TGT_LDFLAGS) $(LDFLAGS) $(MYLDFLAGS) \
+ $(TARGET_ARCH) $^ $(LOADLIBES) $(PKG_LDLIBS) $(TGT_LDLIBS) $(LDLIBS) -o $@
+cmd_link_cc = $(CXX) $(PKG_CXXFLAGS) $(TGT_CXXFLAGS) $(PCH_CXXFLAGS) $(CXXFLAGS) $(MYCXXFLAGS) $(CPPFLAGS) \
+ $(PKG_LDFLAGS) $(TGT_LDFLAGS) $(LDFLAGS) $(MYLDFLAGS) \
+ $(TARGET_ARCH) $^ $(LOADLIBES) $(PKG_LDLIBS) $(TGT_LDLIBS) $(LDLIBS) -o $@
+cmd_compile_pch = $(CC) $(PKG_CFLAGS) $(TGT_CFLAGS) $(CFLAGS) $(MYCFLAGS) $(CPPFLAGS) \
+ $(TARGET_ARCH) -c $(OUTPUT_OPTION) $<
+cmd_compile_pchh = $(CXX) $(PKG_CXXFLAGS) $(TGT_CXXFLAGS) $(CXXFLAGS) $(MYCXXFLAGS) $(CPPFLAGS) \
+ $(TARGET_ARCH) -c $(OUTPUT_OPTION) $<
+cmd_ar = $(AR) $(ARFLAGS) $@ $^; $(RANLIB) $@
+cmd_compile_rc = $(WINDRES) $(CPPFLAGS) $(TARGET_ARCH) $(OUTPUT_OPTION) -i $<
+cmd_sed = sed -f config.sed <$< >$@
+cmd_gzip = gzip -c $< >$@
+cmd_bzip2 = bzip2 -c $< >$@
+cmd_xxd = id=$(subst .,_,$(notdir $<)); \
+ printf "\#include <stddef.h>\nsize_t\tdata_%s_size = %d;\nchar\tdata_%s[] = {\n" \
+ $$id $$(wc -c <$<) $$id >$@; \
+ xxd -i <$< >>$@; \
+ printf ", 0x00\n};\n" >>$@
+cmd_configure = ./configure
+
+# Define some useful functions. Don't use these functions directly because
+# they don't account for verbosity; instead use the functions without the
+# `func_' prefix (defined below).
+func_remove = rm -f $1
+func_install = mkdir -p $(DESTDIR)$3 && $(INSTALL) -m $1 $2 $(DESTDIR)$3
+func_dist = git archive HEAD --prefix='$(tarname)/' | $1 >"$(tarname).tar.$2" && \
+ (openssl md5 "$(tarname).tar.$2" 2>/dev/null || \
+ md5 "$(tarname).tar.$2" 2>/dev/null || \
+ md5sum "$(tarname).tar.$2" 2>/dev/null)
+
+# These commands and functions should be used in most recipes to compile
+# sources, link objects, compress files, create distfiles, install files, etc.
+compile_c = $(call func_print,CC,$@) $(cmd_compile_c)
+compile_cc = $(call func_print,CXX,$@) $(cmd_compile_cc)
+compile_rc = $(call func_print,RC,$@) $(cmd_compile_rc)
+link_c = $(call func_print,LINK,$@) $(cmd_link_c)
+link_cc = $(call func_print,LINK,$@) $(cmd_link_cc)
+compile_pch = $(call func_print,CC,$@) $(cmd_compile_pch)
+compile_pchh = $(call func_print,CXX,$@) $(cmd_compile_pchh)
+ar = $(call func_print,AR,$@) $(cmd_ar)
+sed = $(call func_print,SED,$@) $(cmd_sed)
+gzip = $(call func_print,GZIP,$@) $(cmd_gzip)
+bzip2 = $(call func_print,BZIP2,$@) $(cmd_bzip2)
+xxd = $(call func_print,XXD,$@) $(cmd_xxd)
+configure = $(call func_print,MAKE,$@) $(cmd_configure)
+dist = $(call func_print,DIST,$1) $(func_dist)
+remove = $(call func_print,RM,$1) $(func_remove)
+install = $(call func_print,CP,$(DESTDIR:%/=%)$(3:%/=%)/$(notdir $2)) $(func_install)
+
+# The mechanism used by this makefile to handle verbosity simply requires (by
+# convention) commands in rules to be prefixed with `$Q' and the commands and
+# functions defined above will then print a single line describing the command
+# instead of the entire command.
+ifeq (1,$V)
+Q =
+func_print =