2 #----------------------------------------------------------------------------
5 # Build libraries (i.e., contain no binary executables)
8 #----------------------------------------------------------------------------
10 #---------------------------------------------------------------------------
12 #---------------------------------------------------------------------------
14 ifneq ($(versioned_so),0)
15 # Turn on symbol versioning. The scheme that we follow is to allow
16 # applications dependent on libraries, with same version numbers (major,
17 # minor and beta) to run, but applications with dependencies on libraries
18 # with different minor or major or beta versions to fail.
20 # Version number of the libraries
23 ifeq ($(versioned_so),1)
24 SOVERSION = .$(GNUACE_PROJECT_VERSION)
25 else ifeq ($(versioned_so),2)
26 SOVERSION = -$(GNUACE_PROJECT_VERSION)
27 else ifeq ($(versioned_so),3)
30 $(error unknown value for versioned_so: $(versioned_so))
34 # Name that will be written into the dynamic library
37 ifeq ($(versioned_so),1)
38 SONAME = $(SHLIB)$(SOVERSION)
39 else ifeq ($(versioned_so),2)
40 SONAME = $(patsubst %.$(SOEXT),%,$(SHLIB))$(SOVERSION).$(SOEXT)
41 else ifeq ($(versioned_so),3)
48 #----------------------------------------------------------------------------
49 # The following targets arrange to build both unshared and shared libraries
50 #----------------------------------------------------------------------------
52 VLIB = $(ARCH_LIB:%.$(LIBEXT)=%$(VAR).$(LIBEXT))
53 CLEANUP_VLIB = $(CLEANUP_LIB:%.$(LIBEXT)=%$(VAR).$(LIBEXT))
55 # Add VLIB to VLIBS if building static_libs.
61 # Setup shared library variables, including versions.
62 VSHLIB_NO_VER = $(ARCH_SHLIB:%.$(SOEXT)=%$(VAR).$(SOEXT))
63 CLEANUP_VSHLIB_NO_VER = $(CLEANUP_SHLIB:%.$(SOEXT)=%$(VAR).$(SOEXT))
64 ifneq ($(versioned_so),2)
65 VSHLIB = $(VSHLIB_NO_VER:%=%$(SOVERSION))
66 CLEANUP_VSHLIB = $(CLEANUP_VSHLIB_NO_VER:%=%$(SOVERSION))
67 SHLIB_WITH_VER = $(SHLIB:%=%$(SOVERSION))
69 VSHLIB = $(if $(VSHLIB_NO_VER), $(patsubst %.$(SOEXT),%,$(VSHLIB_NO_VER))$(SOVERSION).$(SOEXT))
70 CLEANUP_VSHLIB = $(if $(CLEANUP_VSHLIB_NO_VER), $(patsubst %.$(SOEXT),%,$(CLEANUP_VSHLIB_NO_VER))$(SOVERSION).$(SOEXT))
71 SHLIB_WITH_VER = $(if $(SHLIB), $(patsubst %.$(SOEXT),%,$(SHLIB))$(SOVERSION).$(SOEXT))
75 VSHLIBA = $(ARCH_SHLIBA:%.$(LIBEXT)=%$(VAR).$(LIBEXT))
77 # Add VSHLIB if we're building shared_libs.
79 VLIBS += $(VSHLIB) $(VSHLIBA)
82 # Warn if no libs found
88 ifndef SHLIB_UNCHECKED
90 endif # !SHLIB_UNCHECKED
91 ifeq ($(LIB_WARNING),1)
92 @echo Warning: rules.lib.GNU included, but no library targets detected.
95 # Libraries always depend on idl_stubs, if they exist.
102 VLOBJS = $(addprefix $(VDIR),$(foreach var, $(addsuffix .$(OBJEXT), $(basename $(LSRC)) $(RESOURCES)), $(patsubst ../%,$(notdir $(var)),$(var))))
107 VSHOBJS = $(addprefix $(VSHDIR),$(foreach var, $(addsuffix .$(OBJEXT), $(basename $(LSRC)) $(RESOURCES)), $(patsubst ../%,$(notdir $(var)),$(var))))
110 $(VLOBJS) $(VSHOBJS): $(IDL_SRC)
113 # Since INSLIB already has the ARCH dir appended, if appropriate, ARCH
114 # needs to be stripped from V[SH]LIB on the way over to INSLIB. To avoid
115 # an extra '/' which confuses the relative link calculation, ensure the
116 # '/' after ARCH is stripped if it's an ARCH build.
124 LIB_INSTALL += $(VLIB:$(ARCHDIR)%=$(INSLIB)/%)
125 CLEANUP_INSTALL += $(CLEANUP_VLIB:$(ARCHDIR)%=$(INSLIB)/%)
129 LIB_INSTALL += $(VSHLIB:$(ARCHDIR)%=$(INSLIB)/%)
130 CLEANUP_INSTALL += $(CLEANUP_VSHLIB:$(ARCHDIR)%=$(INSLIB)/%)
131 CLEANUP_INSTALL += $(CLEANUP_VSHLIB_NO_VER:$(ARCHDIR)%=$(INSLIB)/%*)
133 LIB_INSTALL += $(VSHLIBA:$(ARCHDIR)%=$(INSLIB)/%)
134 CLEANUP_INSTALL += $(CLEANUP_SHLIBA:$(ARCHDIR)%=$(INSLIB)/%)
143 ifeq (1,$(ace_lib_prelink))
144 .PHONY: ace-templ_inst
147 -$(LINK.cc) $(LINK_OUTPUT_FLAG) ace-templ_inst $(VLOBJS) $(LDFLAGS) $(ACE_SHLIBS)
148 -$(RM) ace-templ_inst
150 $(VLIB): $(VLOBJS) ace-templ_inst
155 @echo $(LINK.cc) $(LINK_OUTPUT_FLAG) > .prelink.spec
156 @echo xargs $(AR) $(ARFLAGS) $(notdir $@) $(AREXTRA) >> .prelink.spec
157 @if not [""]==["$(ACE_SHLIBS)"] @echo $(subst -l,,$(ACE_SHLIBS)) >> .prelink.spec
159 echo .prelink.spec $(foreach rpo,$(patsubst %.$(OBJEXT),%.rpo,$(filter %.$(OBJEXT), $?)),$(shell if exist $(rpo) echo $(rpo))) | xargs $(AR) $(ARFLAGS) $@ $(AREXTRA)
162 echo $(TMPINCDIR:%=%/*.$(OBJEXT)) $(filter %.$(OBJEXT), $?) | xargs $(AR) $(ARFLAGS) $@ $(AREXTRA)
173 #### With repo, link in all of the ace object files to the lib.
174 #### This avoids multiple instantiations. We haven't found it to
175 #### be necessary with shared libs, so just do it for static libs.
176 vpath %.$(OBJEXT) $(ACE_ROOT)/ace/$(VDIR)
178 $(VLIB): $(ACE_ROOT)/ace/$(VDIR)*.$(OBJEXT)
184 ifeq (1,$(ace_lib_prelink))
185 #### Attempt a link (which will fail), to add template instantiations
186 #### to lib files, for example.
187 -$(LINK.cc) $(LINK_OUTPUT_FLAG) ace-templ_inst $? $(LDFLAGS) $(ACE_NUL_STDERR)
188 endif # ace_lib_prelink
189 ifneq (,$(AR.cc.override))
192 ([ "`echo $(TMPINCDIR:%=%/*.$(OBJEXT))`" != "$(TMPINCDIR:%=%/*.$(OBJEXT))" ] && echo $(TMPINCDIR:%=%/*.$(OBJEXT)); \
193 echo $(filter %.$(OBJEXT), $^)) | xargs $(AR) $(ARFLAGS) $@ $(AREXTRA)
202 ifeq ($(VXWORKSLINK),1)
203 $(VSHLIB): $(basename $(notdir $(PRJ_FILE))).out
205 -$(LN_S) $(PROJECT_OUT) $@
208 $(VSHLIB): $(VSHOBJS)
215 ifeq (1,$(ace_lib_prelink))
216 #### Attempt a link (which will fail), to add template instantiations
217 #### to lib files, for example.
218 -$(LINK.cc) $(LINK_OUTPUT_FLAG) ace-templ_inst $^ $(LDFLAGS) $(ACE_NUL_STDERR)
219 endif # ace_lib_prelink
220 ifneq ($(SOLINK.cc.override),)
221 $(SOLINK.cc.override)
223 $(SHR_FILTER) $(SOLINK.cc) $(SO_OUTPUT_FLAG) $@ $^ $(LDFLAGS) $(ACE_SHLIBS) $(LIBS)
227 ifneq ($(SOVERSION),)
228 # This carefully works with both ARCH (where VSHLIB_* refer to the ARCH
229 # subdir, but SHLIB does not) and non-ARCH builds (where VSHLIB_* and SHLIB
230 # refer to the same place). SHLIB_WITH_VER should be the same as $@ but
231 # without the ARCH subdir.
232 -$(RM) $(VSHLIB_NO_VER)
233 -$(LN_S) $(if $(findstring cp,$(firstword $(LN_S))),$(@),$(SHLIB_WITH_VER)) $(VSHLIB_NO_VER)