Ticket #47853: patch-Makefile.diff

File patch-Makefile.diff, 4.5 KB (added by harciga, 9 years ago)
  • Makefile

    old new  
    4141ifeq ($(UNAME), Darwin)
    4242SONAME_FLAG = -install_name
    4343SHARED_FLAG = -dynamiclib
     44OSX_FLAGS = -current_version ${SOVERSION} -compatibility_version ${SOMAJOR}
    4445endif
    4546
    4647all: ${PROJECTNV} ${BUILDDIR}/${PROJECT}.pc po
     
    111112        @mkdir -p ${BUILDDIR_RELEASE}/${BINDIR}
    112113        $(QUIET)ar rcs $@ ${OBJECTS}
    113114
    114 ${BUILDDIR_RELEASE}/${BINDIR}/lib${PROJECT}.so.${SOVERSION}: ${OBJECTS}
     115${BUILDDIR_RELEASE}/${BINDIR}/lib${PROJECT}.${SOVERSION}.dylib: ${OBJECTS}
    115116        $(call colorecho,LD,$@)
    116117        @mkdir -p ${BUILDDIR_RELEASE}/${BINDIR}
    117         $(QUIET)${CC} -Wl,${SONAME_FLAG},lib${PROJECT}.so.${SOMAJOR} \
    118                 ${SHARED_FLAG} ${LDFLAGS} -o $@ ${OBJECTS} ${LIBS}
     118        $(QUIET)${CC} -Wl,${SONAME_FLAG},${LIBDIR}/lib${PROJECT}.${SOMAJOR}.dylib \
     119                ${SHARED_FLAG} ${OSX_FLAGS} ${LDFLAGS} -o $@ ${OBJECTS} ${LIBS}
    119120
    120121${PROJECT}: static shared
    121122${PROJECTNV}: ${PROJECT}
    122123static: ${BUILDDIR_RELEASE}/${BINDIR}/lib${PROJECT}.a
    123 shared: ${BUILDDIR_RELEASE}/${BINDIR}/lib${PROJECT}.so.${SOVERSION}
     124shared: ${BUILDDIR_RELEASE}/${BINDIR}/lib${PROJECT}.${SOVERSION}.dylib
    124125release: ${PROJECT}
    125126
    126127# debug build
     
    142143        @mkdir -p ${BUILDDIR_DEBUG}/${BINDIR}
    143144        $(QUIET)${AR} rcs $@ ${OBJECTS_DEBUG}
    144145
    145 ${BUILDDIR_DEBUG}/${BINDIR}/lib${PROJECT}.so.${SOVERSION}: ${OBJECTS_DEBUG}
     146${BUILDDIR_DEBUG}/${BINDIR}/lib${PROJECT}.${SOVERSION}.dylib: ${OBJECTS_DEBUG}
    146147        $(call colorecho,LD,$@)
    147148        @mkdir -p ${BUILDDIR_DEBUG}/${BINDIR}
    148         $(QUIET)${CC} -Wl,${SONAME_FLAG},lib${PROJECT}.so.${SOMAJOR} ${SHARED_FLAG} ${LDFLAGS} -o $@ ${OBJECTS_DEBUG} ${LIBS}
     149        $(QUIET)${CC} -Wl,${SONAME_FLAG},${LIBDIR}/lib${PROJECT}.${SOMAJOR}.dylib ${SHARED_FLAG} ${OSX_FLAGS} ${LDFLAGS} -o $@ ${OBJECTS_DEBUG} ${LIBS}
    149150
    150151${PROJECT}-debug: \
    151152        ${BUILDDIR_DEBUG}/${BINDIR}/lib${PROJECT}.a \
    152         ${BUILDDIR_DEBUG}/${BINDIR}/lib${PROJECT}.so.${SOVERSION}
     153        ${BUILDDIR_DEBUG}/${BINDIR}/lib${PROJECT}.${SOVERSION}.dylib
    153154debug: ${PROJECT}-debug
    154155
    155156# gcov build
     
    171172        @mkdir -p ${BUILDDIR_GCOV}/${BINDIR}
    172173        $(QUIET)${AR} rcs $@ ${OBJECTS_GCOV}
    173174
    174 ${BUILDDIR_GCOV}/${BINDIR}/lib${PROJECT}.so.${SOVERSION}: ${OBJECTS_GCOV}
     175${BUILDDIR_GCOV}/${BINDIR}/lib${PROJECT}.${SOVERSION}.dylib: ${OBJECTS_GCOV}
    175176        $(call colorecho,LD,$@)
    176177        @mkdir -p ${BUILDDIR_GCOV}/${BINDIR}
    177         $(QUIET)${CC} -Wl,${SONAME_FLAG},lib${PROJECT}.so.${SOMAJOR} ${SHARED_FLAG} \
    178                 ${GCOV_LDFLAGS} -o $@ ${OBJECTS_GCOV} ${LIBS}
     178        $(QUIET)${CC} -Wl,${SONAME_FLAG},${LIBDIR}/lib${PROJECT}.${SOMAJOR}.dylib ${SHARED_FLAG} \
     179                ${OSX_FLAGS} ${GCOV_LDFLAGS} -o $@ ${OBJECTS_GCOV} ${LIBS}
    179180
    180181${PROJECT}-gcov: ${BUILDDIR_GCOV}/${BINDIR}/lib${PROJECT}.a
    181182gcov: ${PROJECT}-gcov
     
    245246install-shared: shared
    246247        $(call colorecho,INSTALL,"Install shared library")
    247248        $(QUIET)mkdir -m 755 -p ${DESTDIR}${LIBDIR}
    248         $(QUIET)install -m 644 ${BUILDDIR_RELEASE}/${BINDIR}/lib${PROJECT}.so.${SOVERSION} ${DESTDIR}${LIBDIR}
    249         $(QUIET)ln -sf lib${PROJECT}.so.${SOVERSION} ${DESTDIR}${LIBDIR}/lib${PROJECT}.so.${SOMAJOR} || \
    250                 echo "Failed to create lib${PROJECT}.so.${SOMAJOR}. Please check if it exists and points to the correct version of lib${PROJECT}.so."
    251         $(QUIET)ln -sf lib${PROJECT}.so.${SOVERSION} ${DESTDIR}${LIBDIR}/lib${PROJECT}.so || \
    252                 echo "Failed to create lib${PROJECT}.so. Please check if it exists and points to the correct version of lib${PROJECT}.so."
     249        $(QUIET)install -m 644 ${BUILDDIR_RELEASE}/${BINDIR}/lib${PROJECT}.${SOVERSION}.dylib ${DESTDIR}${LIBDIR}
     250        $(QUIET)ln -sf lib${PROJECT}.${SOVERSION}.dylib ${DESTDIR}${LIBDIR}/lib${PROJECT}.${SOMAJOR}.dylib || \
     251                echo "Failed to create lib${PROJECT}.${SOMAJOR}.dylib. Please check if it exists and points to the correct version of lib${PROJECT}.dylib"
     252        $(QUIET)ln -sf lib${PROJECT}.${SOVERSION}.dylib ${DESTDIR}${LIBDIR}/lib${PROJECT}.dylib || \
     253                echo "Failed to create lib${PROJECT}.dylib. Please check if it exists and points to the correct version of lib${PROJECT}.dylib."
    253254
    254255install-headers: ${PROJECTNV}/version.h ${BUILDDIR}/${PROJECT}.pc
    255256        $(call colorecho,INSTALL,"Install pkg-config file")
     
    268269
    269270uninstall: uninstall-headers
    270271        $(call colorecho,UNINSTALL,"Remove library files")
    271         $(QUIET)rm -f ${LIBDIR}/lib${PROJECT}.a ${LIBDIR}/lib${PROJECT}.so.${SOVERSION} \
    272                 ${LIBDIR}/lib${PROJECT}.so.${SOMAJOR} ${LIBDIR}/lib${PROJECT}.so
     272        $(QUIET)rm -f ${LIBDIR}/lib${PROJECT}.a ${LIBDIR}/lib${PROJECT}.${SOVERSION}.dylib \
     273                ${LIBDIR}/lib${PROJECT}.${SOMAJOR}.dylib ${LIBDIR}/lib${PROJECT}.dylib
    273274        $(QUIET)${MAKE} -C po uninstall
    274275
    275276uninstall-headers: