# $Id: Makefile.am 27951 2025-05-09 16:34:45Z yeti-dn $

# Put sources that are for some reason disabled yet present in svn checkouts
# here.  This makes them distributed and translations of their messages are
# kept.  If we remove them completely, various bits can get lost.
disabled_sources =

graphdir = $(libdir)/gwyddion3/modules/graph

# Only bundle modules without own dependencies.  If something goes wrong with
# any required libraries at run-time, it will at most break these individual
# unbundled modules, not the bundle.
bundlable_modules = \
	graphops.la \
	graph_align.la \
	graph_cd.la \
	graph_cut.la \
	graph_dos_spectrum.la \
	graph_export_ascii.la \
	graph_export_image.la \
	graph_fit.la \
	graph_fztofd.la \
	graph_logscale.la \
	graph_measure_period.la \
	graph_merge.la \
	graph_peaks.la \
	graph_polylevel.la \
	graph_sfuncs.la \
	graph_simplemech.la \
	graph_sinebg.la \
	graph_stats.la \
	graph_terraces.la

# graph_modules is either the bundle or all the individual modules.
if MODULE_BUNDLING
graph_modules = graph.la
BUILT_SOURCES = graph.c
graph_la_CFLAGS = $(AM_CFLAGS) -DGWY_MODULE_BUNDLING
else
graph_modules = $(bundlable_modules)
endif

graph_LTLIBRARIES = \
	$(graph_modules)

if OS_MSWIN
no_undefined = -no-undefined
endif

EXTRA_DIST = \
	$(disabled_sources)

if MODULE_DEPENDENCIES
module_libadd = \
	$(top_builddir)/libgwyapp/libgwyapp3.la \
	$(top_builddir)/libgwyddion/libgwyddion3.la \
	$(top_builddir)/libgwyui/libgwyui3.la \
	@GTK_LIBS@ @LIBM@
else
module_libadd = @LIBM@
endif

AM_CPPFLAGS = -I$(top_srcdir) -DG_LOG_DOMAIN=\"Gwy-Module\"
AM_CFLAGS = @GTK_CFLAGS@ @COMMON_CFLAGS@ @OPENMP_CFLAGS@
AM_LDFLAGS = -avoid-version -module $(no_undefined) $(module_libadd)

# Bundlable modules, must be listed in tools_la_SOURCES below.
graphops_la_SOURCES             = graphops.c
graph_align_la_SOURCES          = graph_align.c
graph_cd_la_SOURCES             = graph_cd.c
graph_cut_la_SOURCES            = graph_cut.c
graph_dos_spectrum_la_SOURCES   = graph_dos_spectrum.c
graph_export_ascii_la_SOURCES   = graph_export_ascii.c
graph_export_image_la_SOURCES   = graph_export_image.c
graph_fit_la_SOURCES            = graph_fit.c
graph_fztofd_la_SOURCES         = graph_fztofd.c
graph_logscale_la_SOURCES       = graph_logscale.c
graph_measure_period_la_SOURCES = graph_measure_period.c
graph_merge_la_SOURCES          = graph_merge.c
graph_peaks_la_SOURCES          = graph_peaks.c
graph_polylevel_la_SOURCES      = graph_polylevel.c
graph_sfuncs_la_SOURCES         = graph_sfuncs.c
graph_simplemech_la_SOURCES     = graph_simplemech.c
graph_sinebg_la_SOURCES         = graph_sinebg.c
graph_stats_la_SOURCES          = graph_stats.c
graph_terraces_la_SOURCES       = graph_terraces.c

graph_la_SOURCES = \
	$(graphops_la_SOURCES) \
	$(graph_align_la_SOURCES) \
	$(graph_cd_la_SOURCES) \
	$(graph_cut_la_SOURCES) \
	$(graph_dos_spectrum_la_SOURCES) \
	$(graph_export_ascii_la_SOURCES) \
	$(graph_export_image_la_SOURCES) \
	$(graph_fit_la_SOURCES) \
	$(graph_fztofd_la_SOURCES) \
	$(graph_logscale_la_SOURCES) \
	$(graph_measure_period_la_SOURCES) \
	$(graph_merge_la_SOURCES) \
	$(graph_peaks_la_SOURCES) \
	$(graph_polylevel_la_SOURCES) \
	$(graph_sfuncs_la_SOURCES) \
	$(graph_simplemech_la_SOURCES) \
	$(graph_sinebg_la_SOURCES) \
	$(graph_stats_la_SOURCES) \
	$(graph_terraces_la_SOURCES) \
	graph.c

graph.c: $(srcdir)/Makefile.am $(top_srcdir)/build-aux/gen-module-bundle.sh
	$(SHELL) $(top_srcdir)/build-aux/gen-module-bundle.sh graph.c $(bundlable_modules)

CLEAN_FILES = graph.c

clean-local:
	rm -f core.* *~
