--- a/src/index/Makefile
+++ b/src/index/Makefile
@@ -1,4 +1,5 @@
-include ../mk/sysconf
+depth = ..
+include $(depth)/mk/sysconf
 
 PROGS = recollindex csguess mimetype
 SRCS = recollindex.cpp
@@ -7,35 +8,35 @@
 
 RECOLLINDEX_OBJS= recollindex.o $(BIGLIB) $(MIMELIB)
 recollindex : $(RECOLLINDEX_OBJS)
-	$(CXX) $(CXXFLAGS) -o recollindex $(RECOLLINDEX_OBJS) \
+	$(CXX) $(ALL_CXXFLAGS) -o recollindex $(RECOLLINDEX_OBJS) \
 	       $(BSTATIC) $(LIBXAPIAN) $(LIBICONV) $(BDYNAMIC) $(LIBSYS)
 recollindex.o : recollindex.cpp
-	$(CXX) $(CXXFLAGS) -c -o recollindex.o $<
+	$(CXX) $(ALL_CXXFLAGS) -c -o recollindex.o $<
 
 CSGUESS_OBJS= trcsguess.o  $(BIGLIB) 
 csguess : $(CSGUESS_OBJS)
-	$(CXX) $(CXXFLAGS) -o csguess $(CSGUESS_OBJS) \
+	$(CXX) $(ALL_CXXFLAGS) -o csguess $(CSGUESS_OBJS) \
 	       $(LIBICONV)
 trcsguess.o : csguess.cpp
-	$(CXX) $(CXXFLAGS) -DTEST_CSGUESS -c -o trcsguess.o \
+	$(CXX) $(ALL_CXXFLAGS) -DTEST_CSGUESS -c -o trcsguess.o \
 	       csguess.cpp
 
 MIMETYPE_OBJS= trmimetype.o  $(BIGLIB) 
 mimetype : $(MIMETYPE_OBJS)
-	$(CXX) $(CXXFLAGS) -o mimetype $(MIMETYPE_OBJS) \
+	$(CXX) $(ALL_CXXFLAGS) -o mimetype $(MIMETYPE_OBJS) \
 	       $(LIBICONV) $(LIBSYS)
 trmimetype.o : mimetype.cpp
-	$(CXX) $(CXXFLAGS) -DTEST_MIMETYPE -c -o trmimetype.o \
+	$(CXX) $(ALL_CXXFLAGS) -DTEST_MIMETYPE -c -o trmimetype.o \
 	       mimetype.cpp
 
 $(BIGLIB): 
-	cd ../lib;$(MAKE)
+	cd $(depth)/lib;$(MAKE)
 $(MIMELIB): 
-	cd ../bincimapmime;$(MAKE)
+	cd $(depth)/bincimapmime;$(MAKE)
 
 depend: alldeps.stamp
 alldeps.stamp : $(SRCS)
-	$(CXX) -M $(CXXFLAGS) $(SRCS) > alldeps
+	$(CXX) -M $(ALL_CXXFLAGS) $(SRCS) > alldeps
 	touch alldeps.stamp
 
 clean: