[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Makefile template and dependency problem

From: Darin Johnson
Subject: Re: Makefile template and dependency problem
Date: Thu, 30 Jun 2005 01:35:13 -0400 (EDT)

You don't need to do a "make depend" for any reasonably current version of GCC.
If your GCC supports the "-MMD" flag, it will automatically create a ".d" file 
at the
same time that it creates the ".d" file.

Then all you really need in your Makefile is:

    CFLAGS += -MMD   # maybe add -MP also
    ifeq ($(filter clean lessclean mrproper,$(MAKECMDGOALS)),)
    -include $(OBJDIR)/*.d

(There's a snag if you use "distcc" and put ".o" files in a different directory 
the source files, in which case you can add "-MF $(@:.o=.d)" to CFLAGS.)

reply via email to

[Prev in Thread] Current Thread [Next in Thread]