1diff --git a/Makefile b/Makefile
2index 209a132..9387b09 100644
3--- a/Makefile
4+++ b/Makefile
5@@ -43,7 +43,7 @@ PLATS= aix ansi bsd freebsd generic linux macosx mingw posix solaris
6 # What to install.
7 TO_BIN= lua luac
8 TO_INC= lua.h luaconf.h lualib.h lauxlib.h ../etc/lua.hpp
9-TO_LIB= liblua.a
10+TO_LIB= liblua.5.1.5.dylib
11 TO_MAN= lua.1 luac.1
12
13 # Lua version and release.
14@@ -64,6 +64,8 @@ install: dummy
15 cd src && $(INSTALL_DATA) $(TO_INC) $(INSTALL_INC)
16 cd src && $(INSTALL_DATA) $(TO_LIB) $(INSTALL_LIB)
17 cd doc && $(INSTALL_DATA) $(TO_MAN) $(INSTALL_MAN)
18+ ln -s -f liblua.5.1.5.dylib $(INSTALL_LIB)/liblua.5.1.dylib
19+ ln -s -f liblua.5.1.dylib $(INSTALL_LIB)/liblua.dylib
20
21 ranlib:
22 cd src && cd $(INSTALL_LIB) && $(RANLIB) $(TO_LIB)
23diff --git a/src/Makefile b/src/Makefile
24index e0d4c9f..4477d7b 100644
25--- a/src/Makefile
26+++ b/src/Makefile
27@@ -22,7 +22,7 @@ MYLIBS=
28
29 PLATS= aix ansi bsd freebsd generic linux macosx mingw posix solaris
30
31-LUA_A= liblua.a
32+LUA_A= liblua.5.1.5.dylib
33 CORE_O= lapi.o lcode.o ldebug.o ldo.o ldump.o lfunc.o lgc.o llex.o lmem.o \
34 lobject.o lopcodes.o lparser.o lstate.o lstring.o ltable.o ltm.o \
35 lundump.o lvm.o lzio.o
36@@ -48,11 +48,13 @@ o: $(ALL_O)
37 a: $(ALL_A)
38
39 $(LUA_A): $(CORE_O) $(LIB_O)
40- $(AR) $@ $(CORE_O) $(LIB_O) # DLL needs all object files
41- $(RANLIB) $@
42+ $(CC) -dynamiclib -install_name $(out)/lib/liblua.5.1.dylib \
43+ -compatibility_version 5.1 -current_version 5.1.5 \
44+ -o liblua.5.1.5.dylib $^
45
46 $(LUA_T): $(LUA_O) $(LUA_A)
47- $(CC) -o $@ $(MYLDFLAGS) $(LUA_O) $(LUA_A) $(LIBS)
48+ $(CC) -fno-common $(MYLDFLAGS) \
49+ -o $@ $(LUA_O) $(LUA_A) -L. -llua.5.1.5 $(LIBS)
50
51 $(LUAC_T): $(LUAC_O) $(LUA_A)
52 $(CC) -o $@ $(MYLDFLAGS) $(LUAC_O) $(LUA_A) $(LIBS)