# CONFIG.Common.cygwin-x86
#
# This file is maintained by the build community.
#
# Definitions for cygwin-x86 target builds
# Sites may override these definitions in CONFIG_SITE.Common.cygwin-x86
#-------------------------------------------------------

# Include definitions common to all Unix targets
include $(CONFIG)/os/CONFIG.Common.UnixCommon

OS_CLASS = cygwin32
ARCH_CLASS = x86

# Link libraries controlled by COMMANDLINE_LIBRARY
# The Cygwin version 1.7.15 needs readline and ncursesw,
# older ones may need readline and curses.
LDLIBS_READLINE_NCURSESW = -lreadline -lncursesw
LDLIBS_READLINE_CURSES = -lreadline -lcurses
LDLIBS_READLINE = -lreadline

POSIX_CPPFLAGS = -D_POSIX_THREADS -D_POSIX_TIMERS
POSIX_LDLIBS += -lpthread

ARCH_DEP_CFLAGS += -m32
ARCH_DEP_LDFLAGS += -m32

# 32-bit compiler defines _X86_ 1
# Compiler defines __CYGWIN__ 1
# 32-bit compiler defines __CYGWIN32__ 1
# Compiler defines __unix__ 1
# Compiler defines __unix 1
# Compiler defines unix 1

# This macro now deprecated, use __CYGWIN__ in the future
OP_SYS_CPPFLAGS += -DCYGWIN32

EXE = .exe

# Use .o for static object files, .obj for shared library object files
OBJ_NO  = .o
OBJ_YES = .obj
OBJ = $(OBJ_$(SHARED_LIBRARIES))

COMPILE.c   += $(if $(filter %$(OBJ),$@),-o $@)
COMPILE.cpp += $(if $(filter %$(OBJ),$@),-o $@)
HDEPENDS_ARCHFLAGS = -MT $*$(OBJ)

BUILD_DLL_CFLAGS_YES = -DEPICS_BUILD_DLL
BUILD_DLL_CFLAGS_NO =
BUILD_DLL_CFLAGS = $(BUILD_DLL_CFLAGS_$(SHARED_LIBRARIES))
STATIC_CFLAGS_YES = $(BUILD_DLL_CFLAGS)
STATIC_CFLAGS_NO  = $(BUILD_DLL_CFLAGS) -DEPICS_CALL_DLL
STATIC_CXXFLAGS_YES = $(BUILD_DLL_CFLAGS)
STATIC_CXXFLAGS_NO  = $(BUILD_DLL_CFLAGS) -DEPICS_CALL_DLL

# Adjust names of libraries to build
#
SHRLIB_PREFIX =
SHRLIB_SUFFIX_BASE = .dll
SHRLIB_SUFFIX = $(SHRLIB_SUFFIX_BASE)
SHRLIBNAME_YES = $(BUILD_LIBRARY:%=%$(SHRLIB_SUFFIX))
TESTSHRLIBNAME_YES = $(TESTBUILD_LIBRARY:%=%$(SHRLIB_SUFFIX_BASE))
LOADABLE_SHRLIBNAME = $(LOADABLE_BUILD_LIBRARY:%=%$(LOADABLE_SHRLIB_SUFFIX))

#
# When SHARED_LIBRARIES is YES we are building a DLL link library 
# When SHARED_LIBRARIES is NO we are building an object library
#
LIB_PREFIX_NO =
LIB_SUFFIX_NO = .lib
LIB_PREFIX_YES = lib
LIB_SUFFIX_YES = .dll.a
LIB_PREFIX = $(LIB_PREFIX_$(SHARED_LIBRARIES))
LIB_SUFFIX = $(LIB_SUFFIX_$(SHARED_LIBRARIES))
DLLSTUB_PREFIX = lib
DLLSTUB_SUFFIX = .dll.a

DLLSTUB_LIBNAME_YES = $(BUILD_LIBRARY:%=$(LIB_PREFIX)%$(LIB_SUFFIX))
DLLSTUB_LIBNAME = $(DLLSTUB_LIBNAME_$(SHARED_LIBRARIES))
TESTDLLSTUB_LIBNAME_YES = $(TESTBUILD_LIBRARY:%=$(LIB_PREFIX)%$(LIB_SUFFIX))
TESTDLLSTUB_LIBNAME = $(TESTDLLSTUB_LIBNAME_$(SHARED_LIBRARIES))
TESTLIBNAME_NO = $(TESTBUILD_LIBRARY:%=$(LIB_PREFIX)%$(LIB_SUFFIX))
TESTLIBNAME = $(TESTLIBNAME_$(SHARED_LIBRARIES))

#	dll install location
INSTALL_SHRLIB = $(INSTALL_BIN)


# Cygwin supports the sunrpc package in versions before 1.7.
# Cygwin supports the tirpc (Transport Independent RPC) package in versions 1.7 and later.
# uname -r return a string like "1.76(0230/5/3)"
CYGWIN_RPC_LIB= $(if $(findstring 1.5,$(shell uname -r)),rpc,tirpc)

