--- Makefile.orig	2005-05-26 13:39:40.000000000 +1000
+++ Makefile	2018-09-11 15:05:11.000000000 +1000
@@ -2,7 +2,7 @@
 MINOR=1
 CC?=gcc
 CFLAGS?=-g -O2 -Wall 
-CFLAGS+=-I. -DVERSION=\"$(MAJOR).$(MINOR)\"
+CPPFLAGS:=-I. -DVERSION=\"$(MAJOR).$(MINOR)\" $(CPPFLAGS)
 prefix?=/usr/local
 OBJS=\
 	cbtcommon/debug.o\
@@ -21,13 +21,13 @@
 all: cvsps
 
 cvsps: $(OBJS)
-	$(CC) -o cvsps $(OBJS) -lz
+	$(CC) $(LDFLAGS) -o cvsps $(OBJS) -lz
 
 install:
-	[ -d $(prefix)/bin ] || mkdir -p $(prefix)/bin
-	[ -d $(prefix)/share/man/man1 ] || mkdir -p $(prefix)/share/man/man1
-	install cvsps $(prefix)/bin
-	install -m 644 cvsps.1 $(prefix)/share/man/man1
+	[ -d $(DESTDIR)$(prefix)/bin ] || mkdir -p $(DESTDIR)$(prefix)/bin
+	[ -d $(DESTDIR)$(prefix)/share/man/man1 ] || mkdir -p $(DESTDIR)$(prefix)/share/man/man1
+	install cvsps $(DESTDIR)$(prefix)/bin
+	install -m 644 cvsps.1 $(DESTDIR)$(prefix)/share/man/man1
 
 clean:
 	rm -f cvsps *.o cbtcommon/*.o core
