#
# Makefile for a shared library that depends on static and shared libs.
#
# It needs Log() from a static library and MultThree()/MultFour() from
# a shared library.  Both must already have been built.
#
FMS_TOP = ../..
include $(FMS_TOP)/build/makedefs.mk

# source files from wildcard
SRCS = $(wildcard *.c *.cc *.cpp)

# tell FMS that we want all SRCS to be built into a shared library
FMS_BUILD_SHLIB = libshared.so.1.0.0
# the run-time linker will try to find this
FMS_SHLIB_SONAME = libshared.so

# Normally we need this for "-lxxx" linking, but there's no version in
# FMS_SHLIB_SONAME so we don't need this.  You generally *do* want to
# have at least the major version number in FMS_SHLIB_SONAME, but you
# don't have to have it if you don't want it.
#SHLIB_BASENAME = libbase.so

# get includes from here
CFLAGS += -I../../loglib -I../../baselib

# link against libs with goodies we need
LDLIBS = -L$(FMS_DIST_LIBDIR) -llog -lbase

# need to rebuild if Log() lib changes
FMS_BUILD_DEPS = $(FMS_DIST_LIBDIR)/liblog.a


#
# rules start here
#
include $(FMS_TOP)/build/makerules.mk

# build
here: $(FMS_BUILD_SHLIB)

# Install the library, and create a symlink from the "generic" name to
# the version-specific name.
install-here:
	@echo "   Copying $(FMS_BUILD_SHLIB) to $(FMS_DIST_LIBDIR)"
	@$(CPIFNEW) $(FMS_OBJDIR)/$(FMS_BUILD_SHLIB) $(FMS_DIST_LIBDIR)
	@echo "   Symlinking $(FMS_BUILD_SHLIB) to $(FMS_SHLIB_SONAME)"
	@(cd $(FMS_DIST_LIBDIR); ln -sf $(FMS_BUILD_SHLIB) $(FMS_SHLIB_SONAME))

