#******************************************************************
#
# Copyright 2014 Intel Mobile Communications GmbH All Rights Reserved.
#
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=


Import('env')
import os

target_os = env.get('TARGET_OS')

env.AppendUnique(CPPPATH = [
            os.path.join(Dir('.').abspath),
            os.path.join(Dir('.').abspath, 'oic_malloc/include'),
            os.path.join(Dir('.').abspath, 'oic_string/include'),
            os.path.join(Dir('.').abspath, 'oic_time/include'),
            os.path.join(Dir('.').abspath, 'ocrandom/include')
        ])

if target_os == 'tizen':
	env.AppendUnique(LIBPATH = [env.get('BUILD_DIR')])
else:
	env.AppendUnique(LIBPATH = [os.path.join(env.get('BUILD_DIR'), 'resource/c_common')])

if target_os in ['tizen', 'linux']:
	env.ParseConfig("pkg-config --cflags --libs uuid")

env.PrependUnique(LIBS = ['c_common'])

common_env = env.Clone()

######################################################################
# Build flags
######################################################################

######################################################################
# Source files and Targets
######################################################################
common_src = [
	'oic_string/src/oic_string.c',
	'oic_malloc/src/oic_malloc.c',
	'oic_time/src/oic_time.c',
	'ocrandom/src/ocrandom.c',
	]

commonlib = common_env.StaticLibrary('c_common', common_src)
common_env.InstallTarget(commonlib, 'c_common')
common_env.UserInstallTargetLib(commonlib, 'c_common')
common_env.UserInstallTargetHeader('platform_features.h', 'resource', 'platform_features.h')
