--- a/Makefile
+++ b/Makefile
@@ -19,13 +19,13 @@
 endif
 
 CFLAGS ?= -Wall -Wextra -pedantic -O2
-LUA_CFLAGS := $(shell pkg-config --cflags --libs $(lua_package))
+LUA_CFLAGS := $(shell pkg-config --cflags $(lua_package))
 
 .PHONY: all
 all: subprocess.so subprocess.html
 
 subprocess.so: $(SOURCES)
-	$(CC) $(CFLAGS) $(LUA_CFLAGS) -DOS_POSIX -shared -fPIC -o $@ $(SOURCES)
+	$(CC) $(CFLAGS) $(LUA_CFLAGS) -DOS_POSIX -DSHARE_LIOLIB -shared -fPIC -o $@ $(SOURCES)
 
 subprocess.html: subprocess.txt
 	$(ASCIIDOC) $<
