--- Makefile.orig	2005-08-26 13:53:25.000000000 -0500
+++ Makefile	2007-10-09 01:54:33.000000000 -0500
@@ -1,22 +1,18 @@
 ifneq ("$(shell grep GTK2 config.h)","\#define GTK2_SUPPORT 1")
-GTK_FLAGS = `gtk-config --cflags`
-GTK_LIBS = `gtk-config --libs`
+GTK_FLAGS = `${GTK_CONFIG} --cflags`
+GTK_LIBS = `${GTK_CONFIG} --libs`
 else
 GTK_FLAGS = `pkg-config gtk+-2.0 --cflags` -D_GTK2
 GTK_LIBS = `pkg-config gtk+-2.0 --libs`
 endif
 
-CC = gcc
-#CFLAGS = -DUSE_GTK `sdl-config --cflags` $(GTK_FLAGS) -Iwrapper/ -g -mmmx -msse
-#CFLAGS = -DUSE_GTK `sdl-config --cflags` $(GTK_FLAGS) -Iwrapper/ -O3 -mcpu=athlon -ffast-math -funroll-loops -fomit-frame-pointer -msse -mmmx
-#CFLAGS = -DUSE_GTK `sdl-config --cflags` $(GTK_FLAGS) -Iwrapper/ -O3 -mcpu=athlon -ffast-math -funroll-loops -fomit-frame-pointer -msse -mmmx
-#CFLAGS = -DUSE_GTK `sdl-config --cflags` $(GTK_FLAGS) -Iwrapper/ -g -Wall
-#CFLAGS = -DUSE_GTK `sdl-config --cflags` $(GTK_FLAGS) -Iwrapper/ -O3 -mcpu=athlon -ffast-math -funroll-loops -fomit-frame-pointer
-CFLAGS = -DUSE_GTK `sdl-config --cflags` $(GTK_FLAGS) -Iwrapper/ -O3 -mcpu=athlon -ffast-math -funroll-loops -fomit-frame-pointer
-CXX = g++
+CC ?= gcc
+CXX ?= g++
+
+CFLAGS = -DUSE_GTK `${SDL_CONFIG} --cflags` $(GTK_FLAGS) -Iwrapper/ -ffast-math -funroll-loops -fomit-frame-pointer
 CPPFLAGS = $(CFLAGS)
-LD = g++
-LDFLAGS = -lGL -lGLU -L/usr/X11R6/lib `sdl-config --libs`
+LD = ${CXX}
+LDFLAGS = -lGL -lGLU `${SDL_CONFIG} --libs`
 
 OBJECTS = Main.o \
 	rdp.o \
@@ -41,11 +37,11 @@
 	wrapper/hq4x.o \
 	Config.o
 
-all: Glide64.so instruction
+all: plugins/Glide64.so instruction
 
-Glide64.so: font.h cursor.h $(OBJECTS)
+plugins/Glide64.so: font.h cursor.h $(OBJECTS)
+	mkdir -p plugins
 	$(LD) -shared -Wl,-Bsymbolic $(GTK_LIBS) $(LDFLAGS) -o $@ $(OBJECTS)
-	strip --strip-all $@
 
 font.h:	compiletex
 	./compiletex font.tex font.h font
@@ -60,7 +56,7 @@
 	    nasm -f elf $<
 
 instruction:
-	$(warning please copy Glide64.so AND Glide64.ini in the plugins/ folder of the emulator)
+	$(warning please copy plugins/Glide64.so AND Glide64.ini in the plugins/ folder of the emulator)
 
 clean:
 	rm -rf $(OBJECTS) $(ALL) compiletex compiletex.o font.h cursor.h
