Browse Source

Optimize linked binary size a bit (by half)

windows
Łukasz Magiera 7 years ago
parent
commit
29e8e625f1
  1. 4
      Makefile
  2. 6
      scripts/dependencies.sh

4
Makefile

@ -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/

6
scripts/dependencies.sh

@ -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

Loading…
Cancel
Save