Merge 'remotes/trunk'
[0ad.git] / build / workspaces / clean-workspaces.sh
blobfa7a6f626ee61e4bd983bd40dc9099bbabb6bf4d
1 #!/bin/sh
3 # Some of our makefiles depend on GNU make, so we set some sane defaults if MAKE
4 # is not set.
5 case "`uname -s`" in
6 "FreeBSD" | "OpenBSD" )
7 MAKE=${MAKE:="gmake"}
8 ;;
9 * )
10 MAKE=${MAKE:="make"}
12 esac
14 # Check the preserve-libs CL option
15 preserve_libs=false
17 for i in "$@"; do
18 case "$i" in
19 --preserve-libs ) preserve_libs=true ;;
20 esac
21 done
23 # (We don't attempt to clean up every last file here - output in
24 # binaries/system/ will still be there, etc. This is mostly just
25 # to quickly fix problems in the bundled dependencies.)
27 cd "$(dirname $0)"
28 # Now in build/workspaces/ (where we assume this script resides)
30 if [ "$preserve_libs" != "true" ]; then
31 echo "Cleaning bundled third-party dependencies..."
33 (cd ../../libraries/source/fcollada/src && rm -rf ./output)
34 (cd ../../libraries/source/fcollada && rm -f .already-built)
35 (cd ../../libraries/source/nvtt/src && rm -rf ./build)
36 (cd ../../libraries/source/nvtt && rm -f .already-built)
37 (cd ../../libraries/source/spidermonkey && rm -f .already-built)
38 (cd ../../libraries/source/spidermonkey && rm -rf ./lib/*.a && rm -rf ./lib/*.so)
39 (cd ../../libraries/source/spidermonkey && rm -rf ./include-unix-debug)
40 (cd ../../libraries/source/spidermonkey && rm -rf ./include-unix-release)
41 (cd ../../libraries/source/spidermonkey && rm -rf ./mozjs-91.13.1)
44 # Still delete the directory of previous SpiderMonkey versions to
45 # avoid wasting disk space if people clean workspaces after updating.
46 (cd ../../libraries/source/spidermonkey && rm -rf ./mozjs-78.6.0)
47 (cd ../../libraries/source/spidermonkey && rm -rf ./mozjs-68.12.1)
48 (cd ../../libraries/source/spidermonkey && rm -rf ./mozjs-62.9.1)
49 (cd ../../libraries/source/spidermonkey && rm -rf ./mozjs-52.9.1pre1)
50 (cd ../../libraries/source/spidermonkey && rm -rf ./mozjs-45.0.2)
51 (cd ../../libraries/source/spidermonkey && rm -rf ./mozjs-38.0.0)
52 (cd ../../libraries/source/spidermonkey && rm -rf ./mozjs31)
53 (cd ../../libraries/source/spidermonkey && rm -rf ./mozjs24)
55 # Delete former premake5 gmake.* directories
56 (cd ../premake/premake5/build && rm -rf ./gmake.bsd)
57 (cd ../premake/premake5/build && rm -rf ./gmake.macosx)
58 (cd ../premake/premake5/build && rm -rf ./gmake.unix)
60 # Cleanup current premake directories
61 (cd ../premake/premake5/build/gmake2.bsd && ${MAKE} clean)
62 (cd ../premake/premake5/build/gmake2.macosx && ${MAKE} clean)
63 (cd ../premake/premake5/build/gmake2.unix && ${MAKE} clean)
65 echo "Removing generated stub and test files..."
67 find ../../source -name "stub_*.cpp" -type f -exec rm {} \;
68 find ../../source -name "test_*.cpp" -type f -not -name "test_setup.cpp" -exec rm {} \;
70 echo "Cleaning build output..."
72 # Remove workspaces/gcc if present
73 rm -rf ./gcc
74 # Remove workspaces/codeblocks if present
75 rm -rf ./codeblocks
76 # Remove workspaces/xcode3 if present
77 rm -rf ./xcode3
78 # Remove workspaces/xcode4 if present
79 rm -rf ./xcode4
81 echo
82 echo "Done. Try running update-workspaces.sh again now."