--- Makefile	2018-02-23 05:27:24.471990919 +0000
+++ src/Makefile	2018-02-23 05:45:28.024744930 +0000
@@ -20,13 +20,13 @@
 # packaging this with an O/S, for example, you'll probably want to change
 # this to /usr.  Otherwise, /usr/local is probably more appropriate, unless
 # you're replacing the vendor-supplied version.
-prefix=/usr
+prefix=@TERMUX_PREFIX@
 
 # This is where the install step puts it.
 EXDIR=${prefix}/bin
 
 # This is where the man page goes.
-MANDIR=${prefix}/man/man1
+MANDIR=${prefix}/share/man/man1
 MANEXT=1
 MANMODE=644
 
@@ -331,13 +331,14 @@
 
 #########################################
 # Use this for Linux
-CC=gcc
+# CC=gcc
 # Only use -Wall for testing, since it produces warnings that are of no
 # real effect on the reliability of the program, but may concern some
 # people who don't understand them.
 #CFLAGS=-DSYSV3 -O2 -Wall -pipe
-CFLAGS=-DSYSV3 -O2 -pipe
-LIB=-lm -lncurses
+CFLAGS+=-DSYSV3
+
+LIB=-L$(prefix)/lib -lm -lncurses
 
 # All of the source files
 SRC=Makefile abbrev.c cmds.c color.c crypt.c eres.sed frame.c format.c gram.y \
@@ -500,15 +501,15 @@
 
 $(EXDIR)/$(name): $(name)
 	cp $(name) $(EXDIR)
-	strip $(EXDIR)/$(name)
+	$(STRIP) $(EXDIR)/$(name)
 
 $(EXDIR)/$(name)qref: $(name)qref
 	cp $(name)qref $(EXDIR)
-	strip $(EXDIR)/$(name)qref
+	$(STRIP) $(EXDIR)/$(name)qref
 
 $(EXDIR)/p$(name): p$(name)
 	cp p$(name) $(EXDIR)
-	strip $(EXDIR)/p$(name)
+	$(STRIP) $(EXDIR)/p$(name)
 
 $(LIBDIR)/tutorial: tutorial.sc $(LIBDIR)
 	-mkdir -p $(LIBDIR)/plugins
