Erlang/OTP Forums

Author Message

<  Erlang bugs mailing list  ~  otp-build does not run as expected if called from a Makefile

Guest
Posted: Tue Jun 22, 2010 11:29 pm Reply with quote
Guest
Hi,

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[1]:: unexpected operator
make[1]: 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[1]: 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
(against R14A)

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.

Matt

======================================================================
diff --git a/otp_build b/otp_build
index 1744351..33424d8 100755
--- a/otp_build
+++ b/otp_build
@@ -870,6 +870,11 @@ lookup_prog_in_path ()

setup_make ()
{
+ if [ X$MAKELEVEL != X ]; then
+ echo "This script works badly if run by 'make'. Aborting."
+ exit 1
+ fi
+
if [ -z "$MAKE" ]; then
case $TARGET in
win32)

________________________________________________________________
erlang-bugs (at) erlang.org mailing list.
See http://www.erlang.org/faq.html
To unsubscribe; mailto:erlang-bugs-unsubscribe@erlang.org

Post received from mailinglist

Display posts from previous:  

All times are GMT
Page 1 of 1
This forum is locked: you cannot post, reply to, or edit topics.

Jump to:  

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