I use intermediate files in my Makefile, however make prints out the rm command that it uses to delete them all afterwards. How do I hide this print statement?
A:
The GNU Make manual section on Command Echoing states: When a line starts with `@', the echoing of that line is suppressed.
Prefix your rm command
@rm tempfile
However, if you construct your make rules correctly so that make sees the tempfile(s) as an intermediate step then make will remove it automatically.
Stephen P
2010-05-21 18:25:58
Yes, that's not what I'm asking. I have constructed my make rules so that the intermediate files are removed automatically, however the rm command that make uses internally is still printed, I would like to hide this printed information?
Dan
2010-05-24 08:43:03
That's why I answered with the `@` prefix, then as an aside, also mentioned the possibility of using rule construction to make it automatic.
Stephen P
2010-05-24 15:32:24
You sort of missed the point, I was asking how to suppress the removal output _and_ still allow make to remove the intermediates automatically. However, it seems this isn't possible.
Dan
2010-05-25 14:08:39
+1
A:
The make manual says that targets marked .SECONDARY
will behave as .INTERMEDIATE
but won't be automatically deleted. You could mark all the intermediate targets as secondary, and then remove the files yourself, something like
OBJECTS=foo.o bar.o
all:foo bar
@rm -f $(OBJECTS)
.SECONDARY: $(OBJECTS)
should do.
Scott Wales
2010-05-24 09:34:50
That does do the job, so I'll accept it, but this is a bit of a hack in my opinion, I was hoping for a more elegant solution.
Dan
2010-05-25 14:04:49