--- vnc_reflector.orig/Makefile	2003-04-16 19:32:42.000000000 +0200
+++ vnc_reflector/Makefile	2011-01-20 14:16:58.854910770 +0100
@@ -14,10 +14,10 @@
 #
 # Variables you might want to edit: CFLAGS, CONFFLAGS
 
-IFLAGS =	-I.
+CPPFLAGS ?=	-I.
 
 # Production
-CFLAGS =	-O2 $(IFLAGS)
+CFLAGS ?=	-O2
 # Debug (strict)
 #CFLAGS =	-g -pedantic -Wall $(IFLAGS)
 # Debug (profiling)
@@ -26,10 +26,10 @@ CFLAGS =	-O2 $(IFLAGS)
 #CFLAGS =	-g $(IFLAGS)
 
 # Use poll(2) syscall in async I/O instead of select(2)
-CONFFLAGS =	-DUSE_POLL
+CPPFLAGS +=	-DUSE_POLL
 
 # Link with zlib and JPEG libraries
-LDFLAGS =	-L/usr/local/lib -lz -ljpeg
+LDFLAGS ?=	-L/usr/local/lib -lz -ljpeg
 
 PROG = 	vncreflector
 
@@ -43,14 +43,14 @@ SRCS =	main.c logging.c active.c actions
 	control.c encode_tight.c decode_hextile.c decode_tight.c fbs_files.c \
 	region_more.c
 
-CC = gcc
+CC ?= gcc
 MAKEDEPEND = makedepend
 MAKEDEPFLAGS = -Y
 
-default: $(PROG)
+all: $(PROG)
 
 $(PROG): $(OBJS)
-	$(CC) $(CFLAGS) -o $(PROG) $(OBJS) $(LDFLAGS)
+	$(CC) $(LDFLAGS) -o $(PROG) $(OBJS) $(LIBS)
 
 clean: 
 	rm -f $(OBJS) *core* ./*~ ./*.bak $(PROG)
@@ -59,7 +59,7 @@ depend: $(SRCS)
 	$(MAKEDEPEND) $(MAKEDEPFLAGS) -I. $(SRCS) 2> /dev/null
 
 .c.o:
-	$(CC) $(CFLAGS) $(CONFFLAGS) -c $<
+	$(CC) $(CPPFLAGS) $(CFLAGS) -c $<
 
 
 # DO NOT DELETE
