help-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Detecting parallel build


From: Noel Yap
Subject: Re: Detecting parallel build
Date: Tue, 31 Aug 2004 13:44:22 -0400
User-agent: Mozilla Thunderbird 0.5 (Windows/20040212)

You can look at the variable MAKEFLAGS, IIRC.

Alternatively, rather than outputting to the logfile within the actions 
themselves, you can redirect make's output:

        make -j 8 -l 8 foo
        make foo >message.log

IMHO, this is much simpler and less intrusive than what you're planning.

HTH,
Noel

fred bleuzet wrote:

Hi all,
My problem at hand is to create a process that watches over a build with a Makefile, and sends a message with build break information if something goes wrong. In essence, my solution is to log any relevant information and utility output in a file (message.log) that I use for sending the email. That way, when I receive an email, I should know what's wrong before going to the build machine.
This goes more or less like this:

%.o: %.cpp
 echo "Compiling $<" >> message.log
 $(CC) $< -o $@ >> message.log
The problem is that in parallel build, the message.log file is unreadable if multiple processes write to it (Unix), or breaks the build when processes lock the file for writing (Windows). To work around this problem, the build would write to the log file only when the build is sequential. So my process is to build in parallel, and if the build break, the process runs the build sequentially, logging messages to the file, and when the sequential build breaks, the process sends the log file as information.
So, I'm thinking of a Makefile being like:
if (<<< Parallel build >>>)
LOGGING:=
else
LOGGING:= >> message.log
endif
%.o: %.cpp
 echo "Compiling $<" $(LOGGING)
 $(CC) $< -o $@ $(LOGGING)
This could work if I could detect when the build runs in parallel. How can I do that?
Fred
------------------------------------------------------------------------
Express yourself instantly with MSN Messenger! Download today - it's FREE! <http://g.msn.com/8HMBENUS/2728??PS=47575>


------------------------------------------------------------------------

_______________________________________________
Help-make mailing list
address@hidden
http://lists.gnu.org/mailman/listinfo/help-make




reply via email to

[Prev in Thread] Current Thread [Next in Thread]