--- Makefile.orig
+++ Makefile
@@ -20,9 +20,8 @@
 
 include Makefile.cfg
 
-export CC = gcc -pthread
-export CFLAGS += -I. -Wall -Os -ggdb -D_GNU_SOURCE -fPIC
-export LDLIBS += -lncursesw
+override export CFLAGS += -I. -Wall -D_GNU_SOURCE -fPIC -pthread
+export LDLIBS += -lncursesw -lpthread
 
 SONAME  := libstfl.so.0
 VERSION := 0.24
@@ -39,7 +38,7 @@ libstfl.a: public.o base.o parser.o dump
 
 libstfl.so.$(VERSION): public.o base.o parser.o dump.o style.o binding.o iconv.o \
                        $(patsubst %.c,%.o,$(wildcard widgets/*.c))
-	$(CC) -shared -Wl,-soname,$(SONAME) -o $@ $(LDLIBS) $^
+	$(CC) -shared -Wl,-soname,$(SONAME) -o $@ $(LDLIBS) $(LDFLAGS) $^
 
 clean:
 	rm -f libstfl.a example core core.* *.o Makefile.deps
