Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Delete error in windows.
[simgrid.git] / buildtools / Cmake / src / CMakeDistrib.txt
index 551ef59..9589a55 100755 (executable)
-set(CMAKE_PROJECT_NAME "${PROJECT_NAME}")
-set(CPACK_PACKAGE_NAME "${PROJECT_NAME}")
-set(CPACK_PROJECT_NAME "${PROJECT_NAME}")
-set(CPACK_PACKAGE_FILE_NAME "simgrid-${release_version}")
-set(CPACK_GENERATOR "TBZ2;TGZ") #;TGZ;TZ;ZIP
-
-foreach(file ${script_to_install})
-       get_filename_component(file_location ${file} PATH)
-       string(REPLACE "${PROJECT_DIRECTORY}/" "/" file_location ${file_location})
-       install(FILES ${file} DESTINATION "${file_location}")
-endforeach(file ${EXTRA_DIST})
-
-foreach(file ${to_svg})
-       get_filename_component(file_location ${file} PATH)
-       string(REPLACE "${PROJECT_DIRECTORY}/" "/" file_location ${file_location})
-       install(FILES ${file} DESTINATION "${file_location}")
-endforeach(file ${EXTRA_DIST})
-
-foreach(file ${TEST_UNITS})
-       install(FILES src/${file} DESTINATION "/src/")
-endforeach(file ${TEST_UNITS})
-
-###copy doc
-install(DIRECTORY "${PROJECT_DIRECTORY}/doc/"
-DESTINATION "/doc/"
-PATTERN ".svn" EXCLUDE 
-PATTERN ".git" EXCLUDE 
-PATTERN "*.o" EXCLUDE
-PATTERN "*~" EXCLUDE
-)
+set(CMAKE_INSTALL_PREFIX ${prefix} CACHE TYPE INTERNAL FORCE)
 
-###buildtools 
-install(DIRECTORY "${PROJECT_DIRECTORY}/buildtools/Cmake/"
-DESTINATION "/buildtools/Cmake/"
-PATTERN ".svn" EXCLUDE 
-PATTERN ".git" EXCLUDE
-PATTERN "*.o" EXCLUDE
-PATTERN "*~" EXCLUDE
-)
+#########################################
+### Fill in the "make install" target ###
+#########################################
+         
+# doc
+if(EXISTS ${PROJECT_DIRECTORY}/doc/html/)
+       install(DIRECTORY "${PROJECT_DIRECTORY}/doc/html/"
+         DESTINATION "$ENV{DESTDIR}${prefix}/doc/simgrid/html/"
+         PATTERN ".svn" EXCLUDE 
+         PATTERN ".git" EXCLUDE 
+         PATTERN "*.o" EXCLUDE
+         PATTERN "*~" EXCLUDE
+       )
+endif(EXISTS ${PROJECT_DIRECTORY}/doc/html/)
 
-set(CPACK_SET_DESTDIR on)
-set(CMAKE_INSTALL_PREFIX ${prefix} CACHE TYPE INTERNAL FORCE)
+# binaries
+install(PROGRAMS ${CMAKE_BINARY_DIR}/bin/smpicc
+                 ${CMAKE_BINARY_DIR}/bin/smpirun
+                 ${CMAKE_BINARY_DIR}/bin/tesh
+               DESTINATION $ENV{DESTDIR}${prefix}/bin/)
+       
+install(PROGRAMS tools/MSG_visualization/colorize.pl
+        DESTINATION $ENV{DESTDIR}${prefix}/bin/
+               RENAME simgrid-colorizer)
 
