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
[EMAIL PROTECTED]
http://lists.gnu.org/mailman/listinfo/help-make
_______________________________________________
Help-make mailing list
[EMAIL PROTECTED]
http://lists.gnu.org/mailman/listinfo/help-make