Capture makefile output

This is a discussion on Capture makefile output within the C Programming forums, part of the General Programming Boards category; Hi - When I do a "make", all its output is displayed on the screen...and there is one part where ...

  1. #1
    Registered User
    Join Date
    Sep 2008

    Capture makefile output

    Hi - When I do a "make", all its output is displayed on the screen...and there is one part where it calculates and dispalys the size of the firmware...

    Is it possible to include a command in the makefile that captures that line of the make output? I would like to save the firmware file size to a size.out file.

    Please help!

  2. #2
    "I Win!" by U. Lose vart's Avatar
    Join Date
    Oct 2006
    Rishon LeZion, Israel
    just redirect output to file - and then grep file in some way
    To be or not to be == true

  3. #3
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    You'll probably also want to capture the output of stderr. (GCC errors and warnings, for example, are printed on stderr.)
    make >make.out 2>&1
    Or perhaps something like this . . .
    make 2>&1 | grep firmware > size.out
    (That saves every line in the make output that contains the word "firmware".)

    Or, if you want to see the output on the screen as well as save it:
    make 2>&1 | tee make.out
    The possibilities are endless . . .

    [edit] BTW: as this isn't really a C programming question, next time post it in the Tech Board. [/edit]

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell

    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ:

    My website:
    Projects: codeform, xuni, atlantis, nort, etc.

  4. #4
    ZuK is offline
    Registered User
    Join Date
    Aug 2005
    If you want to have a lot of output from make, use the -d switch
    make -d

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. calling an external program + capture output?
    By cyberfish in forum C++ Programming
    Replies: 4
    Last Post: 03-21-2008, 01:49 AM
  2. Replies: 4
    Last Post: 11-30-2005, 04:44 PM
  3. Formatting output into even columns?
    By Uncle Rico in forum C Programming
    Replies: 2
    Last Post: 08-16-2005, 06:10 PM
  4. Can we use select() to capture output from execl()?
    By Nessarose in forum Networking/Device Communication
    Replies: 5
    Last Post: 07-05-2005, 01:53 AM
  5. Output problems with structures
    By Gkitty in forum C Programming
    Replies: 1
    Last Post: 12-16-2002, 05:27 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21