From 97490f6977860966df346e3a2c6f15938ef4695f Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Fri, 27 Jul 2012 16:24:39 -0500 Subject: [PATCH] Reworking of DLL build rules. Allows static libraries and DLLs to be built without having to do a 'make clean' in between on Cygwin and MinGW targets. The Cygwin build still crashes when SHARED_LIBRARIES = YES though, loading Com.dll seems to cause the problem. --- configure/CONFIG.gnuCommon | 8 +- configure/CONFIG_COMMON | 28 +++--- configure/RULES_BUILD | 60 +++++++------ configure/RULES_TARGET | 39 ++++---- configure/os/CONFIG.Common.UnixCommon | 50 ++++++----- configure/os/CONFIG.Common.cygwin-x86 | 54 ++++++----- configure/os/CONFIG.Common.iosCommon | 2 +- configure/os/CONFIG.Common.vxWorksCommon | 15 ++-- configure/os/CONFIG.Common.win32-x86-cygwin | 55 +++++++----- configure/os/CONFIG.Common.win32-x86-mingw | 54 ++++++----- configure/os/CONFIG.darwinCommon.darwinCommon | 2 +- .../os/CONFIG.solarisCommon.solarisCommon | 4 +- .../os/CONFIG.win32-x86-mingw.win32-x86-mingw | 6 +- configure/os/CONFIG.win32-x86.win32-x86 | 89 +++++++++---------- .../os/CONFIG_SITE.Common.win32-x86-mingw | 5 +- src/ca/legacy/gdd/Makefile | 37 ++++---- src/libCom/misc/shareLib.h | 59 ++++++------ src/libCom/osi/os/WIN32/osdThread.c | 2 +- 18 files changed, 305 insertions(+), 264 deletions(-) diff --git a/configure/CONFIG.gnuCommon b/configure/CONFIG.gnuCommon index 94d1286e0..8e99e9c54 100644 --- a/configure/CONFIG.gnuCommon +++ b/configure/CONFIG.gnuCommon @@ -50,10 +50,12 @@ STATIC_LDFLAGS_YES = -static STATIC_LDFLAGS_NO = SHRLIB_CFLAGS = -fPIC -SHRLIB_LDFLAGS = -shared -fPIC +SHRLIB_LDFLAGS = -shared -fPIC LOADABLE_SHRLIB_LDFLAGS = -shared -fPIC GNU_LDLIBS_YES = -lgcc -# Use GNU compiler flags to generate header dependancies files -HDEPENDS_METHOD = CFLAGS +# Use compiler flags to generate header dependancies files +HDEPENDS_METHOD = COMP +HDEPENDS_COMPFLAGS = -MM -MF $@ + diff --git a/configure/CONFIG_COMMON b/configure/CONFIG_COMMON index 3205704d4..8c361dda1 100644 --- a/configure/CONFIG_COMMON +++ b/configure/CONFIG_COMMON @@ -126,6 +126,13 @@ CMPLR_PREFIX= LIB_PREFIX= SHRLIB_PREFIX= $(LIB_PREFIX) +BUILDLIB_PREFIX_YES = $(DLLSTUB_PREFIX) +BUILDLIB_PREFIX_NO = $(LIB_PREFIX) +BUILDLIB_SUFFIX_YES = $(DLLSTUB_SUFFIX) +BUILDLIB_SUFFIX_NO = $(LIB_SUFFIX) +BUILDLIB_PREFIX = $(BUILDLIB_PREFIX_$(SHARED_LIBRARIES)) +BUILDLIB_SUFFIX = $(BUILDLIB_SUFFIX_$(SHARED_LIBRARIES)) + #-------------------------------------------------- # vpath directories POSIX_YES = os/posix @@ -311,8 +318,8 @@ LEXOPT += -I # Build compile line here PATH_FILTER = $(1) -COMPILE.c = $(CC) -c $(CPPFLAGS) $(CFLAGS) $(INCLUDES) -COMPILE.cpp = $(CCC) -c $(CPPFLAGS) $(CXXFLAGS) $(INCLUDES) +COMPILE.c = $(CC) $(CPPFLAGS) $(CFLAGS) $(INCLUDES) +COMPILE.cpp = $(CCC) $(CPPFLAGS) $(CXXFLAGS) $(INCLUDES) #-------------------------------------------------- # C preprocessor command @@ -323,16 +330,15 @@ PREPROCESS.cpp = $(CPP) $(CPPFLAGS) $(INCLUDES) $< > $@ HDEPENDS_METHOD = MKMF -HDEPENDS_INCLUDES = $(subst -I,,$(INCLUDES)) -HDEPENDSFLAGS = -m $*$(DEP) $(HDEPENDS_INCLUDES) $@ $< +HDEPENDS_MKMFFLAGS = -m $*$(DEP) $(subst -I,,$(INCLUDES)) $@ +HDEPENDS_MKMF.c = $(MKMF) $(HDEPENDS_FLAGS) $(HDEPENDS_MKMFFLAGS) +HDEPENDS_MKMF.cpp = $(MKMF) $(HDEPENDS_FLAGS) $(HDEPENDS_MKMFFLAGS) -HDEPENDS_MKMF = $(MKMF) $(HDEPENDS_FLAGS) $(HDEPENDSFLAGS) +HDEPENDS_COMP.c = $(COMPILE.c) $(HDEPENDS_COMPFLAGS) $(HDEPENDS_ARCHFLAGS) +HDEPENDS_COMP.cpp = $(COMPILE.cpp) $(HDEPENDS_COMPFLAGS) $(HDEPENDS_ARCHFLAGS) -HDEPENDSCFLAGS = -MM > $*$(DEP) -HDEPSUFFIX = $(if $(filter .c,$(suffix $<)),.c,.cpp) -HDEPENDS_CFLAGS = $(COMPILE$(HDEPSUFFIX)) $(HDEPENDSCFLAGS) $< - -HDEPENDS_CMD = $(HDEPENDS_$(HDEPENDS_METHOD)) +HDEPENDS.c = $(HDEPENDS_$(HDEPENDS_METHOD).c) +HDEPENDS.cpp = $(HDEPENDS_$(HDEPENDS_METHOD).cpp) #-------------------------------------------------- # depends definition @@ -352,7 +358,7 @@ INSTALL_LIBS= $(LIBNAME:%=$(INSTALL_LIB)/%) INSTALL_MUNCHS= $(MUNCHNAME:%=$(INSTALL_BIN)/%) INSTALL_SHRLIBS= $(SHRLIBNAME:%=$(INSTALL_SHRLIB)/%) INSTALL_LOADABLE_SHRLIBS= $(LOADABLE_SHRLIBNAME:%=$(INSTALL_SHRLIB)/%) -INSTALL_DLL_LINK_LIBS=$(DLL_LINK_LIBNAME:%=$(INSTALL_LIB)/%) +INSTALL_DLLSTUB_LIBS=$(DLLSTUB_LIBNAME:%=$(INSTALL_LIB)/%) INSTALL_TCLLIBS=$(TCLLIBNAME:%=$(INSTALL_TCLLIB)/%) INSTALL_TCLINDEX=$(TCLINDEX:%=$(INSTALL_TCLLIB)/%) INSTALL_SCRIPTS = $(SCRIPTS:%= $(INSTALL_BIN)/%) diff --git a/configure/RULES_BUILD b/configure/RULES_BUILD index 8dcea4f94..38983c853 100644 --- a/configure/RULES_BUILD +++ b/configure/RULES_BUILD @@ -106,7 +106,7 @@ endif LIBTARGETS += $(LIBNAME) $(INSTALL_LIBS) $(TESTLIBNAME) \ $(SHRLIBNAME) $(INSTALL_SHRLIBS) $(TESTSHRLIBNAME) \ - $(DLL_LINK_LIBNAME) $(INSTALL_DLL_LINK_LIBS) $(TESTDLL_LINK_LIBNAME) \ + $(DLLSTUB_LIBNAME) $(INSTALL_DLLSTUB_LIBS) $(TESTDLLSTUB_LIBNAME) \ $(LOADABLE_SHRLIBNAME) $(INSTALL_LOADABLE_SHRLIBS) @@ -145,7 +145,7 @@ build_clean: $(ECHO) "Cleaning" @$(RM) *.i *$(OBJ) *.a $(TESTPRODNAME) \ $(LIBNAME) $(TESTLIBNAME) $(SHRLIBNAME) $(TESTSHRLIBNAME) \ - $(DLL_LINK_LIBNAME) $(TESTDLL_LINK_LIBNAME) \ + $(DLLSTUB_LIBNAME) $(TESTDLLSTUB_LIBNAME) \ $(LOADABLE_SHRLIBNAME) \ $(INC) $(TARGETS) $(TDS) $(CLEANS) \ *.out MakefileInclude *.manifest *.exp \ @@ -204,27 +204,27 @@ $(OBJLIBNAME):%$(OBJ): %$(DEP):%.c @$(RM) $@ - @$(HDEPENDS_CMD) + $(HDEPENDS.c) $< %$(DEP):%.cc @$(RM) $@ - @$(HDEPENDS_CMD) + $(HDEPENDS.cpp) $< %$(DEP):%.cpp @$(RM) $@ - @$(HDEPENDS_CMD) + $(HDEPENDS.cpp) $< %$(OBJ): %.c @$(RM) $@ - $(COMPILE.c) $< + $(COMPILE.c) -c $< %$(OBJ): %.cc @$(RM) $@ - $(COMPILE.cpp) $< + $(COMPILE.cpp) -c $< %$(OBJ): %.cpp @$(RM) $@ - $(COMPILE.cpp) $< + $(COMPILE.cpp) -c $< # WIN95/NT resource compiler %$(RES): %.rc @@ -269,54 +269,59 @@ $(LIB_BAF): $(addsuffix $(BOF),$(basename $(LIBRARY_LD_OBJS))) endif +#--------------------------------------------------------------- +# Libraries, shared/DLL and stubs + $(LIBNAME) $(TESTLIBNAME): $(LIBRARY_OBJS) -$(DLL_LINK_LIBNAME) $(TESTDLL_LINK_LIBNAME): $(LIBRARY_OBJS) $(LIBRARY_RESS) $(SHRLIB_DEPLIBS) - -$(LIBNAME) $(TESTLIBNAME) $(DLL_LINK_LIBNAME) $(TESTDLL_LINK_LIBNAME): $(LIB_PREFIX)%$(LIB_SUFFIX): +$(LIBNAME) $(TESTLIBNAME): $(LIB_PREFIX)%$(LIB_SUFFIX): @$(RM) $@ $(ARCMD) ifneq ($(strip $(RANLIB)),) $(RANLIB) $@ endif # RANLIB -$(SHRLIBNAME) $(TESTSHRLIBNAME): $(LIBRARY_OBJS) $(LIBRARY_RESS) $(SHRLIB_DEPLIBS) +$(SHRLIBNAME) $(DLLSTUB_LIBNAME) $(TESTSHRLIBNAME) $(TESTDLLSTUB_LIBNAME): \ + $(LIBRARY_OBJS) $(LIBRARY_RESS) $(SHRLIB_DEPLIBS) -$(SHRLIBNAME) $(TESTSHRLIBNAME):$(SHRLIB_PREFIX)%$(SHRLIB_SUFFIX): - @$(RM) $@ +$(SHRLIBNAME) $(TESTSHRLIBNAME): $(SHRLIB_PREFIX)%$(SHRLIB_SUFFIX): + $(RM) $@ $(LINK.shrlib) -ifeq ($(SHRLIB_SUFFIX),.dll) $(MT_DLL_COMMAND) -endif $(LOADABLE_SHRLIBNAME): $(LIBRARY_OBJS) $(LIBRARY_RESS) $(SHRLIB_DEPLIBS) -$(LOADABLE_SHRLIBNAME):$(LOADABLE_SHRLIB_PREFIX)%$(LOADABLE_SHRLIB_SUFFIX): +$(LOADABLE_SHRLIBNAME): $(LOADABLE_SHRLIB_PREFIX)%$(LOADABLE_SHRLIB_SUFFIX): @$(RM) $@ $(LINK.shrlib) $(MT_DLL_COMMAND) +#--------------------------------------------------------------- # C++ munching for VxWorks -%.nm : %$(EXE) + +%.nm: %$(EXE) @$(RM) $@ $(NM) $< > $@ -%.nm : %$(OBJ) +%.nm: %$(OBJ) @$(RM) $@ $(NM) $< > $@ -%_ctdt.c : %.nm +%_ctdt.c: %.nm @$(RM) $@ $(PERL) $(TOOLS)/munch.pl -o $@ $< -$(MUNCHNAME):%$(MUNCH_SUFFIX) : $(MUNCH_DEPENDS) %$(EXE) +$(MUNCHNAME): %$(MUNCH_SUFFIX): $(MUNCH_DEPENDS) %$(EXE) @$(RM) $@ $(MUNCH_CMD) -$(OBJLIB_MUNCHNAME):%.munch : %_ctdt$(OBJ) %$(OBJ) +$(OBJLIB_MUNCHNAME): %.munch: %_ctdt$(OBJ) %$(OBJ) @$(RM) $@ $(MUNCH_CMD) +#--------------------------------------------------------------- +# Automated testing + runtests: $(TESTSCRIPTS_$(BUILD_CLASS)) -$(PERL) -MTest::Harness -e 'runtests @ARGV if @ARGV;' $^ @@ -340,7 +345,8 @@ testspec: $(TESTSCRIPTS_$(BUILD_CLASS)) @$(PERL) $(TOOLS)/makeTestfile.pl $@ $< #--------------------------------------------------------------- -## Install rules for BIN_INSTALLS and LIB_INSTALLS +# Install rules for BIN_INSTALLS and LIB_INSTALLS + define BIN_INSTALLS_template $$(INSTALL_BIN)/$$(notdir $(1)) : $(1) $(ECHO) "Installing $$( $*$(DEP) +HDEPENDS_METHOD = COMP +HDEPENDS_COMPFLAGS = -xM1 -xMF $@ #-------------------------------------------------- # Allow site overrides diff --git a/configure/os/CONFIG.win32-x86-mingw.win32-x86-mingw b/configure/os/CONFIG.win32-x86-mingw.win32-x86-mingw index 8309f8b45..0389a4043 100644 --- a/configure/os/CONFIG.win32-x86-mingw.win32-x86-mingw +++ b/configure/os/CONFIG.win32-x86-mingw.win32-x86-mingw @@ -20,8 +20,10 @@ RCCMD = windres $(INCLUDES) $< $@ # No -fPIC avoids "-fPIC ignored for target (all code is position independent)" SHRLIB_CFLAGS = -SHRLIB_LDFLAGS = -shared -Wl,--out-implib,$(LIB_PREFIX)$*$(LIB_SUFFIX) -LOADABLE_SHRLIB_LDFLAGS = -shared -Wl,--out-implib,$(LIB_PREFIX)$*$(LIB_SUFFIX) +SHRLIB_LDFLAGS = -shared \ + -Wl,--out-implib,$(DLLSTUB_PREFIX)$*$(DLLSTUB_SUFFIX) +LOADABLE_SHRLIB_LDFLAGS = -shared \ + -Wl,--out-implib,$(DLLSTUB_PREFIX)$*$(DLLSTUB_SUFFIX) # Override linking with gcc library from CONFIG.gnuCommon GNU_LDLIBS_YES = diff --git a/configure/os/CONFIG.win32-x86.win32-x86 b/configure/os/CONFIG.win32-x86.win32-x86 index b7bfe6892..ded55356e 100644 --- a/configure/os/CONFIG.win32-x86.win32-x86 +++ b/configure/os/CONFIG.win32-x86.win32-x86 @@ -70,14 +70,14 @@ OBJ_CFLAG = -Fo # -MTd static multithreaded C RTL (debug version) # -MD multithreaded C RTL in DLL # -MDd multithreaded C RTL in DLL (debug version) -VISC_DLL_NO = -DEPICS_DLL_NO -VISC_DLL_YES = -VISC_DLL = $(VISC_DLL_$(SHARED_LIBRARIES)) -VISC_STATIC_CFLAGS_DEBUG_NO = d -VISC_STATIC_CFLAGS_DEBUG_YES = -VISC_STATIC_CFLAGS_DEBUG = $(VISC_STATIC_CFLAGS_DEBUG_$(HOST_OPT)) -STATIC_CFLAGS_YES= -MT$(VISC_STATIC_CFLAGS_DEBUG) $(VISC_DLL) -STATIC_CFLAGS_NO= -MD$(VISC_STATIC_CFLAGS_DEBUG) $(VISC_DLL) +BUILD_DLL_CFLAGS_NO = +BUILD_DLL_CFLAGS_YES = -DEPICS_BUILD_DLL +BUILD_DLL_CFLAGS = $(BUILD_DLL_CFLAGS_$(SHARED_LIBRARIES)) +VISC_CFLAGS_DEBUG_NO = d +VISC_CFLAGS_DEBUG_YES = +VISC_CFLAGS_DEBUG = $(VISC_CFLAGS_DEBUG_$(HOST_OPT)) +STATIC_CFLAGS_YES= -MT$(VISC_CFLAGS_DEBUG) $(BUILD_DLL_CFLAGS) +STATIC_CFLAGS_NO= -MD$(VISC_CFLAGS_DEBUG) $(BUILD_DLL_CFLAGS) -DEPICS_CALL_DLL # OS vendor c preprocessor CPP = cl -C -E @@ -135,8 +135,8 @@ OBJ_CXXFLAG = -Fo # -MTd static multithreaded C RTL (debug version) # -MD multithreaded C RTL in DLL # -MDd multithreaded C RTL in DLL (debug version) -STATIC_CXXFLAGS_YES= -MT$(VISC_STATIC_CFLAGS_DEBUG) $(VISC_DLL) -STATIC_CXXFLAGS_NO= -MD$(VISC_STATIC_CFLAGS_DEBUG) $(VISC_DLL) +STATIC_CXXFLAGS_YES= -MT$(VISC_CFLAGS_DEBUG) $(BUILD_DLL_CFLAGS) +STATIC_CXXFLAGS_NO= -MD$(VISC_CFLAGS_DEBUG) $(BUILD_DLL_CFLAGS) -DEPICS_CALL_DLL STATIC_LDLIBS_YES=ws2_32.lib advapi32.lib user32.lib kernel32.lib winmm.lib STATIC_LDLIBS_NO= @@ -177,11 +177,6 @@ COMPILER_CXXFLAGS = -TP OP_SYS_CFLAGS = OP_SYS_CXXFLAGS = $(COMPILER_CXXFLAGS) -# -# WIN32 specific include files -# -#OP_SYS_INCLUDES = -I$(INSTALL_INCLUDE)\\os\\WIN32 - # Files and flags needed to link DLLs (used in RULES_BUILD) # # Strange but seems to work without: WIN32_DLLFLAGS should contain @@ -199,19 +194,16 @@ DLL_DEF_FLAG = $(addprefix -def:,$(wildcard ../$(addsuffix .def,$*))) # # A WIN32 dll has three parts: # x.dll: the real dll (SHRLIBNAME) -# x.lib: what you link to progs that use the dll (DLL_LINK_LIBNAME) +# x.lib: what you link to progs that use the dll (DLLSTUB_LIBNAME) # x.exp: what you need to build the dll (in no variable) # LINK.shrlib = $(WINLINK) -nologo $(WIN32_DLLFLAGS) -implib:$*.lib -out:$*.dll \ $(DLL_DEF_FLAG) $(LIBRARY_LD_OBJS) $(LIBRARY_LD_RESS) $(SHRLIB_LDLIBS) -MUNCH_CMD = $(CCC) -Fo $@ $^ +#MUNCH_CMD = $(CCC) -Fo $@ $^ # 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_SUFFIX_BASE = .dll SHRLIB_SUFFIX = $(SHRLIB_SUFFIX_BASE) SHRLIBNAME_YES = $(BUILD_LIBRARY:%=%$(SHRLIB_SUFFIX)) @@ -222,10 +214,11 @@ TESTSHRLIBNAME_YES = $(TESTBUILD_LIBRARY:%=%$(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 # -DLL_LINK_LIBNAME_YES = $(BUILD_LIBRARY:%=%.lib) -DLL_LINK_LIBNAME = $(DLL_LINK_LIBNAME_$(SHARED_LIBRARIES)) -TESTDLL_LINK_LIBNAME_YES = $(TESTBUILD_LIBRARY:%=%.lib) -TESTDLL_LINK_LIBNAME = $(TESTDLL_LINK_LIBNAME_$(SHARED_LIBRARIES)) +DLLSTUB_LIBNAME_YES = $(BUILD_LIBRARY:%=%.lib) +DLLSTUB_LIBNAME = $(DLLSTUB_LIBNAME_$(SHARED_LIBRARIES)) +TESTDLLSTUB_LIBNAME_YES = $(TESTBUILD_LIBRARY:%=%.lib) +TESTDLLSTUB_LIBNAME = $(TESTDLLSTUB_LIBNAME_$(SHARED_LIBRARIES)) + LIB_PREFIX= LIB_SUFFIX=.lib LIBNAME_NO = $(BUILD_LIBRARY:%=%.lib) @@ -240,42 +233,42 @@ INSTALL_SHRLIB = $(INSTALL_BIN) #-------------------------------------------------- # Products dependancy definitions -# SYS_PROD_LIBS deprecated -# Use PROD_SYS_LIBS - -PROD_DEPLIBS=$(foreach lib, $(PROD_LIBS) $(USR_LIBS), \ - $(firstword $(wildcard $(addsuffix /$(LIB_PREFIX)$(lib)$(LIB_SUFFIX), \ - $($(lib)_DIR) $(SHRLIB_SEARCH_DIRS))) \ - $(addsuffix /$(LIB_PREFIX)$(lib)$(LIB_SUFFIX), \ - $(firstword $($(lib)_DIR) $(INSTALL_LIB))))) +PROD_DEPLIBS = $(foreach lib, $(PROD_LIBS) $(USR_LIBS), \ + $(firstword $(wildcard \ + $(addsuffix /$(SHRLIB_PREFIX)$(lib)*$(SHRLIB_SUFFIX_BASE)*, \ + $($(lib)_DIR) $(SHRLIB_SEARCH_DIRS)) \ + $(addsuffix /$(DLLSTUB_PREFIX)$(lib)$(DLLSTUB_SUFFIX), \ + $($(lib)_DIR) $(SHRLIB_SEARCH_DIRS)) \ + $(addsuffix /$(LIB_PREFIX)$(lib)$(LIB_SUFFIX), \ + $($(lib)_DIR) $(SHRLIB_SEARCH_DIRS))) \ + $(addsuffix /$(BUILDLIB_PREFIX)$(lib)$(BUILDLIB_SUFFIX), $(INSTALL_LIB)))) PROD_LDLIBS += $($*_DEPLIBS) $(PROD_DEPLIBS) PROD_LDLIBS += $(addsuffix .lib, \ - $($*_SYS_LIBS) $(PROD_SYS_LIBS) $(USR_SYS_LIBS) ) + $($*_SYS_LIBS) $(PROD_SYS_LIBS) $(USR_SYS_LIBS)) LDLIBS_STATIC_YES = LDLIBS LDLIBS_SHARED_NO = LDLIBS -PROD_LDLIBS += $(STATIC_LDLIBS) $($(firstword $(LDLIBS_STATIC_$(STATIC_BUILD)) \ - $(LDLIBS_SHARED_$(SHARED_LIBRARIES)))) +PROD_LDLIBS += $(STATIC_LDLIBS) \ + $($(firstword $(LDLIBS_STATIC_$(STATIC_BUILD)) \ + $(LDLIBS_SHARED_$(SHARED_LIBRARIES)))) #-------------------------------------------------- -#Libraries dependancy definitions - -# _DLL_LIBS _SYS_DLL_LIBS deprecated. -# Use _LIBS and _SYS_LIBS. -# DLL_LIBS, and SYS_DLL_LIBS deprecated -# Use LIB_LIBS and LIB_SYS_LIBS -LIB_LIBS += $(DLL_LIBS) -LIB_SYS_LIBS += $(SYS_DLL_LIBS) +# Libraries dependancy definitions # libs that we need to link the DLL with # (it isnt necessary to rebuild the dll if these change) -SHRLIB_DEPLIBS += $(foreach lib, $(LIB_LIBS) $(USR_LIBS), \ - $(firstword $(wildcard $(addsuffix /$(LIB_PREFIX)$(lib)$(LIB_SUFFIX), \ - $($(lib)_DIR) $(SHRLIB_SEARCH_DIRS))) \ - $(addsuffix /$(LIB_PREFIX)$(lib)$(LIB_SUFFIX), \ - $(firstword $($(lib)_DIR) $(INSTALL_LIB))))) +SHRLIB_DEPLIBS = $(foreach lib, $(LIB_LIBS) $(USR_LIBS), \ + $(firstword $(wildcard \ + $(addsuffix /$(SHRLIB_PREFIX)$(lib)*$(SHRLIB_SUFFIX_BASE)*, \ + $($(lib)_DIR) $(SHRLIB_SEARCH_DIRS)) \ + $(addsuffix /$(DLLSTUB_PREFIX)$(lib)$(DLLSTUB_SUFFIX), \ + $($(lib)_DIR) $(SHRLIB_SEARCH_DIRS)) \ + $(addsuffix /$(LIB_PREFIX)$(lib)$(LIB_SUFFIX), \ + $($(lib)_DIR) $(SHRLIB_SEARCH_DIRS))) \ + $(addsuffix /$(BUILDLIB_PREFIX)$(lib)$(BUILDLIB_SUFFIX), $(INSTALL_LIB)))) + SHRLIB_LDLIBS += $($*_DLL_DEPLIBS) $($*_DEPLIBS) $(SHRLIB_DEPLIBS) SHRLIB_LDLIBS += $(addsuffix .lib, \ diff --git a/configure/os/CONFIG_SITE.Common.win32-x86-mingw b/configure/os/CONFIG_SITE.Common.win32-x86-mingw index e61ffc7b9..c2691cb0d 100644 --- a/configure/os/CONFIG_SITE.Common.win32-x86-mingw +++ b/configure/os/CONFIG_SITE.Common.win32-x86-mingw @@ -1,9 +1,8 @@ -# CONFIG_SITE.win32-x86-mingw.Common +# CONFIG_SITE.Common.win32-x86-mingw # # $Revision-Id$ # -# Site Specific definitions for cygwin-x86 target -# Only the local epics system manager should modify this file +# Site Specific definitions for win32-x86-mingw target # If readline is not installed comment the following line # to omit command-line editing and history support diff --git a/src/ca/legacy/gdd/Makefile b/src/ca/legacy/gdd/Makefile index 805f26133..cdbd10905 100644 --- a/src/ca/legacy/gdd/Makefile +++ b/src/ca/legacy/gdd/Makefile @@ -37,28 +37,28 @@ HTMLS += gdd.html HTMLS += gddref.html HTMLS += gddref2.html -AITGENSRCS := gdd.cc gddTest.cc gddAppTable.cc gddNewDel.cc \ - gddAppDefs.cc aitTypes.c aitConvert.cc aitHelpers.cc \ - gddArray.cc gddContainer.cc gddErrorCodes.cc gddUtils.cc \ +GDDSRCS = gdd.cc gddTest.cc gddAppTable.cc gddNewDel.cc \ + gddAppDefs.cc aitTypes.c aitConvert.cc aitHelpers.cc \ + gddArray.cc gddContainer.cc gddErrorCodes.cc gddUtils.cc \ gddEnumStringTable.cc -gdd_SRCS := gdd.cc gddTest.cc gddAppTable.cc gddNewDel.cc \ - gddAppDefs.cc aitTypes.c aitConvert.cc aitHelpers.cc dbMapper.cc \ - gddArray.cc gddContainer.cc gddErrorCodes.cc gddUtils.cc \ - gddEnumStringTable.cc - LIBRARY = gdd +gdd_SRCS = dbMapper $(GDDSRCS) + gdd_LIBS = Com gdd_RCS = gdd.rc -PROD_HOST = aitGen genApps -genApps_SRCS = genApps.cc $(AITGENSRCS) -aitGen_SRCS = aitTypes.c aitGen.c -PROD_LIBS = Com +PROD_HOST += genApps +genApps_SRCS = genApps.cc $(GDDSRCS) genApps_SYS_LIBS_WIN32 = ws2_32 +PROD_LIBS = Com + +PROD_HOST += aitGen +aitGen_SRCS = aitTypes.c aitGen.c + # aitGen.c doesn't compile for linux-arm at -O3 when using gcc-3.4.5 aitGen_CFLAGS_linux-arm = -O2 @@ -66,22 +66,17 @@ CLEANS += $(COMMON_DIR)/aitConvertGenerated.cc include $(TOP)/configure/RULES -# cannot generate these dependencies automatically +# Manual dependencies # -# Problem: Some dependencies are include files that may -# not have been installed if we are building for -# the first time -# -> use explicit reference to the uninstalled files in '..' - aitConvert$(OBJ): $(COMMON_DIR)/aitConvertGenerated.cc dbMapper$(OBJ): $(COMMON_DIR)/gddApps.h # Rules for generated files - +# $(COMMON_DIR)/aitConvertGenerated.cc: $(TOOLS)/aitGen$(HOSTEXE) - $(TOOLS)/aitGen$(HOSTEXE) $@ + $(call PATH_FILTER, $(TOOLS)/aitGen$(HOSTEXE)) $@ $(COMMON_DIR)/gddApps.h : $(TOOLS)/genApps$(HOSTEXE) - $(TOOLS)/genApps$(HOSTEXE) $@ + $(call PATH_FILTER, $(TOOLS)/genApps$(HOSTEXE)) $@ diff --git a/src/libCom/misc/shareLib.h b/src/libCom/misc/shareLib.h index 789ce6b08..6940c5266 100644 --- a/src/libCom/misc/shareLib.h +++ b/src/libCom/misc/shareLib.h @@ -1,18 +1,14 @@ /*************************************************************************\ -* Copyright (c) 2002 The University of Chicago, as Operator of Argonne +* Copyright (c) 2012 UChicago Argonne LLC, as Operator of Argonne * National Laboratory. * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. -* EPICS BASE Versions 3.13.7 -* and higher are distributed subject to a Software License Agreement found +* EPICS BASE is distributed subject to a Software License Agreement found * in file LICENSE that is included with this distribution. \*************************************************************************/ /* * Compiler specific key words to set up external symbols and entry points * - * Currently this is only necessary for WIN32 DLLs and for VAXC on VMS but - * other systems with similar requirements could be supported. - * * USAGE: * There are two distinct classes of keywords in this file: * @@ -26,12 +22,12 @@ * keyword because __stdcall (pascal) calling convention cannot support variable * length ed argument lists. * - * int epicsShareAPI myExtFunc ( int arg ); + * int epicsShareAPI myExtFunc ( int arg ); * int epicsShareAPI myExtFunc ( int arg ) {} * - * ** NOTE ** epicsShareAPI is deprecated for new routines and has been removed - * from all IOC-specific APIs, although most libCom APIs are still - * declared to use it. + * ** NOTE ** The epicsShareAPI attribute is deprecated and has been removed + * from all IOC-specific APIs. Most libCom APIs still use it, but + * it may get removed from these at some point in the future. * * 2) epicsShare{Func,Class,Extern,Def} - specifies shareable library (DLL) * export/import related information in the source code. On windows these keywords @@ -51,8 +47,8 @@ * functions like this: * * #include "shareLib.h" - * epicsShareFunc int myExtFunc ( int arg ); - * epicsShareExtern int myExtVar; + * epicsShareFunc int myExtFunc ( int arg ); + * epicsShareExtern int myExtVar; * class epicsShareClass myClass { int func ( void ); }; * * In the implementation file, however, you write: @@ -61,8 +57,8 @@ * #define epicsExportSharedSymbols * #include * - * epicsShareDef int myExtVar = 4; - * int myExtFunc ( int arg ) {} + * epicsShareDef int myExtVar = 4; + * int myExtFunc ( int arg ) {} * int myClass::func ( void ) {} * * By default shareLib.h sets the DLL import / export keywords to import from @@ -94,8 +90,8 @@ * # include "shareLib.h" * #endif * - * epicsShareFunc int myExtFunc ( int arg ); - * epicsShareExtern int myExtVar; + * epicsShareFunc int myExtFunc ( int arg ); + * epicsShareExtern int myExtVar; * class epicsShareClass myClass {}; * * Fortunately, the above is only the concern of library authors and will have no @@ -109,28 +105,27 @@ #undef epicsShareAPI #undef READONLY -/* - * - * Also check for "EPICS_DLL_NO" not defined so that we will not use these - * keywords if it is an object library build of base under WIN32. - */ #if defined(_WIN32) || defined(__CYGWIN32__) +/* + * Check if EPICS_BUILD_DLL or EPICS_CALL_DLL defined and use the dllimport/ + * dllexport keywords if this is a shared library build of base under WIN32. + */ # if defined(epicsExportSharedSymbols) -# if defined(EPICS_DLL_NO) /* this indicates that we are not building a DLL */ -# define epicsShareExtern extern -# define epicsShareClass -# define epicsShareFunc +# if defined(EPICS_BUILD_DLL) +# define epicsShareExtern __declspec(dllexport) extern +# define epicsShareClass __declspec(dllexport) +# define epicsShareFunc __declspec(dllexport) # else -# define epicsShareExtern __declspec(dllexport) extern -# define epicsShareClass __declspec(dllexport) -# define epicsShareFunc __declspec(dllexport) +# define epicsShareExtern extern +# define epicsShareClass +# define epicsShareFunc # endif # else -# if defined(_DLL) /* this indicates that we are being compiled to call DLLs */ -# define epicsShareExtern __declspec(dllimport) extern -# define epicsShareClass __declspec(dllimport) -# define epicsShareFunc __declspec(dllimport) +# if defined(EPICS_CALL_DLL) +# define epicsShareExtern __declspec(dllimport) extern +# define epicsShareClass __declspec(dllimport) +# define epicsShareFunc __declspec(dllimport) # else # define epicsShareExtern extern # define epicsShareClass diff --git a/src/libCom/osi/os/WIN32/osdThread.c b/src/libCom/osi/os/WIN32/osdThread.c index 3ba9564b3..8a82dc428 100644 --- a/src/libCom/osi/os/WIN32/osdThread.c +++ b/src/libCom/osi/os/WIN32/osdThread.c @@ -97,7 +97,7 @@ static const int osdRealtimePriorityList [osdRealtimePriorityStateCount] = 6 /* allowed on >= W2k, but no #define supplied */ }; -#if !defined(EPICS_DLL_NO) +#if defined(EPICS_BUILD_DLL) BOOL WINAPI DllMain ( HANDLE hModule, DWORD dwReason, LPVOID lpReserved ) {