# $Id: Makefile.am 29839 2026-04-20 08:20:21Z yeti-dn $

libgwyddion = $(top_builddir)/libgwyddion/libgwyddion3.la
libgwyapp = $(top_builddir)/libgwyapp/libgwyapp3.la
libgwyui = $(top_builddir)/libgwyui/libgwyui3.la

noinst_HEADERS = testlibgwy.h test-list.h test-list.c
noinst_PROGRAMS = testlibgwy benchmark

testlibgwy_SOURCES = \
	version.c \
	error-list.c \
	strfuncs.c \
	raw-data.c \
	serialization-utils.c \
	serialization.c \
	unit.c \
	string-list.c \
	dict.c \
	math.c \
	xy.c \
	xyz.c \
	rgba.c \
	inventory.c \
	resource.c \
	gradient.c \
	gl-material.c \
	line.c \
	field.c \
	nield.c \
	shaped.c \
	brick.c \
	scatter.c \
	lawn.c \
	spectra.c \
	selections.c \
	graph-curve-model.c \
	graph-model.c \
	module-utils.c \
	file.c \
	testlibgwy.c

benchmark_SOURCES = \
	benchmark.c

EXTRA_DIST = test-list.txt runtest.sh.in
BUILT_SOURCES = test-list.h test-list.c

expand_test_list = $(PYTHON) $(top_srcdir)/build-aux/expand-test-list.py

test-list.h: test-list.txt
	$(AM_V_GEN) $(expand_test_list) H testlibgwy <test-list.txt >test-list.h

test-list.c: test-list.txt
	$(AM_V_GEN) $(expand_test_list) C testlibgwy <test-list.txt >test-list.c

# Update the Makefile whenever the test list changes.
# We also need to do this in configure because things would break with no initial test-list.mk.
test-list.mk: test-list.txt
	$(AM_V_GEN) $(expand_test_list) MK <test-list.txt >test-list.mk

AM_CFLAGS = @FFTW3_CFLAGS@ @GTK_CFLAGS@ @COMMON_CFLAGS@ $(VALGRIND_CFLAGS)
AM_CPPFLAGS = -I$(top_srcdir)
AM_LDFLAGS = @COMMON_LDFLAGS@ @GTK_MAC_LIBS@ @GTK_LIBS@ @FFTW3_LIBS@ @BASIC_LIBS@ \
	$(libgwyapp) $(libgwyui) $(libgwyddion)

# The way we build tests is one binary with a bunch of g_test_add_func().
# This was nice with gtester but Automake TAP considers it all a single test then.
# We want to see the test cases individually in the output.
# Generate a bunch of empty files SOMETHING.test and run ./testlibgwy -p SOMETHING which only uses the names.
# This is done by defining a log compiler script which does the wrapping.
TESTS =
XFAIL_TESTS =
DISTCLEANFILES = test-list.c test-list.h
TEST_LOG_COMPILER = $(SHELL) $(builddir)/runtest.sh
include $(builddir)/test-list.mk

clean-local:
	rm -rf vgcore.* core.* *~ *.gcda *.gcno *.gcov gmon.out *.test *.trs *.log _testdata*
