build the lib by default, not just the programs (the Windows version already did this, it must have been an oversight)
follow the Windows naming conventions(this is important to me because I'm trying to write a cross-platform build which depends partially on libsvm and partially on other cross-platform libraries, and I want to be able to use a single declaration in my Makefile)
use make's features to get the platform detection out of the shell script
make the library file a real target and properly mark lib as a .PHONY one. Now make knows when it has already built libsvm.so.2.
don't explicitly embed -soname (Linux) or -install_name (OS X); rather, let the platform decide.
Because of this, the target is built with its final name and then linked to its versioned name, instead of the other way around.
build the static library
OS X auto-embeds -install_name:
sasgradmac:libsvm nguenthe$ otool -L libsvm.dylib
libsvm.dylib:
libsvm.dylib (compatibility version 0.0.0, current version 0.0.0)
/usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 56.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 169.3.0)
Linux doesn't embed -soname (but maybe it should??):
But this is inconsistent with what I've observed the system libraries on my Linux. Hence, I am not entirely sold on the idea of removing -soname, and if you think it is important I can easily revert it.
Also, please investigate what downstream is doing to your package. You can get clues from them, or you need to beat them over the head with a cluestick. I am not familiar enough to judge which.
macports added .dylib-specific flags: -current_version and -compatibility_version. I am not sure how important these are to OS X. The .dylib works without them, but it might be worthwhile to play by Apple's rules.
OS X auto-embeds -install_name:
Linux doesn't embed -soname (but maybe it should??):
But this is inconsistent with what I've observed the system libraries on my Linux. Hence, I am not entirely sold on the idea of removing -soname, and if you think it is important I can easily revert it.
Also, please investigate what downstream is doing to your package. You can get clues from them, or you need to beat them over the head with a cluestick. I am not familiar enough to judge which.
macports added .dylib-specific flags: -current_version and -compatibility_version. I am not sure how important these are to OS X. The .dylib works without them, but it might be worthwhile to play by Apple's rules.
Debian/Ubuntu thinks LVER=3 and packages libsvm as "libsvm3", but your SHVER=2; what gives?
In good news, libsvm installs almost unmodified on ArchLinux. All they had to add was
make lib
and where files get finally installed.