Rorschach
Rorschach

Reputation: 32426

Ignore prerequisite building output only from GNU make

What is a simple way to ignore all output from GNU make's building prereqs, but keep all the rest (both stdout and stderr). I'm working with a script that randomly uses either stream. So, for example, if I have

t: main.native ${STUFF}
        ./${SCRIPTS}/run-tests

How can I just do make t &> output and get the output without all the rebuild info from the prerequisites prepended (eg. only outputs from run-tests in the above example)?

Upvotes: 0

Views: 185

Answers (2)

Maxim Egorushkin
Maxim Egorushkin

Reputation: 136306

How can I just do make t &> output and get the output without all the rebuild info from the prerequisites prepended (eg. only outputs from run-tests in the above example)?

Build targets main.native ${STUFF} first and then run tests only. E.g.

tests : main.native ${STUFF}

run_tests : tests
    ./${SCRIPTS}/run-tests

.PHONY : tests run_tests

And then:

make tests && make run_test &> output

Upvotes: 0

Beta
Beta

Reputation: 99124

I'm still not quite sure what you're looking for, but you can do this:

t: main.native ${STUFF}
    @echo PREREQS_DONE
    ./${SCRIPTS}/run-tests

>make t | sed '1,/PREREQS_DONE/d'

Or this:

t:
    @$(MAKE) real_t  | sed '1,/PREREQS_DONE/d'

real_t: main.native ${STUFF}
    @echo PREREQS_DONE
    ./${SCRIPTS}/run-tests

Upvotes: 1

Related Questions