# 
# Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
#
# This software is dual-licensed to you under the MIT License (MIT) and the Universal Permissive License (UPL).  See the LICENSE file in the root directory for license terms.  You may choose
# either license, or both.
#

#
#  Base configuration options:
#
#     PORT              set default platform port
#     CC_CFG            set default platform compiler configuration
#     LIB_CFG           set default library configuration
#
#  Targets:
#
#     all               calls 'build' and 'doc' targets
#     build             builds library
#     doc               creates API documentation
#     clean             cleans the build
#

override PORT=posix
CC_CFG?=gcc
ifeq ($(shell uname -s),Darwin)
    CC_CFG=gcc-darwin
    LINK_ICONV=true
endif
LIB_CFG?=ts_md_vs_gw

MAKE_DIR?=.
include $(MAKE_DIR)/config/paths.cfg

# includes predefined library configuration
include $(LIB_CONFIG)
# includes additional custom library configurations
include $(LIB_SHARED_CUSTOM_CONFIG)
include $(LIB_PORT_CUSTOM_CONFIG)
# includes architecture configuration
include $(COMPILER_CONFIG)
# includes library common definitions
include $(LIB_COMMON_DEFS)
# includes platform depended targets implementation and definitions
include $(LIB_PORT_DEFS)
include $(LIB_PORT_IMPL)

C_MAKE_DIR?=$(MAKE_DIR)
include $(C_MAKE_DIR)/bootstrapper/$(PORT)/bootstrapper.mk

.DEFAULT_GOAL := all
.PHONY: all
all: build doc

.PHONY: build
# BUILD_SUFFIX used for build library settings set, like set/all.cfg
build: .pre_build$(BUILD_SUFFIX) .build_impl$(BUILD_SUFFIX) .post_build$(BUILD_SUFFIX)
	
.PHONY: doc
doc:   .pre_doc   .doc_impl   .post_doc

.PHONY: clean
clean: .pre_clean .clean_impl .post_clean
