###
# $Id: Makefile 8968 2006-03-28 16:27:28Z gpotts $
###

###
# Use ../make.opt to set GDAL_INCLUDES and GDAL_LIBS
###
include ../make.opt

###
# You must have the variable OSSIM_HOME set.
# 
# This can be put in the ../make.opt file or be an environment variable.
###
include $(OSSIM_HOME)/Makefile.common

BASE_INCLUDES := -I.. -I. $(GDAL_INCLUDES) $(BASE_INCLUDES)

OSSIM_LIB=libossimunit_test_plugin
DIRECTORIES=
BASELIBPATH=`pwd`
BASE_DEFINES += -DOSSIMOGCMAKINGDLL
include $(OSSIM_HOME)/makelib.mak

SHARED_LIB_VERSIONLESS=$(OSSIM_LIB).$(SO_VERSIONLESS_EXT)
SHARED_LIB_SONAME=$(OSSIM_LIB).$(SO_SONAME_EXT)
SHARED_LIB_REALNAME=$(OSSIM_LIB).$(SO_REALNAME_EXT)
SHARED_LIB_TARGET=../lib/$(SHARED_LIB_REALNAME)
SHARED_OBJ_DIR_PATH=$(BASELIBPATH)/$(SHARED_OBJ_DIR)
STATIC_LIB=$(OSSIM_LIB).a
STATIC_LIB_TARGET=$(OSSIM_LIB_PATH)/$(STATIC_LIB)
STATIC_OBJ_DIR_PATH=$(BASELIBPATH)/$(STATIC_OBJ_DIR)

COMPATIBILITY_VERSION=$(OSSIM_MAJOR_VERSION_NUMBER).$(OSSIM_MINOR_VERSION_NUMBER)
INSTALL_NAME=$(OSSIM_LIB_PATH)/$(SHARED_LIB_SONAME)
ifeq ($(BUILD_SINGLE_SHARED_LIBS),yes)
LINK_SHARED_OBJECT_FILES=	$(SHARED_OBJ_DIR)/*.$(OBJEXT)
endif

ifeq ($(BUILD_SINGLE_STATIC_LIBS),yes)

LINK_STATIC_OBJECT_FILES=	$(STATIC_OBJ_DIR)/*.$(OBJEXT) 
endif

all: destobjdir $(OBJS) 
	$(build_single_shared_lib)

define build_single_shared_lib
$(LD_SHARED) -o $(SHARED_LIB_TARGET) \
 $(LINK_SHARED_OBJECT_FILES)  $(GDAL_LIBS) $(OSSIM_LIB_LINK) ; \
(cd ../lib ; $(RM_NOPROMPT) $(SHARED_LIB_SONAME) ; $(RM_NOPROMPT) $(SHARED_LIB_VERSIONLESS) ; ln -s $(SHARED_LIB_REALNAME) $(SHARED_LIB_SONAME) ; ln -s $(SHARED_LIB_REALNAME) $(SHARED_LIB_VERSIONLESS) ; ) ;
endef
