--- Makefile.orig
+++ Makefile
@@ -46,7 +46,7 @@
 # remove the examples directory from this line.
 # If you want to build the XmHTML tutorial examples, add the book directory.
 
-SUBDIRS= lib http examples tools
+SUBDIRS= lib http
 
 # some common definitions
 #
@@ -61,7 +61,7 @@
 RANLIB= ranlib
 
 SHELL     = /bin/sh
-MAKE      = make 
+#MAKE      = make
 # change this to makedepend if your system doesn't have gcc
 MAKEDEPEND= gccmakedep
 
@@ -70,9 +70,9 @@
 # Compiler Settings #
 #                   #
 #####################
-CC       = gcc
-CFLAGS   = -g -funroll-loops -Wall -pipe -ansi $(EXTRA_CFLAGS)
-LDFLAGS  = 
+#CC       = gcc
+#CFLAGS   = -g -funroll-loops -Wall -pipe -ansi $(EXTRA_CFLAGS)
+#LDFLAGS  = 
 
 # The following flags are *very* usefull if you are getting unresolved
 # references to functions in libraries that you *know* to exist.
@@ -125,7 +125,7 @@
 # HAVE_LIBZ => zlib.h
 
 ZLIBINC       =
-IMAGEINCLUDES = $(ZLIBINC)
+IMAGEINCLUDES = `libpng-config --cflags` -I${LOCALBASE}/include $(ZLIBINC)
 
 # Image libraries
 # No need to add -lXpm if you need to include it with LIBS below
@@ -136,7 +136,7 @@
 # HAVE_LIBZ => libz (and possibly libm)
 
 ZLIBLIB   = -lz -lm
-IMAGELIBS = -ljpeg -lpng $(ZLIBLIB)
+IMAGELIBS = `libpng-config --libs` -L${LOCALBASE}/lib -ljpeg $(ZLIBLIB)
 
 # It might be troublesome to know what the correct defines are for your
 # system. A possible set of defines for some OS's is given below. Pick
@@ -176,7 +176,7 @@
 # Add -DDEBUG to enable selective debug output (see the file DEBUGGING for more
 # info).
 #
-CPPFLAGS = -D_GNU_SOURCE -D_BSD_SOURCE -D_POSIX_SOURCE -DHAVE_REGEX_H \
+CPPFLAGS = -DHAVE_REGEX_H \
 	$(EXTRA_CPPFLAGS) \
 	$(IMAGEDEFINES) \
 	$(XFT_DEFINES)
@@ -186,7 +186,7 @@
 
 # Platform specific includes
 ifeq ($(PLATFORM),Motif)
-PLATFORMINC=-I../../include/XmHTML -I/usr/X11R6/include -I/usr/include/freetype2
+PLATFORMINC=-I../../include/XmHTML `pkg-config --cflags xft`
 else
 ifeq ($(PLATFORM),gtk)
 PLATFORMINC=\
@@ -209,7 +209,7 @@
 # Motif version (default)
 ifeq ($(PLATFORM),Motif)
 
-LIBDIR = -L/usr/X11R6/lib
+LIBDIR = -L${LOCALBASE}/lib
 # This is what is required under Linux (Motif 2.0.1).
 # Your mileage may vary.
 LIBS   = -lXm -lXpm -lXmu -lXt -lXext -lX11 -lSM -lICE 
