--- ../gkermit/makefile	1999-12-26 22:28:38.000000000 +0200
+++ ./makefile	2017-12-16 13:45:36.154185777 +0200
@@ -29,16 +29,16 @@
 
 # Sample installation values - change or override as needed.
 
-BINDIR = /usr/local/bin
-MANDIR = /usr/man/manl
-TEXTDIR = /usr/local/doc
-INFODIR = /usr/local/info
-MANEXT = l
+BINDIR = $(prefix)/bin
+MANDIR = $(prefix)/share/man/man1
+TEXTDIR = $(prefix)/doc
+INFODIR = $(prefix)/info
+MANEXT = 1
 
 # Default compiler and flags
 
-CC=cc
-CFLAGS= -DPOSIX -O $(KFLAGS)
+GWART_CC = cc
+CFLAGS= -DPOSIX -O $(KFLAGS) -DERRNO_H
 
 # Object files
 
@@ -49,10 +49,10 @@
 all:		gwart gkermit
 
 gwart.o:	gwart.c
-		$(CC) $(CFLAGS) -c gwart.c
+		$(GWART_CC) $(CFLAGS) -c gwart.c
 
 gwart:		gwart.o
-		$(CC) -o gwart gwart.o
+		$(GWART_CC) -o gwart gwart.o
 
 .c.o:
 		$(CC) $(CFLAGS) -c $<
@@ -67,7 +67,8 @@
 gcmdline.o:	gcmdline.c gkermit.h
 
 gkermit:	gproto.o gkermit.o gunixio.o gcmdline.o
-		$(CC) -o gkermit $(OBJECTS)
+		$(CC) -o gkermit -v $(LDFLAGS) -landroid-support \
+		-L$(prefix)/lib -fPIE -pie $(OBJECTS)
 
 bsd:		gwart
 		$(MAKE) "CC=$(CC)" "CFLAGS=-DBSD -O $(KFLAGS)" gkermit
@@ -118,6 +119,13 @@
 		@cp README $(TEXTDIR)/gkermit.txt
 		@chmod 644 $(TEXTDIR)/gkermit.txt
 		@ls -lg $(TEXTDIR)/gkermit.txt
+		@if test -d $(MANDIR); then \
+		    echo "$(MANDIR) exists..." ; \
+		else \
+		    echo "Creating $(MANDIR)/..." ; \
+		    mkdir -p $(MANDIR) ; \
+		    chmod 755 $(MANDIR) ; \
+		fi
 		@echo Installing man page in $(MANDIR)/gkermit.$(MANEXT)...
 		@cp gkermit.nr $(MANDIR)/gkermit.$(MANEXT)
 		@chmod 644 $(MANDIR)/gkermit.$(MANEXT)
