--- a/src/Makefile
+++ b/src/Makefile
@@ -1,23 +1,35 @@
 # if compiling for SunOS, you need to add -lsocket to the LIBS variable
 
 SH	= /bin/sh
-CC	= gcc
+CC	= g++
 MAKEFILE= Makefile
-CFLAGS	= -O2 --pipe
+CFLAGS	= -O2 -pipe -Wall -Wshadow
 LIBS	=
 
+ifneq (,$(findstring debug,$(DEB_BUILD_OPTIONS)))
+  CFLAGS += -g
+endif
+
+ifeq ($(shell uname),Linux)
+  CFLAGS += -DHAVE_SENDFILE
+endif
+
 OBJECTS = main.o socket.o httpsock.o
 
 .cc.o:
 	$(CC) $(CFLAGS) -c -o $*.o $<
 
-all:	compile dhttpd
+all: dhttpd
 
-compile: $(OBJECTS)
+compile: dhttpd
 
 dhttpd: $(OBJECTS)
 	$(CC) -o dhttpd $(OBJECTS) $(LIBS)
-	strip dhttpd
+
+install: dhttpd
+	install dhttpd $(DESTDIR)/usr/bin
 
 clean:
-	rm dhttpd $(OBJECTS)
+	rm -f dhttpd $(OBJECTS)
+
+distclean: clean
