# Input
# $(SOURCE) - The source code to use
# $(HEADERS) - Exported header files and private header files
-# $(LIBRARY) - The name of the library without lib or .so
+# $(LIBRARY) - The name of the library without lib or .so
# $(MAJOR) - The major version number of this library
# $(MINOR) - The minor version number of this library
# $(APT_DOMAIN) - The text domain for this library
# See defaults.mak for information about LOCAL
# Some local definitions
-LOCAL := lib$(LIBRARY)$(LIBEXT).dylib.$(MAJOR).$(MINOR)
+LOCAL := lib$(LIBRARY)$(LIBEXT).$(SOEXT).$(MAJOR).$(MINOR)
$(LOCAL)-OBJS := $(addprefix $(OBJ)/,$(addsuffix .opic,$(notdir $(basename $(SOURCE)))))
$(LOCAL)-DEP := $(addprefix $(DEP)/,$(addsuffix .opic.d,$(notdir $(basename $(SOURCE)))))
$(LOCAL)-HEADERS := $(addprefix $(INCLUDE)/,$(HEADERS))
-$(LOCAL)-SONAME := lib$(LIBRARY)$(LIBEXT).dylib.$(MAJOR)
+$(LOCAL)-SONAME := lib$(LIBRARY)$(LIBEXT).$(SOEXT).$(MAJOR)
$(LOCAL)-SLIBS := $(SLIBS)
$(LOCAL)-LIBRARY := $(LIBRARY)
# Install the command hooks
headers: $($(LOCAL)-HEADERS)
-library: $(LIB)/lib$(LIBRARY).dylib $(LIB)/lib$(LIBRARY)$(LIBEXT).dylib.$(MAJOR)
+library: $(LIB)/lib$(LIBRARY).$(SOEXT) $(LIB)/lib$(LIBRARY)$(LIBEXT).$(SOEXT).$(MAJOR)
clean: clean/$(LOCAL)
veryclean: veryclean/$(LOCAL)
clean/$(LOCAL):
-rm -f $($(@F)-OBJS) $($(@F)-DEP)
veryclean/$(LOCAL): clean/$(LOCAL)
- -rm -f $($(@F)-HEADERS) $(LIB)/lib$($(@F)-LIBRARY)*.dylib*
+ -rm -f $($(@F)-HEADERS) $(LIB)/lib$($(@F)-LIBRARY)*.$(SOEXT)*
# Build rules for the two symlinks
-.PHONY: $(LIB)/lib$(LIBRARY)$(LIBEXT).dylib.$(MAJOR) $(LIB)/lib$(LIBRARY).dylib
-$(LIB)/lib$(LIBRARY)$(LIBEXT).dylib.$(MAJOR): $(LIB)/lib$(LIBRARY)$(LIBEXT).dylib.$(MAJOR).$(MINOR)
+.PHONY: $(LIB)/lib$(LIBRARY)$(LIBEXT).$(SOEXT).$(MAJOR) $(LIB)/lib$(LIBRARY).$(SOEXT)
+$(LIB)/lib$(LIBRARY)$(LIBEXT).$(SOEXT).$(MAJOR): $(LIB)/lib$(LIBRARY)$(LIBEXT).$(SOEXT).$(MAJOR).$(MINOR)
ln -sf $(<F) $@
-$(LIB)/lib$(LIBRARY).dylib: $(LIB)/lib$(LIBRARY)$(LIBEXT).dylib.$(MAJOR).$(MINOR)
+$(LIB)/lib$(LIBRARY).$(SOEXT): $(LIB)/lib$(LIBRARY)$(LIBEXT).$(SOEXT).$(MAJOR).$(MINOR)
ln -sf $(<F) $@
# The binary build rule
-$(LIB)/lib$(LIBRARY)$(LIBEXT).dylib.$(MAJOR).$(MINOR): $($(LOCAL)-HEADERS) $($(LOCAL)-OBJS)
- -rm -f $(LIB)/lib$($(@F)-LIBRARY)*.dylib* 2> /dev/null
+$(LIB)/lib$(LIBRARY)$(LIBEXT).$(SOEXT).$(MAJOR).$(MINOR): $($(LOCAL)-HEADERS) $($(LOCAL)-OBJS)
+ -rm -f $(LIB)/lib$($(@F)-LIBRARY)*.$(SOEXT)* 2> /dev/null
echo Building shared library $@
$(CXX) $(CXXFLAGS) $(LDFLAGS) $(PICFLAGS) $(LFLAGS) $(LFLAGS_SO)\
- -o $@ -Wl,-dylib_install_name,$(patsubst $(LIB)/%,/usr/lib/%,$@) -dynamiclib \
+ -o $@ $(SONAME_MAGIC)$(patsubst $(LIB)/%,/usr/lib/%,$@) -dynamiclib \
$(filter %.opic,$^) \
$($(@F)-SLIBS)