K. Lange 2 years ago
parent
commit
5688627461
4 changed files with 33 additions and 12 deletions
  1. 10 1
      Makefile
  2. 0 11
      util/activate.sh
  3. 11 0
      util/check.sh
  4. 12 0
      util/prompt.sh

+ 10 - 1
Makefile

@@ -1,7 +1,16 @@
 APPS=init hello sh ls terminal uname compositor drawlines background session kdebug cat yutani-test sysinfo hostname yutani-query env mount date echo nyancat kill ps pstree bim terminal-vga cursor-off font-server migrate free uptime
 
 ifeq ($(TOOLCHAIN),)
-	export PATH := $(shell util/activate.sh)
+  ifeq ($(shell util/check.sh),y)
+    export PATH := $(shell util/activate.sh)
+  else
+    FOO := $(shell util/prompt.sh)
+    ifeq ($(shell util/check.sh),y)
+      export PATH := $(shell util/activate.sh)
+    else
+      $(error "No toolchain, and you did not ask to build it.")
+    endif
+  endif
 endif
 
 KERNEL_TARGET=i686-pc-toaru

+ 0 - 11
util/activate.sh

@@ -1,17 +1,6 @@
 #!/bin/bash
 
 DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
-
-if [ ! -e "$DIR/local/bin/i686-pc-toaru-gcc" ]; then
-    echo -n "Toolchain has not been built. Would you like to build it now? (y/n) " >&2
-    read response
-    case $response in
-        [yY]) bash $DIR/build-gcc.sh ;;
-        [nN]) exit 1 ;;
-        *) exit 1 ;;
-    esac
-fi
-
 export PATH="$DIR/local/bin:$PATH"
 export TOOLCHAIN="$DIR"
 echo "$DIR/local/bin:$PATH"

+ 11 - 0
util/check.sh

@@ -0,0 +1,11 @@
+#!/bin/bash
+
+DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
+
+if [ ! -e "$DIR/local/bin/i686-pc-toaru-gcc" ]; then
+    echo -n "n";
+    exit 1;
+else
+    echo -n "y";
+    exit 0;
+fi

+ 12 - 0
util/prompt.sh

@@ -0,0 +1,12 @@
+#!/bin/bash
+
+DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
+
+echo -n "Toolchain has not been built. Would you like to build it now? (y/n) " >&2
+read response
+case $response in
+    [yY]) bash $DIR/build-gcc.sh >&2 ;;
+    [nN]) echo -n "n" && exit 1 ;;
+    *)
+esac
+