Index: /issm/trunk/src/ad/Makefile.am
===================================================================
--- /issm/trunk/src/ad/Makefile.am	(revision 9756)
+++ /issm/trunk/src/ad/Makefile.am	(revision 9757)
@@ -6,32 +6,29 @@
 #Compilation can still be blocked if user has not activated --with-adic compilation
 
+#Library declaration {{{1
+
 if NOPARALLEL
 lib_LIBRARIES = 
 else
+lib_LIBRARIES = libpISSM.a   libOverload.a
+endif
+
 if AD
-lib_LIBRARIES = libpISSM.a  libAD.a libOverload.a
-else
-lib_LIBRARIES = 
-endif
-endif
-
-#Overload library, to overload any non-standard symbols.
+lib_LIBRARIES += libAD.a 
+endif
+
+if DAKOTA
+lib_LIBRARIES += libDAKOTA.a
+endif
+
+#}}}
+#Overload library, to overload any non-standard symbols. {{{1
 libOverload_a_SOURCES = ./shared/String/stricmp.c
 libOverload_a_CFLAGS = -fPIC -D_PARALLEL_   -D_C_ $(COPTFLAGS)
-
-#AD library, for automatic differentiation
-if AD
-#libAD_a_SOURCES = ./mini1.ad.c
-libAD_a_SOURCES = 
-else
-libAD_a_SOURCES = 
-endif
-libAD_a_CFLAGS = -fPIC -D_PARALLEL_   -D_C_ $(COPTFLAGS)
-
+#}}}
 #ISSM library  {{{1
 libpISSM_a_SOURCES = ./include/macros.h\
 					./include/typedefs.h\
 					./include/types.h\
-					./include/globals.h\
 					./include/include.h\
 					./objects/objects.h\
@@ -202,10 +199,4 @@
 					./shared/Alloc/alloc.h\
 					./shared/Alloc/alloc.cpp\
-					./shared/Matlab/matlabshared.h\
-					./shared/Matlab/PrintfFunction.cpp\
-					./shared/Matlab/ModuleBoot.cpp\
-					./shared/Matlab/mxGetAssignedField.cpp\
-					./shared/Matlab/mxGetField.cpp\
-					./shared/Matlab/CheckNumMatlabArguments.cpp\
 					./shared/Matrix/matrix.h\
 					./shared/Matrix/MatrixUtils.cpp\
@@ -238,5 +229,4 @@
 					./shared/Elements/GetGlobalDofList.cpp\
 					./shared/Elements/GetNumberOfDofs.cpp\
-					./shared/String/DescriptorIndex.cpp\
 					./shared/String/sharedstring.h\
 					./toolkits/petsc\
@@ -283,8 +273,5 @@
 					./io/Disk/pfopen.cpp\
 					./io/Disk/pfclose.cpp\
-					./io/Matlab/matlabio.h\
-					./io/Matlab/WriteMatlabData.cpp\
-					./io/Matlab/FetchMatlabData.cpp\
-					./io/Matlab/OptionParse.cpp\
+					./io/PrintfFunction.cpp\
 					./EnumDefinitions/EnumDefinitions.h\
 					./EnumDefinitions/EnumToModelField.cpp\
@@ -455,8 +442,4 @@
 					./modules/HoleFillerx/HoleFillerx.cpp\
 					./modules/HoleFillerx/HoleFillerx.h\
-					./modules/AverageFilterx/AverageFilterx.cpp\
-					./modules/AverageFilterx/AverageFilterx.h\
-					./modules/AverageOntoPartitionx/AverageOntoPartitionx.cpp\
-					./modules/AverageOntoPartitionx/AverageOntoPartitionx.h\
 					./modules/MeshPartitionx/MeshPartitionx.cpp\
 					./modules/MeshPartitionx/MeshPartitionx.h\
@@ -561,7 +544,48 @@
 					./solvers/solver_thermal_nonlinear.cpp
 
+
+libpISSM_a_CXXFLAGS = -fPIC -D_PARALLEL_   -D_C_ $(CXXOPTFLAGS)
 #}}}
