< Erlang bugs mailing list ~ otp-build does not run as expected if called from a Makefile
|Posted: Tue Jun 22, 2010 11:29 pm
in R13B04 (it looks like R14A is the same, but I haven't tried), the
top-level script 'otp_build' doesn't work as expected if it's called
from a Makefile.
Here's an example of it going wrong in R13B04 (these commands are being
issued by make, not at the command line):
./otp_build configure --xcomp-conf=xcomp/erl-xcomp-mips-linux.conf
sh -c "cd otp_src_R13B04; ./otp_build boot -a"
[: 1432: Xmake:: unexpected operator
make: Entering directory `/home/matthias/corelatus/rootfs/packages/erlang/otp_src_R13B04'
* Cross compiling Erlang/OTP-R13B04 for: x86_64-unknown-linux-gnu
otp_build then works for quite some time (minutes) before running into
trouble. The final error message has nothing to do with the actual problem,
the clue of the real problem is the "unexpected operator" line above.
The problem is that otp_build has a few lines like this:
if [ X`$MAKE is_cross_configured` = Xyes ]; then
usually, if you run that line, you get the answer "yes". But if otp_build
was called by make, then the make invoked by the line above detects that
it's running inside another make and the answer becomes
"make: Entering directory `/home/matthias/corelatus/rootfs/packages/erlang/otp_src_R13B04'yes"
Solutions I can think of:
1. Don't allow running otp_build from within make, since it does the
wrong thing. Fail early. I've appended a patch for that below
2. use make's --no-print-directory switch to suppress the extra junk.
That's a nice solution which actually solves the problem, but
I'm not sure it'll work for clearmake (and BSD?), though.
3. conceal the fact that make is running, by clearing MAKELEVEL and
MAKEFLAGS. That seems dirty.
diff --git a/otp_build b/otp_build
index 1744351..33424d8 100755
@@ -870,6 +870,11 @@ lookup_prog_in_path ()
+ if [ X$MAKELEVEL != X ]; then
+ echo "This script works badly if run by 'make'. Aborting."
+ exit 1
if [ -z "$MAKE" ]; then
case $TARGET in
erlang-bugs (at) erlang.org mailing list.
To unsubscribe; mailto:firstname.lastname@example.org
Post received from mailinglist
|Back to top
All times are GMT
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum