aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2011-10-28 16:35:26 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2011-10-28 16:35:26 +0200
commit902d1a549a2f8a927d1ec78097787b1d5bb5cdf8 (patch)
tree259de2637c5f882855fb96c209f6adc05b9460d2
parent7ed044a4515868a2887b4052b4f48cd61f06ea83 (diff)
Fix makefile detection logic
We have to handle situations where bootstrap.make is included directly.
-rw-r--r--build/bootstrap.make8
-rw-r--r--makefile1
2 files changed, 5 insertions, 4 deletions
diff --git a/build/bootstrap.make b/build/bootstrap.make
index f40850f..4891152 100644
--- a/build/bootstrap.make
+++ b/build/bootstrap.make
@@ -3,8 +3,6 @@
# copyright : Copyright (c) 2004-2011 Code Synthesis Tools CC
# license : GNU GPL v2; see accompanying LICENSE file
-
-
# First time bootstrap.make is read
#
ifndef %makefile%
@@ -61,10 +59,14 @@ export MAKE
# also it will be consistent.
#
-# By convention, the makefile name is the third last word from the end.
+# By convention, the makefile name is the second or third last word from
+# the end. If it is the third, then the second one should be end with
+# bootstrap.make
#
%makefile% := $(subst $(lastword $(MAKEFILE_LIST)),,$(MAKEFILE_LIST))
+ifneq ($(filter %bootstrap.make,$(lastword $(%makefile%))),)
%makefile% := $(subst $(lastword $(%makefile%)),,$(%makefile%))
+endif
%makefile% := $(abspath $(lastword $(%makefile%)))
%makefile_realpath% := $(realpath $(%makefile%))
diff --git a/makefile b/makefile
index 9339ca0..33c8f66 100644
--- a/makefile
+++ b/makefile
@@ -20,7 +20,6 @@ help:
@echo "corresponding directories."
@echo
-
# Install.
#
.PHONY: install $(out_base)/.install