ifndef __ltp-config_mk__
__ltp-config_mk__ = included

# Required variables

#
# Base vars (needed to picking out where things are, where things go,
# etc).
#

#
# XXX: replace readlink with something more portable. This only works on
# Linux / GNU userland land..
#
prefix			?= /opt/ltp

bindir			?= $(prefix)/bin

libdir			?= $(prefix)/lib

#srcdir			?= $(shell readlink -f $(CUR_DIR) 2>/dev/null)
srcdir			?= $(CURDIR) 

# 
# What and how are we going to build things?
#
ifeq ($(findstring -Wall,$(CFLAGS)),)
CFLAGS			+= -Wall
endif

CROSS_COMPILER_PATH	=

CROSS_COMPILER_PREFIX	=

INCLUDES		=+ -I$(srcdir)/include

LDFLAGS			=

LDLIBS			+= -L$(libdir)

TARGET			=

UCLINUX			?= 0 

#
# Available commands
#
CP			?= $(shell which cp)

INSTALL			?= $(shell which install)

ifneq ($(findstring -,$(INSTALL)),)
# Gnu install(1) uses -D to create dir prefixes.
ifneq ($(findstring gnu,$(shell $(INSTALL)),)
INSTALL			+= -D
# BSD install(1) uses -d to create dir prefixes
else
INSTALL			+= -d
endif
endif

MKDIR			?= $(shell which mkdir)

ifneq ($(findstring -p,$(MKDIR)),)
MKDIR			+= -p
endif

RM			?= $(shell which rm)

ifneq ($(findstring -r,$(RM)),)
RM			+= -r 
endif
#
# END Available commands
#

UCLINUX			?= 0 

# Include additional necessary headers here.

include compiler_detect.mk	# Detect the compiler and set any
				# required vars here which are non-arch
				# specific.

include target_detect.mk	# Set the target arch and any arch
				# specific flags to $(CC).

#
# Export all defined variables for all to use.
#
export AR CC CP CROSS_COMPILER_PATH CFLAGS CXX_FLAGS CROSS_COMPILER_PREFIX
export INSTALL LDFLAGS LDLIBES MKDIR RANLIB RM TARGET_ARCH 

endif
