Initial version of shared library support

This commit is contained in:
Janet B. Anderson
1998-04-16 22:39:10 +00:00
parent b5290a8f11
commit 69c5f8749c
10 changed files with 92 additions and 31 deletions
+14 -2
View File
@@ -13,8 +13,15 @@ RANLIB = ranlib -t
# Configure OS vendor C compiler
ACC = acc
ACC_ANSI = $(ACC)
ACC_STRICT = $(ACC) -Xc
#ACC_ANSI = $(ACC)
ACC_ANSI = $(ACC) -ansi -D_SVID_SOURCE
#ACC_STRICT = $(ACC) -Xc
ACC_STRICT = $(ACC) -ansi -pedantic -D_SVID_SOURCE
OP_SYS_FLAGS = -D_BSD_SOURCE -D_POSIX_SOURCE
ACC_TRAD = $(ACC)
ACC_WARN_YES =
ACC_WARN_NO = -w
@@ -24,6 +31,10 @@ ACC_SFLAGS_YES = -Bstatic
ACC_SFLAGS_NO=
ACC_SLIBS_YES =
ACC_SLIBS_NO=
ACC_SHRLIB_CFLAGS_YES = -fPIC
#ACC_SHRLIB_CFLAGS_YES = -fPIC -D_BSD_SOURCE
ACC_SHRLIB_LDFLAGS_YES = -shared -Wl,-soname,$@
# Configure OS vendor C++ compiler
CCC = CC
@@ -40,6 +51,7 @@ CCC_SLIBS_YES =
CCC_SLIBS_NO=
CCC_DEPENDS_FLAG = -MM
ARCH_DEP_CFLAGS = -D_X86_ -Dlinux
ARCH_DEP_LDFLAGS =
+10 -11
View File
@@ -13,24 +13,23 @@
LIBNAME = $(LIBRARY:%=lib%.a)
#-------------------------------------------------------
# EPICS libs that we need to link the DLL with
DLL_DEPLIBS = $(DLL_LIBS:%=$(firstword $(%_DIR) $(EPICS_BASE_LIB))/lib%.a)
DLL_LDLIBS = $(DLL_DEPLIBS) $(SYS_PROD_LIBS:%=lib%.a) $(OP_SYS_LDLIBS)
$(ARCH_DEP_LDLIBS)
# Shared library definitions
#-------------------------------------------------------
# A NOOP on all UNIX systems that dont implement
# shared libraries
#
#DLLNAME = lib$(LIBRARY).???
LINK.dll = echo share lib build for UNIX archictecture is a NOOP
# CONFIG.Host.<arch> files may override
SHRLIB_SUFFIX = .so
SHRLIB_VERSION = .$(EPICS_VERSION).$(EPICS_REVISION)
SHRLIBNAME = lib$(LIBRARY)$(SHRLIB_SUFFIX)$(SHRLIB_VERSION)
SHRLIB_CFLAGS = $($(ANSI)_SHRLIB_CFLAGS_$(SHARED_LIBRARIES))
SHRLIB_LDFLAGS = $($(ANSI)_SHRLIB_LDFLAGS_$(SHARED_LIBRARIES))
LINK.dll= $(SHRLIB_LINKER) -o $@ $(CFLAGS) $(CPPFLAGS) $(SHRLIB_LDFLAGS) $(LDFLAGS)
#-------------------------------------------------------
# Unix command definitions
CPP = cpp
RANLIB = ranlib
LD = ld -r
# GNU compilers
GCC = gcc
+2
View File
@@ -23,6 +23,8 @@ ACC_SFLAGS_YES= -non_shared
ACC_SFLAGS_NO= -call_shared
ACC_SLIBS_YES =
ACC_SLIBS_NO=
ACC_SHRLIB_CFLAGS_YES =
ACC_SHRLIB_LDFLAGS_YES =
# Configure OS vendor C++ compiler
CCC = cxx
+1 -1
View File
@@ -22,6 +22,6 @@ CPLUSPLUS=
#OP_SYS_INCLUDES += /usr/local/include/g++
#==========================
ARCH_DEP_CFLAGS = -DCYGWIN32
ARCH_DEP_CFLAGS = -DCYGWIN32 -U_WIN32
ARCH_DEP_LDLIBS = -lm
+6
View File
@@ -7,6 +7,8 @@ ARCH_CLASS = hp700
# Include definitions common to all Unix archs
include $(EPICS_BASE)/config/CONFIG.Host.UnixCommon
SHRLIB_SUFFIX = .sl
AR = ar
@@ -23,6 +25,8 @@ ACC_SFLAGS_YES= -Wl,-a,archive
ACC_SFLAGS_NO=
ACC_SLIBS_YES =
ACC_SLIBS_NO=
ACC_SHRLIB_CFLAGS_YES = +Z
ACC_SHRLIB_LDFLAGS_YES = -b
# Configure OS vendor C++ compiler
HPCC = cc
@@ -37,6 +41,8 @@ HPCC_SFLAGS_YES= -Wl,-a,archive
HPCC_SFLAGS_NO=
HPCC_SLIBS_YES =
HPCC_SLIBS_NO=
HPCC_SHRLIB_CFLAGS_YES = +Z
HPCC_SHRLIB_LDFLAGS_YES = -b
CCC = CC
CCC_NORMAL = $(CCC) +p
+2
View File
@@ -23,6 +23,8 @@ ACC_SFLAGS_YES= -Bstatic
ACC_SFLAGS_NO=
ACC_SLIBS_YES =
ACC_SLIBS_NO=
ACC_SHRLIB_CFLAGS_YES = -KPIC
ACC_SHRLIB_LDFLAGS_YES = -shared
# Configure OS vendor C++ compiler
CCC = CC
+2
View File
@@ -34,6 +34,8 @@ ACC_SFLAGS_YES= -Bstatic
ACC_SFLAGS_NO=
ACC_SLIBS_YES= -lw -lintl -Bdynamic -ldl -Bstatic -lXext -lX
ACC_SLIBS_NO=
ACC_SHRLIB_CFLAGS_YES = -Kpic -D_REENTRANT
ACC_SHRLIB_LDFLAGS_YES = -G -h $@
# Configure OS vendor C++ compiler
CCC = $(SPARCWORKS)/bin/CC
+4
View File
@@ -34,6 +34,8 @@ ACC_SFLAGS_NO=
ACC_SLIBS_YES=
ACC_SLIBS_NO=
#ACC_OP_SYS_LDFLAGS = -L$(SPECIAL_LANG)
ACC_SHRLIB_CFLAGS_YES = -pic
ACC_SHRLIB_LDFLAGS_YES = -assert pure-text -h $@
SUNCC = cc
SUNCC_ANSI = echo SUNCC_ANSI not defined
@@ -47,6 +49,8 @@ SUNCC_SFLAGS_YES= -Bstatic
SUNCC_SFLAGS_NO=
SUNCC_SLIBS_YES=
SUNCC_SLIBS_NO=
SUNCC_SHRLIB_CFLAGS_YES = -pic
SUNCC_SHRLIB_LDFLAGS_YES = -assert pure-text -h $@
# Configure OS vendor C++ compiler
CCC = /usr/lang/CC
+10 -1
View File
@@ -97,7 +97,16 @@ CMPLR=STRICT
# NORMAL - ANSI C++ optional warning flags
# Individual Makefiles may override
CXXCMPLR=STRICT
# Build shared libraries? (Unix type Host builds only)
# (archive libraries will also be built)
# must be either YES or NO
#
# NOTE solaris and sun4: If YES then LD_LIBRARY_PATH must
# include $(INSTALL_LOCATION)/lib/$(HOST_ARCH) both
# for the base build and when invoking base executables
SHARED_LIBRARIES=NO
# Build client objects statically ?
# must be either YES or NO
STATIC_BUILD=NO
+41 -16
View File
@@ -230,6 +230,7 @@ INCREC +=$(RECTYPES) $(MENUS)
INSTALL_PROD= $(PROD:%= $(INSTALL_BIN)/%)
INSTALL_LIBS= $(LIBNAME:%=$(INSTALL_LIB)/%)
INSTALL_SHRLIBS= $(SHRLIBNAME:%=$(INSTALL_LIB)/%)
INSTALL_DLLS=$(DLLNAME:%=$(INSTALL_BIN)/%)
INSTALL_TCLLIBS=$(TCLLIBNAME:%=$(INSTALL_TCLLIB)/%)
INSTALL_TCLINDEX=$(TCLINDEX:%=$(INSTALL_TCLLIB)/%)
@@ -266,12 +267,20 @@ DIRECTORY_TARGETS = $(INSTALL_INCLUDE) $(INSTALL_INCLUDE)/os \
$(INSTALL_LOCATION_BIN) $(INSTALL_BIN) $(INSTALL_LIB) \
$(INSTALL_LOCATION_LIB) $(INSTALL_CONFIG) \
$(MAN_DIRECTORY_TARGETS) $(INSTALL_MAN) \
$(INSTALL_TEMPLATES)
$(INSTALL_TEMPLATES)
ifdef TEMPLATES_DIR
DIRECTORY_TARGETS += $(INSTALL_TEMPLATES)/$(TEMPLATES_DIR)
endif
#---------------------------------------------------------------
# must use c++ linker if linking to shared libs with c++ code
ifeq ($(strip $(SHARED_LIBRARIES)),YES)
ifneq ($(strip $(CPLUSPLUS)),)
LINK.c = $(LINK.cc)
endif # CPLUSPLUS
endif # LIBTYPE
#---------------------------------------------------------------
# if there are no objects LIBOBJS to include
# in this library (may be for e.g. base/src/libCompat
@@ -279,31 +288,35 @@ endif
ifdef LIBRARY
ifdef LIBOBJS
LIBTARGETS = $(INSTALL_LOCATION_LIB) $(INSTALL_LIB)
# check if DLL or plain lib requested:
ifeq ($(LIBTYPE),SHARED)
LIBTARGETS += $(LIBNAME) $(INSTALL_LIBS)
# check if DLL or plain lib requested: (Win32 build)
ifeq ($(strip $(LIBTYPE)),SHARED)
#
# LIBTYPE=="SHARED" indicates build
# DLL and also build object archive library
#
LIBTARGETS += $(DLLNAME) $(INSTALL_DLLS) $(LIBNAME) $(INSTALL_LIBS)
else # LIBTYPE=SHARED
#
# otherwise build only object archive library
#
LIBTARGETS += $(LIBNAME) $(INSTALL_LIBS)
LIBTARGETS += $(DLLNAME) $(INSTALL_DLLS)
endif # LIBTYPE=SHARED
# check if shared library requested: (Unix type build)
ifeq ($(strip $(SHARED_LIBRARIES)),YES)
CFLAGS += $(SHRLIB_CFLAGS)
CXXFLAGS += $(SHRLIB_CFLAGS)
ifeq ($(findstring cc,$(suffix $(LIBSRCS))),cc)
SHRLIB_LINKER = $(CXX)
else
SHRLIB_LINKER = $(CC)
endif
LIBTARGETS += $(SHRLIBNAME) $(INSTALL_SHRLIBS)
endif # SHARED_LIBRARIES=YES
endif # LIBOBJS
#
# by default the libraries used when linking the DLL are just
# PROD_LIBS ans SYS_PROD_LIBS minus the DLL name
DLL_LIBS = $(subst $(LIBRARY),, $(PROD_LIBS))
endif # LIBRARY
#---------------------------------------------------------------
# Main targets
#
all:: install
build:: $(LIBTARGETS) $(PROD) $(TESTPROD) \
@@ -418,6 +431,7 @@ $(TESTPROD): $(TESTPROD_OBJS) $(PRODDEPLIBS)
$(TESTPROD_LINKER) $(TESTPROD_OBJS) $(LDLIBS)
endif
#---------------------------------------------------------------
# Generic Rules for 'simple' targets that
# can be generated from a single source with same basename.
@@ -569,6 +583,9 @@ $(DBDNAME): ../$(DBDEXPAND)
$(DLLNAME): $(LIBOBJS)
$(LINK.dll) $(LIBOBJS) $(DLL_LDLIBS)
$(SHRLIBNAME): $(LIBOBJS)
$(LINK.dll) $(LIBOBJS)
# rule for lib (archive of object files) creation
$(LIBNAME): $(LIBOBJS)
$(RM) $@
@@ -600,6 +617,14 @@ $(INSTALL_LIB)/%.lib: %.lib
@echo "Installing library $@"
@$(INSTALL) -m 644 $< $(INSTALL_LIB)
$(INSTALL_SHRLIBS): $(SHRLIBNAME)
@echo "Installing library $@"
$(INSTALL) -m 644 $< $(INSTALL_LIB)
ifdef SHRLIB_VERSION
$(RM) $(subst $(SHRLIB_VERSION),,$@)
ln -s $< $(subst $(SHRLIB_VERSION),,$@)
endif # SHRLIB_VERSION
$(INSTALL_TCLLIB)/%: %
@echo "Installing Tcl library $@"
@$(INSTALL) -m 555 $< $(INSTALL_TCLLIB)