--- Makefile.orig	2011-04-04 15:57:55.000000000 -0400
+++ Makefile	2011-04-16 11:11:52.000000000 -0400
@@ -1,34 +1,26 @@
 # ebook2cw Makefile -- Fabian Kurz, DJ1YFK -- http://fkurz.net/ham/ebook2cw.html
 
 VERSION=0.8.1
-DESTDIR ?= /usr
+DESTDIR ?= /usr/local
+CC	?= gcc
 
-# Set to NO to compile without Lame/Ogg-vorbis support
-USE_LAME?=YES
-USE_OGG?=YES
 
 CFLAGS:=$(CFLAGS) -D DESTDIR=\"$(DESTDIR)\" -D VERSION=\"$(VERSION)\"
 
-ifeq ($(USE_LAME), YES)
-		CFLAGS:=$(CFLAGS) -D LAME
-		LDFLAGS:=$(LDFLAGS) -lmp3lame 
-endif
-ifeq ($(USE_OGG), YES)
-		CFLAGS:=$(CFLAGS) -D OGGV
-		LDFLAGS:=$(LDFLAGS) -lvorbis -lvorbisenc -logg
-endif
+CFLAGS+= -I/usr/local/include -D LAME -D OGGV
+LDFLAGS+= -L/usr/local/lib -lmp3lame -lvorbis -lvorbisenc -logg
 
 
-all: ebook2cw
+all: ebook2cw cgi
 
 ebook2cw: ebook2cw.c codetables.h
-	gcc ebook2cw.c -pedantic -Wall -lm $(LDFLAGS) $(CFLAGS) -o ebook2cw
+	${CC} ebook2cw.c -pedantic -Wall -lm $(LDFLAGS) $(CFLAGS) -o ebook2cw
 
 cgi: ebook2cw.c codetables.h
-	gcc -static ebook2cw.c $(LDFLAGS) -lm $(CFLAGS) -D CGI -o cw.cgi
+	${CC} -static ebook2cw.c $(LDFLAGS) -lm $(CFLAGS) -D CGI -o cw.cgi
 
 static:
-	gcc -static ebook2cw.c $(LDFLAGS) -lm $(CFLAGS) -o ebook2cw
+	${CC} -static ebook2cw.c $(LDFLAGS) -lm $(CFLAGS) -o ebook2cw
 
 install:
 	install -d -v                      $(DESTDIR)/share/man/man1/
@@ -41,7 +33,7 @@
 	install    -m 0644 ebook2cw.conf   $(DESTDIR)/share/doc/ebook2cw/examples/
 	install    -m 0644 isomap.txt      $(DESTDIR)/share/doc/ebook2cw/examples/
 	install    -m 0644 utf8map.txt     $(DESTDIR)/share/doc/ebook2cw/examples/
-	
+
 uninstall:
 	rm -f $(DESTDIR)/bin/ebook2cw
 	rm -f $(DESTDIR)/share/man/man1/ebook2cw.1
