--- ./Makefile.orig	2021-11-12 18:58:14.000000000 +0000
+++ ./Makefile	2022-03-11 12:00:02.007006320 +0000
@@ -1,19 +1,15 @@
-ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
-       CFLAGS=-O0 -fno-builtin-malloc -g -Wall -DUSE_SEMAPHORE -fPIC
-else
-       CFLAGS=-O2 -fno-builtin-malloc -g -Wall -DUSE_SEMAPHORE -fPIC
-endif
+CFLAGS+= -fno-builtin-malloc -g -Wall -D_GNU_SOURCE -DUSE_SEMAPHORE -fPIC
 
 LIBS= -lpthread
 
-prefix=$(DESTDIR)/usr
+prefix?=$(DESTDIR)/usr
 BIN_INSTALL_DIR= $(prefix)/bin
 LIB_INSTALL_DIR= $(prefix)/lib
 MAN_INSTALL_DIR= $(prefix)/share/man/man3
 
 
-CC= cc
-AR= ar
+CC?= cc
+AR?= ar
 INSTALL= install
 
 PACKAGE_SOURCE= README efence.3 Makefile efence.h \
@@ -21,18 +17,10 @@
 
 OBJECTS= efence.o page.o print.o
 
-all:	libefence.a libefence.so.0.0 tstheap eftest
-	@ echo
-	@ echo "Testing Electric Fence."
-	@ echo "After the last test, it should print that the test has PASSED."
-	./eftest
-	./tstheap 3072
-	@ echo
-	@ echo "Electric Fence confidence test PASSED." 
-	@ echo
+all:	libefence.a libefence.so.0.0
 
 install: libefence.a libefence.3 libefence.so.0.0
-#	$(INSTALL) -m 755 ef.sh $(BIN_INSTALL_DIR)/ef
+	$(INSTALL) -m 755 $(TERMUX_PKG_BUILDER_DIR)/ef.sh $(BIN_INSTALL_DIR)/ef
 	mkdir -p $(LIB_INSTALL_DIR)
 	$(INSTALL) -m 644 libefence.a $(LIB_INSTALL_DIR)/
 	$(INSTALL) -m 755 libefence.so.0.0 $(LIB_INSTALL_DIR)/
@@ -41,7 +29,7 @@
 	- rm -f $(LIB_INSTALL_DIR)/libefence.so
 	ln -s libefence.so.0 $(LIB_INSTALL_DIR)/libefence.so
 	mkdir -p $(MAN_INSTALL_DIR)
-	$(INSTALL) -m 644 libefence.3 $(MAN_INSTALL_DIR)/libefence.3
+	$(INSTALL) -Dm 644 libefence.3 $(MAN_INSTALL_DIR)/libefence.3
 
 clean:
 	- rm -f $(OBJECTS) tstheap.o eftest.o tstheap eftest \
@@ -63,7 +51,7 @@
 
 libefence.so.0.0: $(OBJECTS)
 	$(CC) -shared -Wl,-soname,libefence.so.0 -o libefence.so.0.0 \
-		$(CFLAGS) $(OBJECTS) -lpthread -lc 
+		$(CFLAGS) $(OBJECTS) $(LDFLAGS) -lc
 
 tstheap: libefence.a tstheap.o
 	- rm -f tstheap