-
-libpISSM_a_CXXFLAGS = -fPIC -D_PARALLEL_   -D_C_ $(CXXOPTFLAGS)
+#AD library, for automatic differentiation {{{1
+if AD
+#libAD_a_SOURCES = ./mini1.ad.c
+libAD_a_SOURCES = 
+libAD_a_CFLAGS = -fPIC -D_PARALLEL_   -D_C_ $(COPTFLAGS)
+
+
+#Automatic differentiation rules: 
+%.ad.c: %.c
+	adic2 -mforward  $< --nary
+endif
+#}}}
+#DAKOTA library  {{{1
+
+if DAKOTA
+libDAKOTA_a_SOURCES = ./objects/DakotaPlugin.h\
+					  ./objects/DakotaPlugin.cpp\
+					  ./modules/InputUpdateFromDakotax/InputUpdateFromDakotax.h\
+					  ./modules/InputUpdateFromDakotax/InputUpdateFromDakotax.cpp\
+					  ./modules/DakotaResponsesx/DakotaResponsesx.h\
+					  ./modules/DakotaResponsesx/DakotaResponsesx.cpp\
+					  ./modules/InputUpdateFromVectorDakotax/InputUpdateFromVectorDakotax.h\
+					  ./modules/InputUpdateFromVectorDakotax/InputUpdateFromVectorDakotax.cpp\
+					  ./modules/AverageOntoPartitionx/AverageOntoPartitionx.cpp\
+					  ./modules/AverageOntoPartitionx/AverageOntoPartitionx.h\
+					  ./modules/Dakotax/Dakotax.h\
+					  ./modules/Dakotax/Dakotax.cpp\
+					  ./modules/Dakotax/DakotaMPI_Bcast.cpp\
+					  ./modules/Dakotax/DakotaFree.cpp\
+					  ./modules/Dakotax/SpawnCore.cpp\
+					  ./modules/Dakotax/SpawnCoreParallel.cpp\
+					  ./modules/Dakotax/DescriptorIndex.cpp\
+					  ./modules/AverageOntoPartitionx/AverageOntoPartitionx.cpp\
+					  ./modules/AverageOntoPartitionx/AverageOntoPartitionx.h
+
+
+libDAKOTA_a_CXXFLAGS = -fPIC -D_PARALLEL_   -D_C_ $(CXXOPTFLAGS)
+endif
+
+#}}}
+#Executable {{{1
 
 if NOPARALLEL
@@ -571,10 +595,21 @@
 endif
 
-LDADD =    ./libpISSM.a $(PETSCLIB) $(TAOLIB) $(FLIBS) $(PLAPACKLIB)  $(MUMPSLIB) $(SCALAPACKLIB)  $(BLACSLIB) $(HYPRELIB) $(MLLIB) $(DAKOTALIB) $(METISLIB) $(CHACOLIB) $(SCOTCHLIB) $(BLASLAPACKLIB)  $(MKLLIB) $(MPILIB) $(MATHLIB) $(FORTRANLIB) $(GRAPHICSLIB) libOverload.a $(MULTITHREADINGLIB) $(ADICLIB) libAD.a
+#Standard library 
+LDADD =    ./libpISSM.a  ./libOverload.a
+
+if AD
+LDADD +=    ./libAD.a
+endif
+
+if DAKOTA
+LDADD +=    ./libDAKOTA.a
+endif
+
+#External packages
+LDADD += $(PETSCLIB) $(TAOLIB) $(FLIBS) $(PLAPACKLIB)  $(MUMPSLIB) $(SCALAPACKLIB)  $(BLACSLIB) $(HYPRELIB) $(MLLIB) $(DAKOTALIB) $(METISLIB) $(CHACOLIB) $(SCOTCHLIB) $(BLASLAPACKLIB)  $(MKLLIB) $(MPILIB) $(MATHLIB) $(FORTRANLIB) $(GRAPHICSLIB) $(MULTITHREADINGLIB) $(ADICLIB) 
+
 
 issm_exe_SOURCES = solutions/issm.cpp
 issm_exe_CXXFLAGS= -fPIC -D_PARALLEL_  $(CXXOPTFLAGS) $(COPTFLAGS)
 
-#Automatic differentiation rules: 
-%.ad.c: %.c
-	adic2 -mforward  $< --nary
+#}}}
