From 0a92e0b1fddbda530bf046e386778a9a3e8f572a Mon Sep 17 00:00:00 2001 From: Sami Vaarala Date: Sun, 2 Feb 2014 18:36:44 +0200 Subject: [PATCH] add a minimal setup check to Makefile, also print a notice to users running the developer makefile on other than Linux platforms --- Makefile | 6 +++++- util/check_setup.sh | 28 ++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 1 deletion(-) create mode 100755 util/check_setup.sh diff --git a/Makefile b/Makefile index 433c8aa9..ffc0d0f7 100644 --- a/Makefile +++ b/Makefile @@ -170,7 +170,11 @@ CCLIBS += -lncurses # on some systems -lreadline also requires -lncurses (e.g. # Compile 'duk' only by default .PHONY: all -all: duk +all: checksetup duk + +.PHONY: checksetup +checksetup: + @util/check_setup.sh .PHONY: clean clean: diff --git a/util/check_setup.sh b/util/check_setup.sh new file mode 100755 index 00000000..dae28022 --- /dev/null +++ b/util/check_setup.sh @@ -0,0 +1,28 @@ +#!/bin/sh +# +# Check prerequisites for using the Duktape makefile. Exit with an error +# and a useful error message for missing prerequisites. +# + +NODE_VERSION=`node -v 2>/dev/null` +if [ "x$NODE_VERSION" = "x" ]; then + echo "*** Missing NodeJS:" + echo " $ sudo apt-get install nodejs npm" + exit 1 +fi + +GIT_VERSION=`git --version` +if [ "x$GIT_VERSION" = "x" ]; then + echo "*** Missing git:" + echo " $ sudo apt-get install git" + exit 1 +fi + +uname -a | grep -ni linux >/dev/null +RET=$? +if [ "x$RET" != "x0" ]; then + echo "*** Based on uname, you're not running on Linux. Duktape developer" + echo " makefile is intended for Linux only; YMMV on other platforms." + echo "" + sleep 1 +fi