--- a/makefile
+++ b/makefile
@@ -24,12 +24,15 @@
 
 CFLAGS = $(CWARNS) $(COPT) -std=c99 -I$(LUADIR) -fPIC
 CC = gcc
+AR = ar
+RANLIB = ranlib
 
 FILES = lpvm.o lpcap.o lptree.o lpcode.o lpprint.o
 
 # For Linux
 linux:
 	make lpeg.so "DLLFLAGS = -shared -fPIC"
+	make lpeg.a
 
 # For Mac OS
 macosx:
@@ -37,6 +40,10 @@
 
 lpeg.so: $(FILES)
 	env $(CC) $(DLLFLAGS) $(FILES) -o lpeg.so
+
+lpeg.a: $(FILES)
+	env $(AR) rc lpeg.a $(FILES)
+	env $(RANLIB) lpeg.a
 
 $(FILES): makefile
 
