dist_noinst_DATA += src/backends/signon/configure-sub.in \
  src/backends/signon/README \
  $(NONE)

# Distribute the .in file, install the generated one.
accounts_servicesdir = $(docdir)/accounts/services
nodist_accounts_services_DATA = \
  src/backends/signon/accounts/google-caldav.service \
  src/backends/signon/accounts/google-carddav.service \
  $(NONE)
dist_noinst_DATA += $(nodist_accounts_services_DATA:%:%.in)

# Distribute the .in file, install the generated one.
accounts_providersdir = $(docdir)/accounts/providers
nodist_accounts_providers_DATA = \
  src/backends/signon/accounts/google.provider \
  $(NONE)
dist_noinst_DATA += $(nodist_accounts_providers_DATA:%:%.in)

# Distribute and install the same file.
accounts_service_typesdir = $(docdir)/accounts/service_types
dist_accounts_service_types_DATA = \
  src/backends/signon/accounts/caldav.service-type \
  src/backends/signon/accounts/carddav.service-type \
  $(NONE)

src_backends_signon_libs =
if USE_GSSO
src_backends_signon_libs += src/backends/signon/providergsso.la
endif
if USE_UOA
src_backends_signon_libs += src/backends/signon/provideruoa.la
endif
if USE_SIGNON
src_backends_signon_libs += src/backends/signon/providersignon.la
endif
MOSTLYCLEANFILES += $(src_backends_signon_libs)

src_backends_signon_common_sources = \
  src/backends/signon/signon.h \
  $(NONE)

if ENABLE_MODULES
src_backends_signon_backenddir = $(BACKENDS_DIRECTORY)
src_backends_signon_backend_LTLIBRARIES = $(src_backends_signon_libs)
src_backends_signon_common_sources += \
  src/backends/signon/signonRegister.cpp
else
noinst_LTLIBRARIES += $(src_backends_signon_libs)
endif

src_backends_signon_common_libadd = $(SYNCEVOLUTION_LIBS) 
src_backends_signon_common_ldflags = -module -avoid-version
src_backends_signon_common_cxxflags = $(SYNCEVOLUTION_CFLAGS)
src_backends_signon_common_cppflags = -DUSE_SIGNON -I$(top_srcdir)/test $(BACKEND_CPPFLAGS)
src_backends_signon_common_dependencies = src/syncevo/libsyncevolution.la

if USE_GSSO
src_backends_signon_providergsso_la_SOURCES = \
  src/backends/signon/signon-accounts.cpp \
  $(src_backends_signon_common_sources)
src_backends_signon_providergsso_la_LIBADD = $(GSSO_LIBS) $(ACCOUNTS_LIBS) $(src_backends_signon_common_libadd) 
src_backends_signon_providergsso_la_LDFLAGS = $(src_backends_signon_common_ldflags)
src_backends_signon_providergsso_la_CXXFLAGS = $(GSSO_CFLAGS) $(ACCOUNTS_CFLAGS) $(src_backends_signon_common_cxxflags)
src_backends_signon_providergsso_la_CPPFLAGS = -DUSE_GSSO -DUSE_ACCOUNTS $(src_backends_signon_common_cppflags)
src_backends_signon_providergsso_la_DEPENDENCIES = $(src_backends_signon_common_dependencies)
endif

if USE_UOA
src_backends_signon_provideruoa_la_SOURCES = \
  src/backends/signon/signon-accounts.cpp \
  $(src_backends_signon_common_sources)
src_backends_signon_provideruoa_la_LIBADD = $(UOA_LIBS) $(ACCOUNTS_LIBS) $(src_backends_signon_common_libadd)
src_backends_signon_provideruoa_la_LDFLAGS = $(src_backends_signon_common_ldflags)
src_backends_signon_provideruoa_la_CXXFLAGS = $(UOA_CFLAGS) $(ACCOUNTS_CFLAGS) $(src_backends_signon_common_cxxflags)
src_backends_signon_provideruoa_la_CPPFLAGS = -DUSE_UOA -DUSE_ACCOUNTS $(src_backends_signon_common_cppflags)
src_backends_signon_provideruoa_la_DEPENDENCIES = $(src_backends_signon_common_dependencies)
endif

if USE_SIGNON
src_backends_signon_providersignon_la_SOURCES = \
  src/backends/signon/signon.cpp \
  $(src_backends_signon_common_sources)
src_backends_signon_providersignon_la_LIBADD = $($(DEFAULT_SIGNON)_LIBS) $(ACCOUNTS_LIBS) $(src_backends_signon_common_libadd)
src_backends_signon_providersignon_la_LDFLAGS = $(src_backends_signon_common_ldflags)
src_backends_signon_providersignon_la_CXXFLAGS = $($(DEFAULT_SIGNON)_CFLAGS) $(ACCOUNTS_CFLAGS) $(src_backends_signon_common_cxxflags)
src_backends_signon_providersignon_la_CPPFLAGS = -DUSE_$(DEFAULT_SIGNON) $(src_backends_signon_common_cppflags)
src_backends_signon_providersignon_la_DEPENDENCIES = $(src_backends_signon_common_dependencies)
endif
