
# Defines for building this project
# To be included in all Makefiles

# This will be used as the base path for installtion
prefix = $(PREFIX)

# Must allways be $(PREFIX)/bin because installation depends on it
# Only placed here because it is a common location for all makefiles
link_path = $(PREFIX)/bin

# If BUILD_STATIC is not defined then shared compilation and linking
# will be performed
# If set to yes then static compilation and linking is performed
static_option =
ifeq ($(BUILD_STATIC), yes)
    static_option = -static
endif

# If ENABLE_THREADING is not defined, then no threading will be compiled into
# the application
# If set to yes then threading support will be compiled into the application
threading_options =
ifeq ($(ENABLE_THREADING), yes)
    threading_options = -fopenmp
endif

# If ENABLE_PROFILING is not defined, then no profiling will be compiled into
# the application
# If set to yes then profiling support will be compiled into the application
profiling_options =
ifeq ($(ENABLE_PROFILING), yes)
    profiling_options = -pg
endif

# If ENABLE_DEBUG is not defined, then no debugging will be compiled into
# the application
# If set to yes then debugging support will be compiled into the application
debug_option =
ifeq ($(ENABLE_DEBUG), yes)
    debug_option = -g
endif

# If ENABLE_OPTIMIZATION is not defined, then no optimization will be compiled
# into the application
# If set to yes then optimization support will be compiled into the application
optimization_options = -O2
ifeq ($(ENABLE_OPTIMIZATION), yes)
    optimization_options = -O2
endif
ifeq ($(DISABLE_OPTIMIZATION), yes)
    optimization_options =
endif


# Place the extra options identified above into one variable to be used
EXTRA_OPTIONS = $(debug_option) $(optimization_options) $(static_option) $(threading_options) $(profiling_options)

# Add help target
.PHONY: help
all:
help:
	@echo "ENABLE_DEBUG=yes (default=no)"
	@echo "BUILD_STATIC=yes (default=no)"
	@echo "ENABLE_THREADING=yes (default=no)"
	@echo "ENABLE_PROFILING=yes (default=no)"
	@echo "ENABLE_OPTIMIZATION=yes (default=yes)"
	@echo "DISABLE_OPTIMIZATION=yes (default=no)"

# ----------------------------------------------------------------------------
# Project specific variables, which are common to each project
project_name = espa-surface-temperature
espa_project_dir = $(prefix)/$(project_name)

# Algorithm specific variables
st_algorithm = st
st_algorithm_dir = $(espa_project_dir)/$(st_algorithm)
st_install_path = $(st_algorithm_dir)/bin
st_link_source_path = ../$(project_name)/$(st_algorithm)/bin
