--- a/src/Makefile
+++ b/src/Makefile
@@ -2,7 +2,7 @@
 name = sc-im
 
 # The base directory where everything should be installed.
-prefix  = /usr/local
+prefix  = @TERMUX_PREFIX@
 
 EXDIR   = $(prefix)/bin
 HELPDIR = $(prefix)/share/$(name)
@@ -20,10 +20,11 @@
 
 # Change these to your liking or use `make CC=gcc` etc
 #CC   = cc
-#YACC = bison -y
+YACC = bison -y
 #SED  = sed
 
 LDLIBS += -lm
+LDLIBS += -landroid-support
 
 CFLAGS += -Wall -g
 CFLAGS += -DNCURSES
@@ -47,7 +48,7 @@
 # Comment out to disable undo/redo support
 CFLAGS += -DUNDO
 # Maximum number of rows in spreadsheet. Up to 1048576
-CFLAGS += -DMAXROWS=65536
+CFLAGS += -DMAXROWS=1048576
 # Used for date formatting with C-d shortcut using you local d_fmt
 CFLAGS += -DUSELOCALE
 # Comment out to enable mouse support on virtual terminal.
@@ -134,10 +135,10 @@
   endif
 
   # NOTE: lua support
-  ifneq ($(shell pkg-config --exists lua || echo 'no'),no) # Check for user's default lua
-    CFLAGS += -DXLUA $(shell pkg-config --cflags lua)
+  ifneq ($(shell pkg-config --exists lua51 || echo 'no'),no) # Check for user's default lua
+    CFLAGS += -DXLUA $(shell pkg-config --cflags lua51)
     ifneq ($(shell uname -s),Darwin)
-      LDLIBS += $(shell pkg-config --libs lua) -Wl,--export-dynamic
+      LDLIBS += $(shell pkg-config --libs lua51) -Wl,--export-dynamic
     else
       LDLIBS += $(shell pkg-config --libs lua) -rdynamic
     endif
@@ -213,6 +214,9 @@
 statres.h : gram.y sres.sed
 	sed -f sres.sed < $< > $@
 
+gram.y :
+	$(YACC) gram.y
+
 pvmtbl.o: sc.h pvmtbl.c
 	$(CC) ${CFLAGS} -c -DPSC pvmtbl.c
 