-string(REPLACE ";" "\t" install_HEADERS "${install_HEADERS}")
-string(REPLACE ";" "\t" install_libs "${install_libs}")
-set(uninstall_bins "${install_bins}")
-string(REPLACE "${PROJECT_DIRECTORY}/src/smpi" "${prefix}/bin" uninstall_bins "${uninstall_bins}")
-string(REPLACE "${PROJECT_DIRECTORY}/tools/gras" "${prefix}/bin" uninstall_bins "${uninstall_bins}")
-string(REPLACE "${PROJECT_DIRECTORY}/tools/tesh" "${prefix}/bin" uninstall_bins "${uninstall_bins}")
-string(REPLACE "${PROJECT_DIRECTORY}/tools/MSG_visualization/colorize.pl" "${prefix}/bin/simgrid_colorizer.pl" uninstall_bins "${uninstall_bins}")
-string(REPLACE "${PROJECT_DIRECTORY}/src/.libs" "${prefix}/lib" uninstall_libs "${install_libs}")
-string(REPLACE "./" "${prefix}/" uninstall_HEADERS "${install_HEADERS}")
-
-string(REGEX REPLACE "^.*ruby/" "" install_link_ruby ${RUBY_INCLUDE_PATH})
-
-add_custom_target(install-simgrid
-COMMAND mkdir -p $ENV{DESTDIR}${prefix}
-COMMAND mkdir -p $ENV{DESTDIR}${prefix}/bin
-COMMAND mkdir -p $ENV{DESTDIR}${prefix}/lib
-COMMAND mkdir -p $ENV{DESTDIR}${prefix}/include
-COMMAND mkdir -p $ENV{DESTDIR}${prefix}/doc
-COMMAND mkdir -p $ENV{DESTDIR}${prefix}/doc/simgrid
-COMMAND mkdir -p $ENV{DESTDIR}${prefix}/doc/simgrid/html
-COMMAND cp ${install_bins} $ENV{DESTDIR}${prefix}/bin
-COMMAND cp ${PROJECT_DIRECTORY}/tools/MSG_visualization/colorize.pl $ENV{DESTDIR}${prefix}/bin/simgrid_colorizer.pl
-COMMAND echo "install bin           OK"
-COMMAND cp ${install_libs} $ENV{DESTDIR}${prefix}/lib
-COMMAND echo "install lib           OK"
-COMMAND cp --parents ${install_HEADERS} $ENV{DESTDIR}${prefix}
-COMMAND echo "install include       OK"
-COMMAND cp -rf ${PROJECT_DIRECTORY}/doc/html/ $ENV{DESTDIR}${prefix}/doc/simgrid
-COMMAND echo "install doc/html      OK"
-WORKING_DIRECTORY "${PROJECT_DIRECTORY}/"
-)
+# libraries
+install(TARGETS simgrid gras 
+        DESTINATION $ENV{DESTDIR}${prefix}/lib/)
+       
+install(FILES ${CMAKE_BINARY_DIR}/lib/libsimgrid_static.a 
+        RENAME libsimgrid.a
+        DESTINATION $ENV{DESTDIR}${prefix}/lib/)
+       
+if(enable_smpi)        
+  install(TARGETS smpi
+          DESTINATION $ENV{DESTDIR}${prefix}/lib/)
+endif(enable_smpi)     
 
