From d4474667efe796bc6569ee5aeece56c3893162b5 Mon Sep 17 00:00:00 2001 From: Giovanni Bussi <giovanni.bussi@gmail.com> Date: Thu, 6 Dec 2012 18:01:58 +0100 Subject: [PATCH] Added primitive control for inter-module dependence --- src/maketools/check_module.sh | 31 +++++++++++++++++++++++++++++++ src/maketools/make.module | 1 + 2 files changed, 32 insertions(+) create mode 100755 src/maketools/check_module.sh diff --git a/src/maketools/check_module.sh b/src/maketools/check_module.sh new file mode 100755 index 000000000..e96402e03 --- /dev/null +++ b/src/maketools/check_module.sh @@ -0,0 +1,31 @@ +#!/bin/bash + +dir=$1 + +msg="ERROR: this module depends on $dir, which is presently disabled" + +cd ../ + +if test -f $dir/module.type +then + case "$(cat "$dir/module.type")" in + (always) exit 0 ;; + (default-on) + if test -f $dir.off + then + echo "$msg" + exit 1 + else + exit 0 + fi ;; + (default-off) + if test -f $dir.on + then + exit 0 + else + echo "$msg" + exit 1 + fi ;; + esac +fi + diff --git a/src/maketools/make.module b/src/maketools/make.module index 6e6159de7..bdc775de7 100644 --- a/src/maketools/make.module +++ b/src/maketools/make.module @@ -25,6 +25,7 @@ DEP=$(addprefix deps/,$(SRC:.cpp=.d)) all: @echo Creating links to other here to simplify .h inclusion: @for dir in $(USE) ; do test -L $$dir || ln -s ../$$dir . && echo " " $$dir ; done + @for dir in $(USE) ; do ../maketools/check_module.sh $$dir ; done @echo Building dependencies @for dir in $(BUILDAFTER) ; do echo " " $$dir ; cd ../$$dir ; $(MAKE) ; cd - ; done $(MAKE) obj -- GitLab