Optimize linked binary size a bit (by half)

This commit is contained in:
Łukasz Magiera 2016-03-02 22:56:38 +01:00
parent f3a6d7e409
commit 29e8e625f1
2 changed files with 5 additions and 5 deletions

View File

@ -4,8 +4,8 @@
PREFIX?=x86_64-linux-musl
CC = $(PREFIX)-gcc
CFLAGS?=-O2 -std=c99 -DLUA_COMPAT_MODULE
LDFLAGS+= -static -Ldependencies/lib-$(PREFIX)
CFLAGS?=-O2 -std=c99 -DLUA_COMPAT_MODULE -fdata-sections -ffunction-sections
LDFLAGS+= -O2 -Wl,--gc-sections -static -Ldependencies/lib-$(PREFIX)
# Project specific stuff
BUILD = bin/

View File

@ -59,7 +59,7 @@ if [ $2 = "libressl" ] || [ $# -lt 2 ]; then
git clone https://github.com/libressl-portable/portable.git libressl
cd libressl
./autogen.sh
./configure --host=$TOOL
CFLAGS="-fdata-sections -ffunction-sections" ./configure --host=$TOOL
make clean
make -j8
@ -86,7 +86,7 @@ if [ $2 = "libevent" ] || [ $# -lt 2 ]; then
cd libevent-2.0.22-stable
./autogen.sh
./configure --host=$TOOL
CFLAGS="-fdata-sections -ffunction-sections" ./configure --host=$TOOL
make clean
make -j8
@ -115,7 +115,7 @@ if [ $2 = "lua" ] || [ $# -lt 2 ]; then
cd lua-5.3.2
make clean
make generic MYCFLAGS=-DLUA_COMPAT_MODULE CC=$TOOL-gcc RANLIB=$TOOL-ranlib #AR=$TOOL-ar
make generic MYCFLAGS="-DLUA_COMPAT_MODULE -fdata-sections -ffunction-sections" CC=$TOOL-gcc RANLIB=$TOOL-ranlib #AR=$TOOL-ar
cp src/liblua.a ../lib-$OUT
cp src/*.h ../include-$OUT