-MD and -MMD
Jamie Lokier
egcs@tantalophile.demon.co.uk
Sun Jan 14 13:44:00 GMT 2001
Tom Tromey wrote:
> I've noticed that neither -MD nor -MMD is documented in invoke.texi.
> Is this intentional? I'm worried that this lack of documentation
> might mean that these switches are deprecated. If that's the case,
> I'd like to argue against deprecating them.
SUNPRO_DEPENDENCIES isn't documented either and it's been a feature for
years. I find it most surprising that it's not documented, as I find it
the single most useful feature for automatic dependencies in embedded
work. (DEPENDENCIES_OUTPUT is appropriate for non-embedded work and
it's documented).
Like this:
.c.o:
> .dep-$@; DEPENDENCIES_OUTPUT='.dep-$@ $@' \
$(CC) $(CFLAGS) -c $< -o $@
%.h:
@echo 'Let'\''s pretend the file `$@'\'' still exists...'
__DEP_FILES := $(wildcard .dep-*)
ifneq "" "$(__DEP_FILES)"
-include $(__DEP_FILES)
endif
These various -M options are all very handy I'm sure, but for simple
_automatic_ dependencies I find the above much more effective.
I've used this for 6 years on many projects, and I still don't see why
other projects need "make depend".
-- Jamie
More information about the Gcc
mailing list