2

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!

asked Feb 24, 2010 at 1:09

1 Answer 1

4

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.)

answered Feb 24, 2010 at 2:50
Sign up to request clarification or add additional context in comments.

1 Comment

avoid this because this is very GNU specific :(

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.