--- Makefile.old	2008-04-01 03:13:19.000000000 +0200
+++ Makefile	2008-04-01 04:08:59.000000000 +0200
@@ -3,8 +3,10 @@
 # User Options
 #######################################################################
 
+DESTDIR =
+
 # Directory where qiv will be installed under.
-PREFIX = /usr/local
+PREFIX = /usr
 
 # Font to use for statusbar in fullscreen mode
 STATUSBAR_FONT = "fixed"
@@ -36,7 +38,6 @@ GTD_XINERAMA = -DGTD_XINERAMA
 
 ######################################################################
 
-# The following only apply to 'make install-xscreensaver':
 # Delay in minutes to start xscreensaver
 SS_TIMEOUT = 5
 
@@ -47,7 +48,7 @@ SS_CYCLE = 5
 SS_DELAY = 5
 
 # Image files to display
-SS_IMAGES = ~/pictures/*.jpg
+SS_IMAGES = ~/*.jpg
 
 # Comment out this line to have pictures be dislayed sequentially
 SS_RANDOMIZE = -r
@@ -61,20 +62,9 @@ CC        = gcc
 CFLAGS    = -O2 -Wall \
 	    -fcaller-saves -ffast-math -fno-strength-reduce \
 	    -fthread-jumps #-march=pentium #-DSTAT_MACROS_BROKEN
-#CFLAGS    = -O2 -Wall -fomit-frame-pointer -finline-functions \
-#	    -fcaller-saves -ffast-math -fno-strength-reduce \
-#	    -fthread-jumps #-march=pentium #-DSTAT_MACROS_BROKEN
-
-INCLUDES  = `imlib-config --cflags-gdk`
-LIBS      = `imlib-config --libs-gdk`
-# [as] thinks that this is not portable enough
-# [lc] I use a virtual screen of 1600x1200, and the resolution is 1024x768,
-# so I changed (in main.c) how screen_[x,y] is obtained; it seems that gtk
-# 1.2 cannot give the geometry of viewport, so I borrowed from the source
-# of xvidtune the code for calling XF86VidModeGetModeLine, this requires
-# the linking option -lXxf86vm.
-#LIBS      = `imlib-config --libs-gdk` -lXxf86vm
 
+INCLUDES  = $(shell imlib-config --cflags-gdk)
+LIBS      = $(shell imlib-config --libs-gdk)
 PROGRAM   = qiv
 OBJS      = main.o image.o event.o options.o utils.o xmalloc.o
 HEADERS   = qiv.h
@@ -84,7 +74,7 @@ DEFINES   = $(patsubst %,-DEXTN_%, $(EXT
             -DCENTER=$(CENTER) \
             -DFILTER=$(FILTER) \
             -DCURSOR=$(CURSOR) \
-	    $(GTD_XINERAMA)
+	    			$(GTD_XINERAMA)
 
 ifndef GETOPT_LONG
 OBJS     += lib/getopt.o lib/getopt1.o
@@ -92,14 +82,15 @@ OBJS_G   += lib/getopt.g lib/getopt1.g
 endif
 
 ifdef GTD_XINERAMA
-LIBS	 += -L/usr/X11R6/lib -lXinerama
+LIBS	 += -L/usr/lib/X11 -lXinerama
 endif
 
 PROGRAM_G = qiv-g
 OBJS_G    = $(OBJS:.o=.g)
 DEFINES_G = $(DEFINES) -DDEBUG
 
-SS_PROG   = $(PREFIX)/ss-qiv
+SS_PROG   = $(PREFIX)/bin/ss-qiv
+SS_CONF   = $(PREFIX)/etc/qivrc
 
 ######################################################################
 
@@ -134,23 +125,8 @@ distclean : clean
 
 install: $(PROGRAM)
 	@echo "Installing QIV..."
-	install -s -m 0755 $(PROGRAM) $(PREFIX)/bin
-	install -m 0644 $(PROGRAM).1 $(PREFIX)/man/man1
-	$(COMPRESS_PROG) $(PREFIX)/man/man1/$(PROGRAM).1
-	@if ./qiv -f ./intro.jpg ; \
-	then echo "-- Test Passed --" ; \
-	else echo "-- Test Failed --" ; \
-	fi
-	@echo -ne "\nDont forget to look into the \"qiv-command\" file and install it!\n-> cp qiv-command.example /usr/local/bin/qiv-command\n\n" 
-
-install-xscreensaver: install
-	@echo "#!/bin/sh" > $(SS_PROG)
-	@echo "xhost +`hostname` 1> /dev/null" >> $(SS_PROG)
-	@echo "xrdb < ~/.qivrc" >> $(SS_PROG)
-	@echo "xscreensaver 1> /dev/null &" >>  $(SS_PROG)
-	@echo "xscreensaver.timeout: $(SS_TIMEOUT)" > ~/.qivrc
-	@echo "xscreensaver.cycle: $(SS_CYCLE)" >> ~/.qivrc
-	@echo "xscreensaver.programs: qiv -iftsd $(SS_DELAY) $(SS_RANDOMIZE) $(SS_IMAGES)" >> ~/.qivrc
-	echo "Start screensaver with ss-qiv"
+	install -D -m 0755 $(PROGRAM) $(DESTDIR)/$(PREFIX)/bin/$(PROGRAM)
+	install -D -m 0755 $(PROGRAM)-command.example $(DESTDIR)/$(PREFIX)/bin/$(PROGRAM)-command
+	install -D -m 0644 $(PROGRAM).1 $(DESTDIR)/$(PREFIX)/man/man1/$(PROGRAM).1
 
 # the end... ;-)
