Join with aliencode
[ntk/apt.git] / buildlib / library.mak
index 8c8c2fa..229479f 100644 (file)
@@ -21,7 +21,7 @@ $(LOCAL)-DEP := $(addprefix $(DEP)/,$(addsuffix .opic.d,$(notdir $(basename $(SO
 $(LOCAL)-HEADERS := $(addprefix $(INCLUDE)/,$(HEADERS))
 $(LOCAL)-SONAME := lib$(LIBRARY).so.$(MAJOR)
 $(LOCAL)-SLIBS := $(SLIBS)
-$(LOCAL)-LIBRARY := $(LIBARARY)
+$(LOCAL)-LIBRARY := $(LIBRARY)
 
 # Install the command hooks
 headers: $($(LOCAL)-HEADERS)
@@ -29,6 +29,9 @@ library: $(LIB)/lib$(LIBRARY).so $(LIB)/lib$(LIBRARY).so.$(MAJOR)
 clean: clean/$(LOCAL)
 veryclean: veryclean/$(LOCAL)
 
+# Make Directories
+MKDIRS += $(OBJ) $(DEP) $(LIB) $(dir $($(LOCAL)-HEADERS))
+
 # The clean rules
 .PHONY: clean/$(LOCAL) veryclean/$(LOCAL)
 clean/$(LOCAL):
@@ -45,10 +48,12 @@ $(LIB)/lib$(LIBRARY).so: $(LIB)/lib$(LIBRARY).so.$(MAJOR).$(MINOR)
        
 # The binary build rule
 $(LIB)/lib$(LIBRARY).so.$(MAJOR).$(MINOR): $($(LOCAL)-HEADERS) $($(LOCAL)-OBJS)
+       -rm -f $(LIB)/lib$($(@F)-LIBRARY).so* 2> /dev/null
        echo Building shared library $@
-       $(CXX) $(CXXFLAGS) $(LDFLAGS) $(PICFLAGS) $(LFLAGS) -o $@ \
-          -Wl,-soname -Wl,$($(@F)-SONAME) -shared $(filter %.opic,$^) \
-          $($(@F)-SLIBS)
+       $(CXX) $(CXXFLAGS) $(LDFLAGS) $(PICFLAGS) $(LFLAGS) $(LFLAGS_SO)\
+          -o $@ $(SONAME_MAGIC)$($(@F)-SONAME) -shared \
+          $(filter %.opic,$^) \
+          $($(@F)-SLIBS) 
 
 # Compilation rules
 vpath %.cc $(SUBDIRS)