diff --git a/Box/Makefile b/Box/Makefile
index b8f25d84774d925ddaa0cdec0e77380465998a26..7f1197ef36540083c7916947e421b7a18ac06377 100644
--- a/Box/Makefile
+++ b/Box/Makefile
@@ -1,4 +1,4 @@
-# $Id: Makefile,v 1.35 2007-03-18 14:12:20 geuzaine Exp $
+# $Id: Makefile,v 1.36 2007-04-21 20:20:57 geuzaine Exp $
 #
 # Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle
 #
@@ -23,7 +23,8 @@ include ../variables
 
 LIB     = ../lib/libGmshBox.a
 INCLUDE = -I../Common -I../DataStr -I../Geo -I../Graphics -I../Mesh -I../Numeric\
-          -I../Parser -I../Fltk -I../Plugin -I../Parallel
+          -I../Parser -I../Fltk -I../Plugin -I../Parallel\
+          -I../contrib/ANN/include
 CFLAGS  = ${OPTIM} ${FLAGS} ${INCLUDE} 
 
 SRC = Box.cpp
@@ -56,22 +57,19 @@ Box.o: Box.cpp ../Common/Gmsh.h ../Common/Message.h ../DataStr/Malloc.h \
   ../DataStr/List.h ../DataStr/Tree.h ../Common/OS.h ../Numeric/Numeric.h \
   ../Geo/Geo.h ../Common/GmshDefines.h ../Geo/gmshSurface.h ../Geo/Pair.h \
   ../Geo/Range.h ../Geo/SPoint2.h ../Geo/SPoint3.h ../Geo/SVector3.h \
-  ../Geo/SPoint3.h ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h \
-  ../Geo/SPoint2.h ../Geo/ExtrudeParams.h ../Common/SmoothData.h \
-  ../Mesh/Generator.h ../Common/Views.h ../Common/ColorTable.h \
-  ../Common/VertexArray.h ../Common/SmoothData.h \
-  ../Common/AdaptiveViews.h ../Common/GmshMatrix.h ../Parser/Parser.h \
-  ../Common/Context.h ../Common/Options.h ../Parser/OpenFile.h \
-  ../Common/CommandLine.h ../Parser/CreateFile.h ../Parallel/ParUtil.h \
-  ../Plugin/PluginManager.h ../Plugin/Plugin.h ../Geo/GModel.h \
-  ../Geo/GVertex.h ../Geo/GEntity.h ../Geo/Range.h ../Geo/SPoint3.h \
-  ../Geo/SBoundingBox3d.h ../Geo/MVertex.h ../Geo/SPoint3.h \
-  ../Geo/GPoint.h ../Geo/SPoint2.h ../Geo/GEdge.h ../Geo/GEntity.h \
-  ../Geo/GVertex.h ../Geo/SVector3.h ../Geo/SPoint3.h ../Geo/SPoint2.h \
-  ../Geo/MElement.h ../Geo/MVertex.h ../Geo/MEdge.h ../Geo/MVertex.h \
-  ../Geo/SVector3.h ../Common/Hash.h ../Geo/MFace.h ../Geo/MVertex.h \
-  ../Geo/SVector3.h ../Geo/ExtrudeParams.h ../Geo/GFace.h ../Geo/GPoint.h \
-  ../Geo/GEntity.h ../Geo/GEdgeLoop.h ../Geo/GEdge.h ../Geo/MElement.h \
-  ../Geo/SPoint2.h ../Geo/SVector3.h ../Geo/Pair.h ../Geo/ExtrudeParams.h \
-  ../Geo/GRegion.h ../Geo/GEntity.h ../Geo/MElement.h \
-  ../Geo/ExtrudeParams.h ../Geo/SBoundingBox3d.h
+  ../Geo/SBoundingBox3d.h ../DataStr/List.h ../DataStr/Tree.h \
+  ../Geo/ExtrudeParams.h ../Common/SmoothData.h ../Numeric/Numeric.h \
+  ../Mesh/Generator.h ../Parser/Parser.h ../DataStr/List.h \
+  ../DataStr/Tree.h ../Common/Context.h ../Common/Options.h \
+  ../Parser/OpenFile.h ../Common/CommandLine.h ../Parser/CreateFile.h \
+  ../Parallel/ParUtil.h ../Plugin/PluginManager.h ../Plugin/Plugin.h \
+  ../Common/Options.h ../Common/Message.h ../Common/Views.h \
+  ../Common/ColorTable.h ../Common/VertexArray.h ../Common/SmoothData.h \
+  ../Common/AdaptiveViews.h ../Common/GmshMatrix.h ../Common/GmshMatrix.h \
+  ../Geo/GModel.h ../Geo/GVertex.h ../Geo/GEntity.h ../Geo/MVertex.h \
+  ../Geo/GPoint.h ../Geo/GEdge.h ../Geo/MElement.h ../Geo/MEdge.h \
+  ../Common/Hash.h ../Geo/MFace.h ../Numeric/Numeric.h \
+  ../Common/Context.h ../Geo/GFace.h ../Geo/GEdgeLoop.h ../Geo/GRegion.h \
+  ../Mesh/Field.h ../Common/Views.h ../contrib/ANN/include/ANN/ANN.h \
+  ../Geo/Geo.h ../Geo/GEdge.h ../Common/OctreePost.h ../Common/Octree.h \
+  ../Common/OctreeInternals.h ../Mesh/BackgroundMesh.h
diff --git a/Mesh/Makefile b/Mesh/Makefile
index 04493c6c431b5f3e7a7dc3b1d1128a59c7e77a74..5fad58f3703e7f5f7e7e63a14143fb7d51d564ca 100644
--- a/Mesh/Makefile
+++ b/Mesh/Makefile
@@ -1,4 +1,4 @@
-# $Id: Makefile,v 1.170 2007-04-21 19:40:00 geuzaine Exp $
+# $Id: Makefile,v 1.171 2007-04-21 20:20:57 geuzaine Exp $
 #
 # Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle
 #
@@ -59,6 +59,10 @@ ${LIB}: ${OBJ}
 .cpp.o:
 	${CXX} ${CFLAGS} -c $<
 
+# Don't optimize BDS: it crashes with some flavors of gcc 4.1 (e.g. on debian etch)
+BDS.o:
+	${CXX} ${FLAGS} ${INCLUDE} -c $<
+
 clean:
 	rm -f *.o