diff --git a/CMakeLists.txt b/CMakeLists.txt index 1db5829..f46b71e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -12,6 +12,12 @@ else() add_custom_target(install) # Fake install target endif() +# Add distclean target +add_custom_target (distclean + COMMAND ${CMAKE_BUILD_TOOL} clean + COMMAND ${CMAKE_COMMAND} -P distclean.cmake +) + # Build example programs add_executable (find examples/find.c) add_executable (ls examples/ls.c) diff --git a/Makefile.linux b/Makefile.linux deleted file mode 100644 index 4a825e9..0000000 --- a/Makefile.linux +++ /dev/null @@ -1,69 +0,0 @@ -# This Makefile will pack dirent into a distributable zip -# package. To build the package, invoke this Makefile as -# -# make -f Makefile.linux dist -# - -# Current cersion number -VERSION=1.22 - -# List of files to include in zip package -DIST_FILES = include/*.h examples/*.c tests/*.c tests/1/file tests/1/dir/* tests/2/* CMakeLists.txt ChangeLog README.md LICENSE - -# Default target -all: ls find - -# Build Linux versions of example programs -ls: examples/ls.c - gcc -W -Wall -o ls examples/ls.c - -find: examples/find.c - gcc -W -Wall -o find examples/find.c - -# Run regression tests -check: t-dirent - ./t-dirent - -t-dirent: tests/t-dirent.c - gcc -W -Wall -o t-dirent tests/t-dirent.c - -# Show usage -help: - @echo "Build targets available:" - @echo " clean Remove temporary files" - @echo " dist Build distributable package" - @echo " check Run regression tests" - -# Wipe out temporary files left behind by MS-Visual Studio and CMake -clean: - rm -f ls find t-dirent t-compile locate updatedb - rm -fr Debug Release Testing - rm -fr *.dir - rm -f *.vcproj *.user - rm -fr CMakeFiles - rm -f CMakeCache.txt CTestTestfile.cmake cmake_install.cmake - rm -f dirent.ncb dirent.sln dirent.suo - rm -f DartConfiguration.tcl locate.db Makefile - rm -fr dirent-$(VERSION) - rm -f dirent-*.zip - -# Build installation package -dist: dirent-$(VERSION).zip -dirent-$(VERSION).zip: $(DIST_FILES) - rm -f dirent-$(VERSION).zip - rm -fr dirent-$(VERSION) - mkdir dirent-$(VERSION) - for f in $(DIST_FILES); do \ - dir=`echo "$$f" | sed -e 's:^[^/]*$$::' -e 's://*[^/]*$$::' -e 's:^$$:.:'`; \ - if [ -d "dirent-$(VERSION)/$$dir" ]; then \ - :; \ - else \ - mkdir "dirent-$(VERSION)/$$dir"; \ - chmod 0755 "dirent-$(VERSION)/$$dir"; \ - fi; \ - cp "$$f" "dirent-$(VERSION)/$$dir/"; \ - chmod 0644 "dirent-$(VERSION)/$$f"; \ - done - ( cd dirent-$(VERSION) && zip -r ../dirent-$(VERSION).zip . ) - rm -fr dirent-$(VERSION) - diff --git a/distclean.cmake b/distclean.cmake new file mode 100644 index 0000000..4286d31 --- /dev/null +++ b/distclean.cmake @@ -0,0 +1,63 @@ +# Remove CMake generated temporary files +set (cmake_generated + ${CMAKE_BINARY_DIR}/ALL_BUILD.vcxproj + ${CMAKE_BINARY_DIR}/ALL_BUILD.vcxproj.filters + ${CMAKE_BINARY_DIR}/CMakeCache.txt + ${CMAKE_BINARY_DIR}/CMakeFiles + ${CMAKE_BINARY_DIR}/CTestTestfile.cmake + ${CMAKE_BINARY_DIR}/Continuous.vcxproj + ${CMAKE_BINARY_DIR}/Continuous.vcxproj.filters + ${CMAKE_BINARY_DIR}/DartConfiguration.tcl + ${CMAKE_BINARY_DIR}/Debug + ${CMAKE_BINARY_DIR}/Experimental.vcxproj + ${CMAKE_BINARY_DIR}/Experimental.vcxproj.filters + ${CMAKE_BINARY_DIR}/INSTALL.vcxproj + ${CMAKE_BINARY_DIR}/INSTALL.vcxproj.filters + ${CMAKE_BINARY_DIR}/Makefile + ${CMAKE_BINARY_DIR}/Nightly.vcxproj + ${CMAKE_BINARY_DIR}/Nightly.vcxproj.filters + ${CMAKE_BINARY_DIR}/NightlyMemoryCheck.vcxproj + ${CMAKE_BINARY_DIR}/NightlyMemoryCheck.vcxproj.filters + ${CMAKE_BINARY_DIR}/RUN_TESTS.vcxproj + ${CMAKE_BINARY_DIR}/RUN_TESTS.vcxproj.filters + ${CMAKE_BINARY_DIR}/Testing + ${CMAKE_BINARY_DIR}/Win32 + ${CMAKE_BINARY_DIR}/ZERO_CHECK.vcxproj + ${CMAKE_BINARY_DIR}/ZERO_CHECK.vcxproj.filters + ${CMAKE_BINARY_DIR}/check.vcxproj + ${CMAKE_BINARY_DIR}/check.vcxproj.filters + ${CMAKE_BINARY_DIR}/cmake_install.cmake + ${CMAKE_BINARY_DIR}/dirent.sln + ${CMAKE_BINARY_DIR}/distclean.vcxproj + ${CMAKE_BINARY_DIR}/distclean.vcxproj.filters + ${CMAKE_BINARY_DIR}/find + ${CMAKE_BINARY_DIR}/find.dir + ${CMAKE_BINARY_DIR}/find.vcxproj + ${CMAKE_BINARY_DIR}/find.vcxproj.filters + ${CMAKE_BINARY_DIR}/locate + ${CMAKE_BINARY_DIR}/locate.dir + ${CMAKE_BINARY_DIR}/locate.vcxproj + ${CMAKE_BINARY_DIR}/locate.vcxproj.filters + ${CMAKE_BINARY_DIR}/ls + ${CMAKE_BINARY_DIR}/ls.dir + ${CMAKE_BINARY_DIR}/ls.vcxproj + ${CMAKE_BINARY_DIR}/ls.vcxproj.filters + ${CMAKE_BINARY_DIR}/t-compile + ${CMAKE_BINARY_DIR}/t-compile.dir + ${CMAKE_BINARY_DIR}/t-compile.vcxproj + ${CMAKE_BINARY_DIR}/t-compile.vcxproj.filters + ${CMAKE_BINARY_DIR}/t-dirent + ${CMAKE_BINARY_DIR}/t-dirent.dir + ${CMAKE_BINARY_DIR}/t-dirent.vcxproj + ${CMAKE_BINARY_DIR}/t-dirent.vcxproj.filters + ${CMAKE_BINARY_DIR}/updatedb + ${CMAKE_BINARY_DIR}/updatedb.dir + ${CMAKE_BINARY_DIR}/updatedb.vcxproj + ${CMAKE_BINARY_DIR}/updatedb.vcxproj.filters +) +foreach (file ${cmake_generated}) + if (EXISTS ${file}) + file (REMOVE_RECURSE ${file}) + endif() +endforeach (file) +