Added shared library (DLL) support.

This commit is contained in:
Janet B. Anderson
2008-08-05 17:47:31 +00:00
parent 5248c4d504
commit bbb4e83f43
4 changed files with 58 additions and 31 deletions

View File

@@ -13,22 +13,15 @@ include $(CONFIG)/os/CONFIG.Common.UnixCommon
OS_CLASS = WIN32
ARCH_CLASS = x86
EXE=.exe
COMPILER_CPPFLAGS = -D_REENTRANT
# Set runtime path for shared libraries
SHRLIBDIR_LDFLAGS += $(SHRLIB_DEPLIB_DIRS:%=-Wl,-rpath,%)
# Set runtime path for products
PRODDIR_LDFLAGS += $(PROD_DEPLIB_DIRS:%=-Wl,-rpath,%)
# Definitions used when COMMANDLINE_LIBRARY is READLINE
INCLUDES_READLINE = -I$(GNU_DIR)/include
LDFLAGS_READLINE += -L$(GNU_DIR)/lib
LDLIBS_READLINE = -lreadline
LDLIBS_READLINE = -lreadline -lcurses
OP_SYS_CXXFLAGS += -D__cplusplus
POSIX_CPPFLAGS = -D_POSIX_THREADS -D_POSIX_TIMERS
#POSIX_CPPFLAGS += -D_POSIX_SOURCE
POSIX_LDLIBS += -lpthread
ARCH_DEP_CFLAGS += -m32
ARCH_DEP_LDFLAGS += -m32
# With no-cygwin option:
# compiler defines _X86_ 1
@@ -42,11 +35,43 @@ OP_SYS_CXXFLAGS += -D__cplusplus
# compiler does not define __unix __unix__ unix
# compiler does not define __CYGWIN__ __CYGWIN32__
# Overrides -DUNIX from CONFIG.Common.UnixCommon
OP_SYS_CPPFLAGS = -mno-cygwin
LIBRARY_LD_RESS=
OP_SYS_LDFLAGS += -mno-cygwin
OP_SYS_LDLIBS = -lws2_32 -ladvapi32 -luser32 -lkernel32 -lwinmm
EXE=.exe
VISC_DLL_NO = -DEPICS_DLL_NO
VISC_DLL_YES =
VISC_DLL = $(VISC_DLL_$(SHARED_LIBRARIES))
STATIC_CFLAGS_YES= $(VISC_DLL)
STATIC_CFLAGS_NO= $(VISC_DLL) -D_DLL
STATIC_CXXFLAGS_YES= $(VISC_DLL)
STATIC_CXXFLAGS_NO= $(VISC_DLL) -D_DLL
# adjust names of libraries to build
#
# But: if there are no objects LIBRARY_LD_OBJS to include
# in this library (may be for e.g. base/src/libCompat
# on some archs), don't define (and build) any library!
SHRLIB_PREFIX=
SHRLIB_SUFFIX=.dll
SHRLIBNAME_YES = $(BUILD_LIBRARY:%=%$(SHRLIB_SUFFIX))
LOADABLE_SHRLIB_PREFIX=
LOADABLE_SHRLIB_SUFFIX=.dll
LOADABLE_SHRLIBNAME = $(LOADABLE_BUILD_LIBRARY:%=%$(LOADABLE_SHRLIB_SUFFIX))
#
# When SHARED_LIBRARIES is YES we are building a DLL link library
# and when SHARED_LIBRARIES is NO we are building an object library
#
LIB_PREFIX=
LIB_SUFFIX=.lib
DLL_LINK_LIBNAME_YES = $(BUILD_LIBRARY:%=%$(LIB_SUFFIX))
DLL_LINK_LIBNAME = $(DLL_LINK_LIBNAME_$(SHARED_LIBRARIES))
LIBNAME_NO = $(BUILD_LIBRARY:%=%$(LIB_SUFFIX))
LIBNAME = $(LIBNAME_$(SHARED_LIBRARIES))
# dll install location
INSTALL_SHRLIB = $(INSTALL_BIN)

View File

@@ -17,3 +17,6 @@ WIND_HOST_TYPE = x86-win32
# osithead use default stack, YES or NO override
OSITHREAD_USE_DEFAULT_STACK = NO
# Needed to find dlls for base installed build tools (antelope,eflex,...)
PATH := $(EPICS_BASE_TOOLS_BIN):$(PATH)

View File

@@ -15,22 +15,23 @@ CCC = g++
AR = ar -rc
LD = ld -r
RANLIB = ranlib
RES=.coff
RCCMD = windres $(INCLUDES) $< $@
# Dont use -fPIC: with -fPIC we get
# "warning: -fPIC ignored for target (all code is position independent) "
# No -fPIC avoids "-fPIC ignored for target (all code is position independent)"
SHRLIB_CFLAGS =
SHRLIB_LDFLAGS = -shared
LOADABLE_SHRLIB_LDFLAGS = -shared
SHRLIB_LDFLAGS = -shared -Wl,--out-implib,$(LIB_PREFIX)$*$(LIB_SUFFIX)
LOADABLE_SHRLIB_LDFLAGS = -shared -Wl,--out-implib,$(LIB_PREFIX)$*$(LIB_SUFFIX)
# Dont use -ansi: -ansi eliminates strdup and _tempnam
CONFORM_CFLAGS_ANSI =
CONFORM_CFLAGS_STRICT = -pedantic
CONFORM_CFLAGS_STRICT = -ansi
CONFORM_CXXFLAGS_NORMAL =
CONFORM_CXXFLAGS_STRICT = -pedantic
CONFORM_CXXFLAGS_STRICT = -ansi
# Override linking with gcc library
# -ansi build errors need fixing: u_long undeclared, fd_set with no type
CONFORM_CFLAGS_STRICT =
CONFORM_CXXFLAGS_STRICT =
# Override linking with gcc library from CONFIG.gnuCommon
GNU_LDLIBS_YES =
#RES=.coff
#RCCMD = windres -O coff $(INCLUDES) $< $@

View File

@@ -1,4 +1,2 @@
# Shared libraries are not yet supported in cygwin builds.
SHARED_LIBRARIES=NO