-foreach(file ${ex_to_svg})
-       string(REPLACE "${PROJECT_DIRECTORY}" "." file "${file}")
-       add_custom_command(TARGET install-simgrid
-               COMMAND cp --parents -f ${file} $ENV{DESTDIR}${prefix}/doc/simgrid/
-               WORKING_DIRECTORY "${PROJECT_DIRECTORY}"
-       )
-endforeach(file ${ex_to_svg})
-add_custom_command(TARGET install-simgrid
-       COMMAND echo "install doc/examples  OK"
-       WORKING_DIRECTORY "${PROJECT_DIRECTORY}"
-)
+# include files
+foreach(file ${install_HEADERS})
+  get_filename_component(location ${file} PATH)
+  install(FILES ${file}
+          DESTINATION $ENV{DESTDIR}${prefix}/${location})
+endforeach(file ${install_HEADERS})
+
+# example files
+foreach(file ${examples_to_install_in_doc})
+  string(REPLACE "${PROJECT_DIRECTORY}/examples/" "" file ${file})
+  get_filename_component(location ${file} PATH)
+  install(FILES "examples/${file}"
+          DESTINATION $ENV{DESTDIR}${prefix}/doc/simgrid/examples/${location})
+endforeach(file ${examples_to_install_in_doc})
+
+# bindings cruft
+if(HAVE_JAVA)
+  install(FILES ${CMAKE_BINARY_DIR}/simgrid.jar
+          DESTINATION $ENV{DESTDIR}${prefix}/share/)
+endif(HAVE_JAVA)
+
+if(HAVE_LUA)
+  add_custom_target(absolute_liblink ALL
+    COMMAND ${CMAKE_COMMAND} -E create_symlink $ENV{DESTDIR}${prefix}/lib/libsimgrid.so ${CMAKE_BINARY_DIR}/libsimgrid.so)
+  install(FILES ${CMAKE_BINARY_DIR}/libsimgrid.so
+          DESTINATION $ENV{DESTDIR}${prefix}/lib/lua/5.1
+         RENAME simgrid.so)
+endif(HAVE_LUA)
+
+if(HAVE_RUBY)
+  string(REGEX REPLACE "^.*ruby/" "" install_link_ruby "${RUBY_ARCH_DIR}")
+  install(FILES ${CMAKE_BINARY_DIR}/libsimgrid.so
+                ${PROJECT_DIRECTORY}/src/bindings/ruby/simgrid.rb
+          DESTINATION $ENV{DESTDIR}${prefix}/lib/ruby/${install_link_ruby}/)
+endif(HAVE_RUBY)
+
+###########################################
+### Fill in the "make uninstall" target ###
+###########################################
 
 add_custom_target(uninstall
-COMMAND rm -rf ${prefix}/doc/simgrid
-COMMAND echo "uninstall doc ok"
-COMMAND rm -f ${uninstall_libs}
-COMMAND echo "uninstall lib ok"
-COMMAND rm -f ${uninstall_bins}
-COMMAND rm -f ${prefix}/bin/simgrid_colorizer.pl
-COMMAND echo "uninstall bin ok"
-COMMAND rm -f ${uninstall_HEADERS}
-COMMAND echo "uninstal include ok"
-COMMAND rm -Rf ${prefix}/include/amok ${prefix}/include/gras ${prefix}/include/instr ${prefix}/include/msg 
-COMMAND rm -Rf ${prefix}/include/simdag ${prefix}/include/smpi ${prefix}/include/surf ${prefix}/include/xbt
+COMMAND ${CMAKE_COMMAND} -E    remove_directory ${prefix}/doc/simgrid
+COMMAND ${CMAKE_COMMAND} -E    echo "uninstall doc ok"
+COMMAND ${CMAKE_COMMAND} -E    remove -f ${uninstall_libs}
+COMMAND ${CMAKE_COMMAND} -E    echo "uninstall lib ok"
+COMMAND ${CMAKE_COMMAND} -E    remove -f ${uninstall_bins}
+COMMAND ${CMAKE_COMMAND} -E    remove -f ${prefix}/bin/simgrid_colorizer.pl
+COMMAND ${CMAKE_COMMAND} -E    echo "uninstall bin ok"
+COMMAND ${CMAKE_COMMAND} -E    remove -f ${uninstall_HEADERS}
+COMMAND ${CMAKE_COMMAND} -E    echo "uninstal include ok"
+COMMAND ${CMAKE_COMMAND} -E    remove_directory ${prefix}/include/amok
+COMMAND ${CMAKE_COMMAND} -E    remove_directory ${prefix}/include/gras
+COMMAND ${CMAKE_COMMAND} -E    remove_directory ${prefix}/include/instr
+COMMAND ${CMAKE_COMMAND} -E    remove_directory ${prefix}/include/msg 
+COMMAND ${CMAKE_COMMAND} -E    remove_directory ${prefix}/include/simdag
+COMMAND ${CMAKE_COMMAND} -E    remove_directory ${prefix}/include/smpi
+COMMAND ${CMAKE_COMMAND} -E    remove_directory ${prefix}/include/surf
+COMMAND ${CMAKE_COMMAND} -E    remove_directory ${prefix}/include/xbt
 WORKING_DIRECTORY "${prefix}"
 )
 
 if(HAVE_JAVA)
