Git commit cd599de58b44596a5e86a5fe560e2904ef5efe7f by David Faure. Committed on 30/07/2015 at 12:54. Pushed by dfaure into branch 'master'.
Add support for ninja to makeobj Usage: alias make=makeobj, as usual. This allows to do "make" and "make install" (etc.) in either the source dir or the build dir, provided that $OBJ_REPLACEMENT is set. CCMAIL: m...@vhanda.in, kde-core-devel@kde.org M +28 -9 makeobj http://commits.kde.org/kde-dev-scripts/cd599de58b44596a5e86a5fe560e2904ef5efe7f diff --git a/makeobj b/makeobj index d4f82ad..e4d65d4 100755 --- a/makeobj +++ b/makeobj @@ -111,10 +111,14 @@ dir=. cwd=$PWD # No CMakeList and no Makefile (and no .pro file either)? Maybe we need to go up then. -while test ! -f CMakeLists.txt && test ! -f Makefile; do +while test ! -f CMakeLists.txt && test ! -f Makefile ; do if test "`ls -1 *.pro 2>/dev/null`" && test -n "`ls -1 ../*.pro 2>/dev/null`"; then break; fi + if test -f build.ninja; then + file=build.ninja + break; + fi dir="$dir/`basename \"$PWD\"`" cd .. if test X"$PWD" = X"/"; then @@ -173,12 +177,23 @@ if test ! -f "$file"; then sed -e s,%ARCH%,\"$_arch\",g | \ sed -e s,%OS%,\"$_os\",g`" pwd="`echo $PWD | sed -e \"$OBJ_REPLACEMENT\"`" + if test ! -e $pwd; then + echo "no objdir found. Tried $pwd" + exit 1 + fi if test ! -f "$pwd/$file"; then - # No objdir found. But if "make" will work in srcdir, then go ahead; might be a non-kde project. + # ninja requires building from the toplevel + cd -- "$pwd" + findup build.ninja + if test -n "$_hit"; then + pwd=`dirname $_hit` + file=build.ninja + fi + # No objdir with a Makefile found. But if "make" will work in srcdir, then go ahead; might be a non-kde project. test -f "$pwd/GNUmakefile" && file=GNUmakefile test -f "$pwd/makefile" && file=makefile if ! test -f "$pwd/$file"; then - echo "no objdir found. Tried $pwd" + echo "no Makefile or build.ninja found in $pwd" exit 1 fi fi @@ -199,13 +214,17 @@ if test -z "$MAKE"; then fi if test $using_new_unsermake -eq 1; then MAKE="`command -v unsermake`" - if test ! -x "$MAKE"; then - echo 'Makefile was created with unsermake, but there' - echo 'is no unsermake in $PATH' - exit 1 - fi - else + if test ! -x "$MAKE"; then + echo 'Makefile was created with unsermake, but there' + echo 'is no unsermake in $PATH' + exit 1 + fi + elif test -f "Makefile"; then MAKE="$GMAKE" + elif test -f "build.ninja"; then + MAKE="ninja" + else + echo "No Makefile or build.ninja found in $PWD!" fi fi LANG=en_US.UTF-8 $MAKE "${args[@]}"