From 815d6d7f3dcb8b509444529addadd91a7eed179b Mon Sep 17 00:00:00 2001 From: "Azamat H. Hackimov" Date: Tue, 19 Oct 2021 01:13:28 +0300 Subject: [PATCH] Fix CFLAGS and LDFLAGS options Remove CFLAGS optimization overrides, add -Wl,-soname option to LDFLAGS for external linking. --- src/makefile | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/src/makefile b/src/makefile index 522d378..cf4a571 100755 --- a/src/makefile +++ b/src/makefile @@ -162,7 +162,7 @@ SO_macosx=so O_macosx=o CC_macosx=gcc DEF_macosx= -DLUASOCKET_$(DEBUG) -DUNIX_HAS_SUN_LEN -CFLAGS_macosx=$(LUAINC:%=-I%) $(DEF) -Wall -O2 -fno-common +CFLAGS_macosx=$(LUAINC:%=-I%) $(DEF) -Wall -fno-common LDFLAGS_macosx= -bundle -undefined dynamic_lookup -o LD_macosx=gcc SOCKET_macosx=usocket.o @@ -174,8 +174,7 @@ SO_linux=so O_linux=o CC_linux=gcc DEF_linux=-DLUASOCKET_$(DEBUG) -CFLAGS_linux=$(LUAINC:%=-I%) $(DEF) -Wall -Wshadow -Wextra \ - -Wimplicit -O2 -ggdb3 -fpic +CFLAGS_linux=$(LUAINC:%=-I%) $(DEF) -Wall -Wshadow -Wextra -Wimplicit -fpic LDFLAGS_linux=-O -shared -fpic -o LD_linux=gcc SOCKET_linux=usocket.o @@ -187,8 +186,7 @@ SO_freebsd=so O_freebsd=o CC_freebsd=gcc DEF_freebsd=-DLUASOCKET_$(DEBUG) -DUNIX_HAS_SUN_LEN -CFLAGS_freebsd=$(LUAINC:%=-I%) $(DEF) -Wall -Wshadow -Wextra \ - -Wimplicit -O2 -ggdb3 -fpic +CFLAGS_freebsd=$(LUAINC:%=-I%) $(DEF) -Wall -Wshadow -Wextra -Wimplicit -fpic LDFLAGS_freebsd=-O -shared -fpic -o LD_freebsd=gcc SOCKET_freebsd=usocket.o @@ -200,8 +198,7 @@ SO_solaris=so O_solaris=o CC_solaris=gcc DEF_solaris=-DLUASOCKET_$(DEBUG) -CFLAGS_solaris=$(LUAINC:%=-I%) $(DEF) -Wall -Wshadow -Wextra \ - -Wimplicit -O2 -ggdb3 -fpic +CFLAGS_solaris=$(LUAINC:%=-I%) $(DEF) -Wall -Wshadow -Wextra -Wimplicit -fpic LDFLAGS_solaris=-lnsl -lsocket -lresolv -O -shared -fpic -o LD_solaris=gcc SOCKET_solaris=usocket.o @@ -214,7 +211,7 @@ O_mingw=o CC_mingw=gcc DEF_mingw= -DLUASOCKET_$(DEBUG) \ -DWINVER=0x0501 -CFLAGS_mingw=$(LUAINC:%=-I%) $(DEF) -Wall -O2 -fno-common +CFLAGS_mingw=$(LUAINC:%=-I%) $(DEF) -Wall -fno-common LDFLAGS_mingw= $(LUALIB) -shared -Wl,-s -lws2_32 -o LD_mingw=gcc SOCKET_mingw=wsocket.o @@ -396,18 +393,18 @@ none: all: $(SOCKET_SO) $(MIME_SO) $(SOCKET_SO): $(SOCKET_OBJS) - $(LD) $(SOCKET_OBJS) $(LDFLAGS)$@ + $(LD) $(SOCKET_OBJS) -Wl,-soname,socket/core.so $(LDFLAGS)$@ $(MIME_SO): $(MIME_OBJS) - $(LD) $(MIME_OBJS) $(LDFLAGS)$@ + $(LD) $(MIME_OBJS) -Wl,-soname,mime/core.so $(LDFLAGS)$@ all-unix: all $(UNIX_SO) $(SERIAL_SO) $(UNIX_SO): $(UNIX_OBJS) - $(LD) $(UNIX_OBJS) $(LDFLAGS)$@ + $(LD) $(UNIX_OBJS) -Wl,-soname,socket/unix.so $(LDFLAGS)$@ $(SERIAL_SO): $(SERIAL_OBJS) - $(LD) $(SERIAL_OBJS) $(LDFLAGS)$@ + $(LD) $(SERIAL_OBJS) -Wl,-soname,socket/serial.so $(LDFLAGS)$@ install: $(INSTALL_DIR) $(INSTALL_TOP_LDIR)