-       add_custom_command(TARGET install-simgrid
-       COMMAND mkdir -p $ENV{DESTDIR}${prefix}/share/
-       COMMAND cp ${PROJECT_DIRECTORY}/src/simgrid.jar $ENV{DESTDIR}${prefix}/share/simgrid.jar
-       COMMAND echo "install binding java  OK"
-       WORKING_DIRECTORY "${PROJECT_DIRECTORY}/"
-       )
        add_custom_command(TARGET uninstall
-       COMMAND rm -f ${prefix}/share/simgrid.jar
-       COMMAND echo "uninstall binding java"
+       COMMAND ${CMAKE_COMMAND} -E     remove -f ${prefix}/share/simgrid.jar
+       COMMAND ${CMAKE_COMMAND} -E echo "uninstall binding java"
        WORKING_DIRECTORY "${PROJECT_DIRECTORY}/"
        )       
 endif(HAVE_JAVA)
 
 if(HAVE_LUA)
-       add_custom_command(TARGET install-simgrid
-       COMMAND mkdir -p $ENV{DESTDIR}${prefix}/lib/lua/5.1/
-       COMMAND ln -sf ${prefix}/lib/libsimgrid.so $ENV{DESTDIR}${prefix}/lib/lua/5.1/simgrid.so
-       COMMAND echo "install binding lua   OK"
-       WORKING_DIRECTORY "${PROJECT_DIRECTORY}/"
-       )
        add_custom_command(TARGET uninstall
-       COMMAND echo "uninstall binding lua"
-       COMMAND rm -f ${prefix}/lib/lua/5.1/simgrid.so  
+       COMMAND ${CMAKE_COMMAND} -E echo "uninstall binding lua"
+       COMMAND ${CMAKE_COMMAND} -E remove -f ${prefix}/lib/lua/5.1/simgrid.so  
        WORKING_DIRECTORY "${PROJECT_DIRECTORY}/"
        )
 endif(HAVE_LUA)
 
 if(HAVE_RUBY)
-       add_custom_command(TARGET install-simgrid
-       COMMAND mkdir -p "$ENV{DESTDIR}${prefix}/lib/ruby/${install_link_ruby}/"
-       COMMAND ln -sf ${prefix}/lib/libsimgrid.so $ENV{DESTDIR}${prefix}/lib/ruby/${install_link_ruby}/libsimgrid.so
-       COMMAND cp ${PROJECT_DIRECTORY}/src/bindings/ruby/simgrid.rb $ENV{DESTDIR}${prefix}/lib/ruby/${install_link_ruby}/simgrid.rb
-       COMMAND echo "install binding ruby  OK"
-       WORKING_DIRECTORY "${PROJECT_DIRECTORY}/"
-       )
+       string(REGEX REPLACE "^.*ruby/" "" install_link_ruby "${RUBY_ARCH_DIR}")
        add_custom_command(TARGET uninstall
-       COMMAND echo "uninstall binding ruby"
-       COMMAND rm -f ${prefix}/lib/ruby/${install_link_ruby}/libsimgrid.so
-       COMMAND rm -f ${prefix}/lib/ruby/${install_link_ruby}/simgrid.rb
+       COMMAND ${CMAKE_COMMAND} -E echo "uninstall binding ruby"
+       COMMAND ${CMAKE_COMMAND} -E remove -f ${prefix}/lib/ruby/${install_link_ruby}/libsimgrid.so
+       COMMAND ${CMAKE_COMMAND} -E remove -f ${prefix}/lib/ruby/${install_link_ruby}/simgrid.rb
        WORKING_DIRECTORY "${PROJECT_DIRECTORY}/"
        )
 endif(HAVE_RUBY)
 
