#
# Makefile for a simple shared library.
#
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 = libbase.so.1.0.0
# the run-time linker will try to find this
FMS_SHLIB_SONAME = libbase.so.1
# we also need this symlink, so that "-lxxx" works when linking
SHLIB_BASENAME = libbase.so


#
# 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.
#
# (Could probably make this a generic "install-shlib" rule.)
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))
	@echo "   Symlinking $(FMS_BUILD_SHLIB) to $(SHLIB_BASENAME)"
	@(cd $(FMS_DIST_LIBDIR); ln -sf $(FMS_BUILD_SHLIB) $(SHLIB_BASENAME))

