--- Makefile.orig	2009-12-21 18:58:35.000000000 -0800
+++ Makefile	2012-05-16 00:49:03.000000000 -0700
@@ -32,10 +32,10 @@
 # BINDIR directory.  Files needed at run time will
 # be installed in the SHAREDIR directory.
 
-BINDIR=/usr/local/bin
+BINDIR=%%PREFIX%%/bin
 #BINDIR=/usr/bin
 
-SHAREDIR=/usr/local/share/fl_moxgen
+SHAREDIR=%%DATADIR%%
 #SHAREDIR=/usr/share/fl_moxgen
 
 # If libHaru is installed, be sure that LIBHARU_INC
@@ -44,30 +44,24 @@
 # accordingly.  If libHaru is not installed, 
 # comment out both lines.
 
-LIBHARU_INC = /usr/local/include
+LIBHARU_INC = %%LOCALBASE%%/include
 #LIBHARU_INC = /usr/include
 
-# Set the FLTK_INC variable to be the location of the 
-# include files for FLTK.
-
-FLTK_INC = /usr/include
-#FLTK_INC = /usr/local/include
-
 all:
 	@if [ -f $(LIBHARU_INC)/hpdf.h ]; \
 	then $(MAKE) fl_moxgen; \
 	else $(MAKE) fl_moxgen_no_pdf; fi
 
 write_pdf.o: write_pdf.c
-	@$(CC) -c -o write_pdf.o write_pdf.c
+	@$(CC) -c -o write_pdf.o write_pdf.c -I$(LIBHARU_INC)
 
 fl_moxgen: fl_moxgen.cxx fl_moxgen_defines.h write_pdf.o
 	@echo "Building Fl_MoxGen with PDF support"
-	$(CXX) -o fl_moxgen fl_moxgen.cxx write_pdf.o -I$(FLTK_INC) -I. -lfltk -lfltk_images -lhpdf
+	$(CXX) -o fl_moxgen fl_moxgen.cxx write_pdf.o -I. `fltk-config --use-images --cxxflags --ldflags` -lhpdf
 
 fl_moxgen_no_pdf: fl_moxgen.cxx fl_moxgen_defines.h
 	@echo "Building Fl_MoxGen without PDF support"
-	$(CXX) -o fl_moxgen fl_moxgen.cxx -I$(FLTK_INC) -I. -lfltk -lfltk_images
+	$(CXX) -o fl_moxgen fl_moxgen.cxx -I. `fltk-config --use-images --cxxflags --ldflags`
 
 fl_moxgen_defines.h:
 	@rm -f fl_moxgen_defines.h
