how can I format the make output (!!by only changing the qmake project file!!). My compilation lines continue growing, and the one-line-warnings/errors almost disappear between them.
I am thinking of something like
$(CC) in.ext -o out.ext
thanks in regard
qmake is a utility that automates the generation of makefiles. Makefiles are used by the program make to build executable programs from source code; therefore qmake is a make-makefile tool, or makemake for short.
QMake is a build system that generates Makefiles for GNU Make or project build files for Microsoft Visual Studio. It is part of the Qt software framework by Trolltech. While it is commonly used to construct Qt-based software, any project can benefit from it.
Building a Project For simple projects, you only need to run qmake in the top level directory of your project. By default, qmake generates a Makefile that you then use to build the project, and you can then run your platform's make tool to build the project. qmake can also be used to generate project files.
In qmake
, you can add a silent configuration option:
CONFIG += silent
(note: I think that's the command. It's something similar to this.)
Which should suppress most of the output, and only print lines like "compiling a.o", along with your warnings and errors. I believe this is similar to make
's .SILENT.
directive (I think that's the one...)
You may want to be careful with this, however, because it suppresses a lot of information that error parsers like to use. For example, if you are compiling with a SUBDIRS
configuration, it won't print out when it changes to the different directories.
There are different approaches. And you can make them configurable.
@
sign in front of the line within rule, the command itself won't be printed, but its output will.-Werror
to your CFLAGS
variable (you do have one, don't you? It's a common practice!), you definitely won't miss any warning--the build will stop after the first one./dev/null
, leaving only error stream (this is not for your particular case, because gcc usually doesn't yield output but may be helpful for other commands).Unfortunately, for qmake
only the second approach applies. Add to your project file:
QMAKE_CFLAGS+=-Werror
QMAKE_CXXFLAGS+=-Werror
And the makefiles generated will use these flags when they invoke compiler, so the build will stop at every warning.
(this section will be moved to another question as soon an one appears).
For usual make you can use it all--you can make it all configurable! Here's the example:
trace?=short
ifeq ($(trace),short)
suppress_echo=@
redirect_to_null=1>/dev/null
else ifeq ($(trace),full)
suppress_echo=
redirect_to_null=
else ifeq ($(trace),werror)
CFLAGS+=-Werror
else
$(error Incorrect trace type "$(trace)"!)
endif
# Thanks to Martin York for the source of this copy-pasted code
out.ext: $(OBJ)
@echo $(CC) $(CFLAGS) -o out.ext $(redirect_to_null)
$(suppress_echo)$(CC) $(CFLAGS) -o out.ext $(OBJ) $(redirect_to_null)
So, if you invoke make
like this:
$ make trace=full
it will print everything. If you invoke
$ make
the short
value will be used by default (note the ?=
operator instead of usual =
!) and the rules will expand to such version
out.ext: out.o
@echo cc -o out.ext 1>/dev/null
@cc -o out.ext out.o 1>/dev/null
what will give much as you need.
Such approach, with configuration, is used in production code. For example, I saw it in Ubuntu's IcedTea makefiles.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With