#!/usr/bin/make -f

include toc.make

SUBDIRS_FIRST = strtool
ifeq (1,$(s11n_CONFIG_ENABLE_PLUGINS))
      SUBDIRS_FIRST += plugin
endif
SUBDIRS_FIRST += s11n io proxy lite nodeutil

SUBDIRS_SECOND = client


SUBDIRS = $(SUBDIRS_FIRST) $(SUBDIRS_SECOND)
# s11n serializers lite sutil client
# sutil

DIST_FILES += $(wildcard in.*) test.cpp

SHARED_LIBS = libs11n 
libs11n_so_VERSION = $(PACKAGE_VERSION)
libs11n_so_LDADD = $(LIBS11N_LDADD) 
libs11n_so_OBJECTS = \
	strtool/strtool.o \
	s11n/exception.o \
	s11n/s11n.o \
	s11n/s11n_node.o \
	lite/s11nlite.o	\
	$(shell find io -type f -name '*.o')

ifeq (1,$(s11n_CONFIG_ENABLE_PLUGINS))
  libs11n_so_OBJECTS += plugin/plugin.o plugin/path_finder.o
endif

include $(TOC_MAKESDIR)/SHARED_LIBS.make

########################################################################
# Linking against a static s11n doesn't work because factory registrations
# done via the backwards approach we take are never triggered when linked
# this way :(
STATIC_LIBS = libs11n
libs11n_a_OBJECTS = $(libs11n_so_OBJECTS)
include $(TOC_MAKESDIR)/STATIC_LIBS.make
########################################################################

BIN_PROGRAMS = test
test_bin_OBJECTS = test.o libs11n.so
test_bin_LDADD = $(LIBS11N_LDADD) -rdynamic
include $(TOC_MAKESDIR)/BIN_PROGRAMS.make
bins: bin-test


all: $(addprefix subdir-,$(SUBDIRS_FIRST)) SHARED_LIBS STATIC_LIBS $(addprefix subdir-,$(SUBDIRS_SECOND))