+######################################
+### Fill in the "make html" target ###
+######################################
+
 add_custom_target(html
-COMMAND echo "Make the html doc"
-COMMAND echo "cmake -DBIBTEX2HTML=${BIBTEX2HTML} ./"
-COMMAND cmake -DBIBTEX2HTML=${BIBTEX2HTML} ./
-COMMAND rm -rf ${PROJECT_DIRECTORY}/buildtools/Cmake/src/doc/CMakeFiles
-COMMAND rm -f ${PROJECT_DIRECTORY}/buildtools/Cmake/src/doc/CMakeCache.txt
-COMMAND rm -f ${PROJECT_DIRECTORY}/buildtools/Cmake/src/doc/cmake_install.cmake
-COMMAND rm -f ${PROJECT_DIRECTORY}/buildtools/Cmake/src/doc/Makefile
+COMMAND ${CMAKE_COMMAND} -E echo "Make the html doc"
+COMMAND ${CMAKE_COMMAND} -E echo "cmake -DBIBTEX2HTML=${BIBTEX2HTML} ./"
+COMMAND ${CMAKE_COMMAND} -DBIBTEX2HTML=${BIBTEX2HTML} ./
+COMMAND ${CMAKE_COMMAND} -E remove_directory ${PROJECT_DIRECTORY}/buildtools/Cmake/src/doc/CMakeFiles
+COMMAND ${CMAKE_COMMAND} -E remove -f ${PROJECT_DIRECTORY}/buildtools/Cmake/src/doc/CMakeCache.txt
+COMMAND ${CMAKE_COMMAND} -E remove -f ${PROJECT_DIRECTORY}/buildtools/Cmake/src/doc/cmake_install.cmake
+COMMAND ${CMAKE_COMMAND} -E remove -f ${PROJECT_DIRECTORY}/buildtools/Cmake/src/doc/Makefile
 WORKING_DIRECTORY "${PROJECT_DIRECTORY}/buildtools/Cmake/src/doc"
 )
 
+################################################################
+## Build a sain "make dist" target to build a source package ###
+##   containing only the files that I explicitely state      ###
+##   (instead of any cruft laying on my disk as CPack does)  ###
+################################################################
+
+##########################################
+### Fill in the "make dist-dir" target ###
+##########################################
+
+add_custom_target(dist-dir
+  COMMAND test -e simgrid-${release_version}/ && chmod -R a+w simgrid-${release_version}/ || true
+  COMMAND ${CMAKE_COMMAND} -E remove_directory simgrid-${release_version}
+  COMMAND ${CMAKE_COMMAND} -E make_directory simgrid-${release_version}
+)
+
+set(dirs_in_tarball "")
+foreach(file ${source_to_pack} ${txt_files})
+  # This damn prefix is still set somewhere (seems to be in subdirs)
+  string(REPLACE "${PROJECT_DIRECTORY}/" "" file ${file})
+  
+  # Create the directory on need
+  get_filename_component(file_location ${file} PATH)
+  string(REGEX MATCH ";${file_location};" OPERATION "${dirs_in_tarball}")
+  if(NOT OPERATION)
+       set(dirs_in_tarball "${dirs_in_tarball};${file_location};")
+       add_custom_command(
+         TARGET dist-dir
+         COMMAND ${CMAKE_COMMAND} -E make_directory simgrid-${release_version}/${file_location}/
+       )       
+   endif(NOT OPERATION)
+   
+   # Actually copy the file
+   add_custom_command(
+     TARGET dist-dir
+     COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_DIRECTORY}/${file} simgrid-${release_version}/${file_location}/
+   )
+endforeach(file ${source_to_pack})
+
+######################################
+### Fill in the "make dist" target ###
+######################################
+
 add_custom_target(dist
-COMMAND make package
-COMMAND rm -rf _CPack_Packages
-#WORKING_DIRECTORY "${PROJECT_DIRECTORY}"
+  COMMAND ${CMAKE_COMMAND} -E tar cf simgrid-${release_version}.tar simgrid-${release_version}/
+  COMMAND gzip -9v simgrid-${release_version}.tar
+  COMMAND ${CMAKE_COMMAND} -E remove_directory simgrid-${release_version}
+)
+add_dependencies(dist dist-dir)
+
+###########################################
+### Fill in the "make distcheck" target ###
+###########################################
+
+# Allow to test the "make dist"
+add_custom_target(distcheck
+  COMMAND ${CMAKE_COMMAND} -E make_directory simgrid-${release_version}/_build
+  COMMAND ${CMAKE_COMMAND} -E make_directory simgrid-${release_version}/_inst
+  
+  # This stupid cmake creates a directory in source, killing the purpose of the chmod
+  # (tricking around)
+  COMMAND ${CMAKE_COMMAND} -E make_directory simgrid-${release_version}/CMakeFiles 
+#  COMMAND chmod -R a-w simgrid-${release_version}/ # FIXME: we should pass without commenting that line
+  COMMAND chmod -R a+w simgrid-${release_version}/_build
+  COMMAND chmod -R a+w simgrid-${release_version}/_inst
+  COMMAND chmod -R a+w simgrid-${release_version}/CMakeFiles
+  
+  COMMAND ${CMAKE_COMMAND} -E chdir simgrid-${release_version}/_build ${CMAKE_COMMAND} build ..  -Dprefix=../_inst
+#  COMMAND ${CMAKE_COMMAND} -E chdir simgrid-${release_version}/_build make dist-dir
+  COMMAND ${CMAKE_COMMAND} -E chdir simgrid-${release_version}/_build make -j5 || ${CMAKE_COMMAND} -E chdir simgrid-${release_version}/_build make
+  COMMAND ${CMAKE_COMMAND} -E chdir simgrid-${release_version}/_build make test -j5
+  COMMAND ${CMAKE_COMMAND} -E chdir simgrid-${release_version}/_build make clean
+#  COMMAND ${CMAKE_COMMAND} -E remove_directory simgrid-${release_version}/
 )
