--- examples/Makefile.orig	Wed Sep 26 11:32:03 2007
+++ examples/Makefile	Wed Sep 26 22:04:27 2007
@@ -41,10 +41,10 @@
 # Set correct variables and paths
 #---------------------------------
 CIMG_VERSION = 1.24
-CC           = g++
-X11PATH      = /usr/X11R6
-CFLAGS       = -Wall -W -ansi -pedantic -ffast-math
-LDFLAGS      = -lm -lpthread
+CC           = $(CXX)
+#X11PATH      = /usr/X11R6
+#CFLAGS       = -Wall -W -ansi -pedantic -ffast-math
+#LDFLAGS      = -lm -lpthread
 
 #--------------------------------------------------
 # Set compilation flags allowing to customize CImg
@@ -86,6 +86,9 @@
 # Flags to compile on Solaris
 CIMG_SOLARIS_FLAGS = -R$(X11PATH)/lib -lrt -lnsl -lsocket
 
+# Flags to compile on FreeBSD
+CIMG_FREEBSD_FLAGS = -ansi -ffast-math  -I$(X11PATH)/include $(EXTRA_FLAGS) -lX11 -L$(X11PATH)/lib
+
 # Set default compilation flags.
 # Uncomment lines here, if you want to customize your default configuration
 CIMG_DEFAULT_FLAGS = $(CIMG_X11_FLAGS) \
@@ -142,7 +145,7 @@
 all: $(CIMG_FILES)
 
 clean:
-	rm -f *.exe *~ jpeg_buffer greycstoration4gimp $(CIMG_FILES)
+	rm -f *.exe *~ jpeg_buffer greycstoration4gimp $(CIMG_FILES) Makefile.orig
 
 greycstoration4gimp: greycstoration4gimp.cpp
 	@echo
@@ -162,6 +165,12 @@
 Mlinux:
 	make "ARCHFLAGS=-O3 $(CIMG_ALL_FLAGS)" all jpeg_buffer greycstoration4gimp
 
+# FreeBSD targets
+dFreeBSD:
+	make "ARCHFLAGS=$(CIMG_FREEBSD_FLAGS) $(CIMG_DEFAULT_FLAGS)" all
+
+oFreeBSD:
+	make "ARCHFLAGS=$(CIMG_FREEBSD_FLAGS) $(CIMG_ALL_FLAGS)" all
 # Sun Solaris targets
 solaris:
 	make "ARCHFLAGS=$(CIMG_SOLARIS_FLAGS) $(CIMG_DEFAULT_FLAGS)" all
