Show filename while compiling

Guest #2282088
???

As gcc is a command line tool only, you control which files are 
compiled, by typing their names in the command.

If you use make with a makefile, gcc should be called individually for 
each source file, and you cann see the command line for each source 
file.

Oliver
OP #2282689
I use the makefile, yes, with -s option (silent, probably).

Otherwise the screen is full of garbage (well, lots of unimportant 
information).

MS VC, on the other hand, simply shows "compiling source.c",
and not the complete path and each and every single command line option.

Thats what I want, just a simple "compiling source.c".

It can't be done? (w/o changing the makefile, and adding echo)
Guest #2282856
You can try something like this:
1
make -s CC="@echo \"compiling $@\"; gcc" CXX="@echo \"compiling $@\"; g++"

But better you change the makefile.
Guest #2282866
gcc is blank compiler but as mentioned already make is used
to process the files.

It displays already which file is being compiled like here..

make  all-am
make[1]: Entering directory `/home/blah/src/banner-1.3.2'
gcc -DHAVE_CONFIG_H -I. -I. -I. -I.    -g -O2 -c banner.c
gcc  -g -O2   -o banner  banner.o

..but I think there is a misconception what make is intended for.
The approach is totally different compared to the MS stuff.

For instance make is also used for building sendmail config
files or NIS maps. These have nothing to do with compiling.
make provides a macro language to process files this includes
compiling but it is not limited to that.

You can edit the Makefile to add "compiling <blah"> but nobody
else would do so because the information is already provided
by a regular make run.
OP #2283635
MS VC is the one that shows "compiling source.c", not the makefile.
GCC should be able to do the same, AFAIC.

But, I'll have to change the makefile, its not that hard after all.
Guest #2283806
> There is no reason for a diagnostic message for a file that compiles fine.
For big projects it is sometimes nice to see the compiling progress to 
estimate the time you have for your coffee and/or cigarette :)
But as you already said: "Write a proper makefile to fit your needs."

Reply

A question of your own? This thread is over 15 years old. Ask it in a thread of its own – more people read along there, and it gets answered more often and sooner.

Start a new thread

A fix, an addition or feedback on this thread? Then reply here.

Formatting
  • [c]C-Code[/c]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]
  • [[Title]] – link to an article
  • Link to another post: right-click its post ID (#8078628), copy the address, paste it into the text

More about formatting

Post long source code as an attachment, not in the text.

Already registered? Log in

Not shown to anyone. We send you a link; your post appears once you confirm it there.

By submitting you create a free account and accept the terms of use.