+if USE_LIBMODPLUG
+engine_la_SOURCES += src/engine/music-modplug.c src/engine/modplug-types.h
+engine_la_LIBADD += $(LIBMODPLUG_LIBS)
+endif
+
+check_PROGRAMS = test/decodeindex test/pcxrle
+check_LIBRARIES = libtest.a
+
+libtest_a_SOURCES = test/common.c test/common.h common/src/help.c
+$(libtest_a_OBJECTS): $(gnulib_headers)
+
+TEST_LIBS = libtest.a libgnu.la
+
+test_decodeindex_LDADD = libupkg.la $(TEST_LIBS)
+$(test_decodeindex_OBJECTS): $(gnulib_headers)
+test_pcxrle_LDADD = src/engine/pcx.lo libupkg.la $(TEST_LIBS)
+$(test_pcxrle_OBJECTS): $(gnulib_headers)
+
+EXTRA_DIST += tests/data/test0.utx tests/data/hatch2x2.pcx
+
+# Supporting rules for GObject Builder
+GOB_V = $(GOB_V_@AM_V@)
+GOB_V_ = $(GOB_V_@AM_DEFAULT_V@)
+GOB_V_0 = @printf ' %$(DX_ALIGN_V)s %s\n' 'GOB ' $<;
+
+# Unfortunately, GOB's output filenames depend on the contents of the gob file,
+# rather than its filename. This isn't really suitable for use with make, so
+# this rule has to make some assumptions about the source tree layout.
+.gob.gobstamp:
+if HAVE_GOB2_DYN
+ $(AM_V_at) touch $@.tmp
+ $(GOB_V) od='$(@D)'; case $$od in \
+ src/*) od=src ;; \
+ */src/*) od=$${od%/src/*}/src ;; \
+ esac; $(GOB2) -o "$$od" --file-sep=/ \
+ --no-private-header --no-touch-headers $<
+ $(AM_V_at) mv -f $@.tmp $@
+else
+if HAVE_GOB2
+ @echo "ERROR: *** $(GOB2) does not support dynamic types." 1>&2
+else
+ @echo "ERROR: *** gob2 is missing on your system." 1>&2
+endif
+ @:; { \
+ echo " *** Because of this, I cannot compile $<, but"; \
+ echo " *** (perhaps because you modified it) the sources appear out of date."; \
+ echo " *** A newer version of gob2 may be required; the latest version"; \
+ echo " *** may be found at <https://draconx.ca/projects/gob-dx/>."; \
+ echo " *** See config.log for more details."; \
+ } 1>&2
+ @false
+endif
+
+STAMP_RECOVER = \
+ @if test -f $@; then :; else rm -f $<; $(MAKE) $(AM_MAKEFLAGS) $<; fi
+.gobstamp.c: ; $(STAMP_RECOVER)
+.gobstamp.h: ; $(STAMP_RECOVER)
+
+OPTFILES = src/upkgopts.opt
+.opt.h:
+ $(AM_V_GEN) $(AWK) -f $(DX_BASEDIR)/scripts/gen-options.awk $< >$@.tmp
+ $(AM_V_at) mv -f $@.tmp $@
+$(OPTFILES:.opt=.h): $(DX_BASEDIR)/scripts/gen-options.awk
+MAINTAINERCLEANFILES += $(OPTFILES:.opt=.h)
+EXTRA_DIST += $(DX_BASEDIR)/scripts/gen-options.awk $(OPTFILES)
+
+# The gob rules refrain from updating unchanged headers for the convenience of
+# developers, but the headers should be distributed with up-to-date timestamps.
+dist-hook: update-headers
+update-headers: unfuck-distdir
+ for f in $(engine_GOBS:.gob=.h); do \
+ touch -c '$(distdir)'/"$$f" || exit; \
+ done
+.PHONY: update-headers
+
+# When running "make dist" in a VPATH build with a read-only srcdir, Automake
+# will produce a distribution with all files read-only. Moreover, the files
+# are read-only in distdir when the dist hooks are run. This hook will
+# manually fix up the permissions. All dist hooks that modify files in
+# distdir should list unfuck-distdir as a prerequisite.
+dist-hook: unfuck-distdir
+unfuck-distdir:
+ find '$(distdir)' -type f -exec chmod u+w {} +
+.PHONY: unfuck-distdir
+
+include $(top_srcdir)/lib/gnulib.mk
+include $(top_srcdir)/libltdl/ltdl.mk
+include $(top_srcdir)/common/snippet/autotest.mk