diff --git a/Makefile b/Makefile index caf2463..8637ed4 100644 --- a/Makefile +++ b/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/ diff --git a/scripts/dependencies.sh b/scripts/dependencies.sh index 198ea52..bcdff78 100755 --- a/scripts/dependencies.sh +++ b/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