[Top][All Lists]

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

Re: How do I check if a directory exists?

From: Eric Hanchrow
Subject: Re: How do I check if a directory exists?
Date: 08 Dec 2003 12:31:04 -0800
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50

Tristan wrote:

    Jimmy DeWitt wrote:

    > How do I test if a directory exists with make?
    > I would like to have a Makefile that checks if a specific directory
    > is there, if it
    > is I would like to cd to it and build .
    > if foo
    >         cd foo
    >         make -f my_makefile
    > Is there a way to do this without scripts?

    Would this suite your purpose ?

    target: my_dir/Makefile
            $(MAKE) -C my_dir

I'd amend that a little, like so:

                -$(MAKE) -C my_dir

Here's what I changed:

* I didn't make `target' depend on a file named Makefile, since I'm
  not certain that such a file actually exists (perhaps you named it

* I put a dash in front of the command, so that if it fails (because
  the directory doesn't exist, for example) your top-level make will
  *not* fail -- I suspect this is what you want.

If you can't change your underwear, can you be sure you have any?

reply via email to

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