create versioned library name and symlink unversioned name on *nix

This allows executables (e.g. unit tests) to link against the
libunicorn.so in the build directory, after the SONAME was added in
4860fdb3.

Becuase libunicorn.so has an SONAME of libunicorn.so.0, the linker uses
the SONAME for the DT_NEEDED entry of the tests. But because a library
with that name did not exist, they would fail to run.
This commit is contained in:
Jonathon Reinhart 2015-10-21 22:43:14 -04:00
parent cf727ad323
commit c7de7e44a6
2 changed files with 7 additions and 1 deletions

2
.gitignore vendored
View File

@ -4,6 +4,8 @@
*.o
*.a
*.dSYM
*.so
*.so.*
qemu/config-all-devices.mak

View File

@ -131,7 +131,8 @@ LIBRARY = $(BLDIR)/$(LIBNAME).$(EXT)
else ifeq ($(IS_CYGWIN),1)
LIBRARY = $(BLDIR)/$(LIBNAME).$(EXT)
else # *nix
LIBRARY = $(BLDIR)/lib$(LIBNAME).$(EXT)
LIBRARY = $(BLDIR)/lib$(LIBNAME).$(VERSION_EXT)
LIBRARY_SYMLINK = $(BLDIR)/lib$(LIBNAME).$(EXT)
endif
endif
@ -229,6 +230,9 @@ ifeq ($(V),0)
else
$(CC) $(CFLAGS) $($(LIBNAME)_LDFLAGS) -shared $^ -o $(LIBRARY) $(GLIB) -lm
endif
ifneq (,$(LIBRARY_SYMLINK))
@ln -sf $(LIBRARY) $(LIBRARY_SYMLINK)
endif
endif
$(ARCHIVE): $(UC_TARGET_OBJ) uc.o hook.o