tags:

views:

97

answers:

1

In my makefile, I have a:

include .depend

I also have a

depend:
  rules for buiding .depend

Now, here is the problem, when ".depend" does not exist, I can't run "make depend"; I have to do "touch .depend; make depend"

Is there anyway to tell Make "if .depend does not exist, still allow me to run 'make depend'" ?

Thanks!

+2  A: 

I assume you mean that you can't run "make depend" because Make balks at trying to include a file that doesn't exist. If you're using GNUMake you can use -include:

-include .depend

This will include the file if it exists, but continue without error if it doesn't.

(I've heard that sinclude does the same thing in some other versions of Make.)

Beta