AR ?= ar CXX ?= g++ CXXFLAGS += -Wall RANLIB ?= ranlib name = libtinyxml major = @MAJOR_V@ minor = @MINOR_V@ version = $(major).$(minor) src = tinyxml.cpp tinyxmlparser.cpp tinyxmlerror.cpp tinystr.cpp lo = $(addsuffix .lo,$(basename ${src})) o = $(addsuffix .o,$(basename ${src})) all: $(name).a $(name).so %.o: %.cpp $(CXX) -c $(CXXFLAGS) $(CPPFLAGS) $< -o $@ $(name).a: $(o) $(AR) rc $(name).a $(o) $(RANLIB) $(name).a %.lo: %.cpp $(CXX) -c $(CXXFLAGS) $(CPPFLAGS) -fPIC $< -o $@ $(name).so: $(lo) $(CXX) $(LDFLAGS) -fPIC -shared $(lo) -Wl,-soname,$(name).so.$(major) -o $(name).so.$(version) ln -s $(name).so.$(version) $(name).so.$(major) ln -s $(name).so.$(version) $(name).so clean: -rm -f *.o *.lo *.so* *.a