+add_dependencies(distcheck dist-dir)
+
+#######################################
+### Fill in the "make check" target ###
+#######################################
 
 add_custom_target(check
 COMMAND make test
 #WORKING_DIRECTORY "${PROJECT_DIRECTORY}"
 )
 
-add_custom_target(distcheck
-COMMAND make package
-COMMAND rm -rf _CPack_Packages
-COMMAND tar xvf ${CPACK_PACKAGE_FILE_NAME}.tar.bz2
-COMMAND cd ${CPACK_PACKAGE_FILE_NAME} && cmake .
-COMMAND cd ${CPACK_PACKAGE_FILE_NAME} && make
-COMMAND cd ${CPACK_PACKAGE_FILE_NAME} && make test
-COMMAND rm -rf ${CPACK_PACKAGE_FILE_NAME}
-#WORKING_DIRECTORY "${PROJECT_DIRECTORY}"
-)
+#######################################
+### Fill in the "make all-clean" target ###
+#######################################
 
 add_custom_target(maintainer-clean
-COMMAND rm -f src/config_unit.c
-COMMAND rm -f src/cunit_unit.c
-COMMAND rm -f src/dict_unit.c
-COMMAND rm -f src/dynar_unit.c
-COMMAND rm -f src/ex_unit.c
-COMMAND rm -f src/set_unit.c
-COMMAND rm -f src/simgrid_units_main.c
-COMMAND rm -f src/swag_unit.c
-COMMAND rm -f src/xbt_sha_unit.c
-COMMAND rm -f src/xbt_str_unit.c
-COMMAND rm -f src/xbt_strbuff_unit.c
-COMMAND rm -f src/xbt_synchro_unit.c
+COMMAND ${CMAKE_COMMAND} -E remove -f src/config_unit.c
+COMMAND ${CMAKE_COMMAND} -E remove -f src/cunit_unit.c
+COMMAND ${CMAKE_COMMAND} -E remove -f src/dict_unit.c
+COMMAND ${CMAKE_COMMAND} -E remove -f src/dynar_unit.c
+COMMAND ${CMAKE_COMMAND} -E remove -f src/ex_unit.c
+COMMAND ${CMAKE_COMMAND} -E remove -f src/set_unit.c
+COMMAND ${CMAKE_COMMAND} -E remove -f src/simgrid_units_main.c
+COMMAND ${CMAKE_COMMAND} -E remove -f src/swag_unit.c
+COMMAND ${CMAKE_COMMAND} -E remove -f src/xbt_sha_unit.c
+COMMAND ${CMAKE_COMMAND} -E remove -f src/xbt_str_unit.c
+COMMAND ${CMAKE_COMMAND} -E remove -f src/xbt_strbuff_unit.c
+COMMAND ${CMAKE_COMMAND} -E remove -f src/xbt_synchro_unit.c
 WORKING_DIRECTORY "${PROJECT_DIRECTORY}"
 )
 
 add_custom_target(supernovae-clean
-COMMAND rm -f src/supernovae_gras.c
-COMMAND rm -f src/supernovae_sg.c
-COMMAND rm -f src/supernovae_smpi.c
+COMMAND ${CMAKE_COMMAND} -E remove -f src/supernovae_gras.c
+COMMAND ${CMAKE_COMMAND} -E remove -f src/supernovae_sg.c
+COMMAND ${CMAKE_COMMAND} -E remove -f src/supernovae_smpi.c
 WORKING_DIRECTORY "${PROJECT_DIRECTORY}"
 )
 
 add_custom_target(doc-clean
-COMMAND rm -f doc/all_bib.html
-COMMAND rm -f doc/all_bib.latin1.html
-COMMAND rm -f doc/all_bib.latin1.html.tmp
-COMMAND rm -f doc/logcategories.sh
-COMMAND rm -f doc/publis_core.bib
-COMMAND rm -f doc/publis_core_bib.html
-COMMAND rm -f doc/publis_core_bib.latin1.html
-COMMAND rm -f doc/publis_core_bib.latin1.html.tmp
-COMMAND rm -f doc/publis_count.html
-COMMAND rm -f doc/publis_extern.bib
-COMMAND rm -f doc/publis_extern_bib.html
-COMMAND rm -f doc/publis_extern_bib.latin1.html
-COMMAND rm -f doc/publis_extern_bib.latin1.html.tmp
-COMMAND rm -f doc/publis_intra.bib
-COMMAND rm -f doc/publis_intra_bib.html
-COMMAND rm -f doc/publis_intra_bib.latin1.html
-COMMAND rm -f doc/publis_intra_bib.latin1.html.tmp
-COMMAND rm -f doc/tmp.realtoc
-COMMAND rm -f doc/using_bib.html
-COMMAND rm -f doc/using_bib.latin1.html
-COMMAND rm -f doc/using_bib.latin1.html.tmp
-COMMAND rm -f doc/realtoc.sh
+COMMAND ${CMAKE_COMMAND} -E remove -f doc/all_bib.html
+COMMAND ${CMAKE_COMMAND} -E remove -f doc/all_bib.latin1.html
+COMMAND ${CMAKE_COMMAND} -E remove -f doc/all_bib.latin1.html.tmp
+COMMAND ${CMAKE_COMMAND} -E remove -f doc/logcategories.sh
+COMMAND ${CMAKE_COMMAND} -E remove -f doc/publis_core.bib
+COMMAND ${CMAKE_COMMAND} -E remove -f doc/publis_core_bib.html
+COMMAND ${CMAKE_COMMAND} -E remove -f doc/publis_core_bib.latin1.html
+COMMAND ${CMAKE_COMMAND} -E remove -f doc/publis_core_bib.latin1.html.tmp
+COMMAND ${CMAKE_COMMAND} -E remove -f doc/publis_count.html
+COMMAND ${CMAKE_COMMAND} -E remove -f doc/publis_extern.bib
+COMMAND ${CMAKE_COMMAND} -E remove -f doc/publis_extern_bib.html
+COMMAND ${CMAKE_COMMAND} -E remove -f doc/publis_extern_bib.latin1.html
+COMMAND ${CMAKE_COMMAND} -E remove -f doc/publis_extern_bib.latin1.html.tmp
+COMMAND ${CMAKE_COMMAND} -E remove -f doc/publis_intra.bib
+COMMAND ${CMAKE_COMMAND} -E remove -f doc/publis_intra_bib.html
+COMMAND ${CMAKE_COMMAND} -E remove -f doc/publis_intra_bib.latin1.html
+COMMAND ${CMAKE_COMMAND} -E remove -f doc/publis_intra_bib.latin1.html.tmp
+COMMAND ${CMAKE_COMMAND} -E remove -f doc/tmp.realtoc
+COMMAND ${CMAKE_COMMAND} -E remove -f doc/using_bib.html
+COMMAND ${CMAKE_COMMAND} -E remove -f doc/using_bib.latin1.html
+COMMAND ${CMAKE_COMMAND} -E remove -f doc/using_bib.latin1.html.tmp
+COMMAND ${CMAKE_COMMAND} -E remove -f doc/realtoc.sh
 WORKING_DIRECTORY "${PROJECT_DIRECTORY}"
 )
 
 add_custom_target(java-clean
-COMMAND rm -f src/simgrid.jar
-COMMAND rm -rf src/.classes
-COMMAND rm -f examples/java/basic/BasicTest.class
-COMMAND rm -f examples/java/basic/FinalizeTask.class
-COMMAND rm -f examples/java/basic/Forwarder.class
-COMMAND rm -f examples/java/basic/Master.class
-COMMAND rm -f examples/java/basic/Slave.class
-COMMAND rm -f examples/java/comm_time/CommTimeTest.class
-COMMAND rm -f examples/java/comm_time/FinalizeTask.class
-COMMAND rm -f examples/java/comm_time/Master.class
-COMMAND rm -f examples/java/comm_time/Slave.class
-COMMAND rm -f examples/java/ping_pong/PingPongTask.class
-COMMAND rm -f examples/java/ping_pong/PingPongTest.class
-COMMAND rm -f examples/java/ping_pong/Receiver.class
-COMMAND rm -f examples/java/ping_pong/Sender.class
-COMMAND rm -f examples/java/suspend/DreamMaster.class
-COMMAND rm -f examples/java/suspend/LazyGuy.class
-COMMAND rm -f examples/java/suspend/SuspendTest.class
+COMMAND ${CMAKE_COMMAND} -E remove -f src/simgrid.jar
+COMMAND ${CMAKE_COMMAND} -E remove_directory src/.classes
+COMMAND ${CMAKE_COMMAND} -E remove -f examples/java/basic/BasicTest.class
+COMMAND ${CMAKE_COMMAND} -E remove -f examples/java/basic/FinalizeTask.class
+COMMAND ${CMAKE_COMMAND} -E remove -f examples/java/basic/Forwarder.class
+COMMAND ${CMAKE_COMMAND} -E remove -f examples/java/basic/Master.class
+COMMAND ${CMAKE_COMMAND} -E remove -f examples/java/basic/Slave.class
+COMMAND ${CMAKE_COMMAND} -E remove -f examples/java/comm_time/CommTimeTest.class
+COMMAND ${CMAKE_COMMAND} -E remove -f examples/java/comm_time/FinalizeTask.class
+COMMAND ${CMAKE_COMMAND} -E remove -f examples/java/comm_time/Master.class
+COMMAND ${CMAKE_COMMAND} -E remove -f examples/java/comm_time/Slave.class
+COMMAND ${CMAKE_COMMAND} -E remove -f examples/java/ping_pong/PingPongTask.class
+COMMAND ${CMAKE_COMMAND} -E remove -f examples/java/ping_pong/PingPongTest.class
+COMMAND ${CMAKE_COMMAND} -E remove -f examples/java/ping_pong/Receiver.class
+COMMAND ${CMAKE_COMMAND} -E remove -f examples/java/ping_pong/Sender.class
+COMMAND ${CMAKE_COMMAND} -E remove -f examples/java/suspend/DreamMaster.class
+COMMAND ${CMAKE_COMMAND} -E remove -f examples/java/suspend/LazyGuy.class
+COMMAND ${CMAKE_COMMAND} -E remove -f examples/java/suspend/SuspendTest.class
 WORKING_DIRECTORY "${PROJECT_DIRECTORY}"
 )
 
@@ -260,6 +312,10 @@ if(enable_maintainer_mode)
        )
 endif(enable_maintainer_mode)
 
+#############################################
+### Fill in the "make sync-gforge" target ###
+#############################################
+
 add_custom_target(sync-gforge
 COMMAND chmod g+rw -R doc/
 COMMAND chmod a+rX -R doc/