LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   To exists or not to exists, this is the Q. (https://www.linuxquestions.org/questions/linux-newbie-8/to-exists-or-not-to-exists-this-is-the-q-465085/)

Inbal 07-18-2006 01:23 AM

To exists or not to exists, this is the Q.
 
Hi,

I got a makefile and trying to figure it out, What does these lines mean? :confused:

%/.exists:
mkdir -p $(@D) (****)
touch $@

(****) I think it means to make a new directory while preserving attributes to the target directory .
if the directory doesn't exists.

Thanks for the help,

Inbal

penguintutor 07-18-2006 05:06 AM

mkdir -p
creates a directory, even if the parent directory is missing.

For example if you have a system, you are in your home directory and you wanted to create a directory ~/thisapp/config
(the ~/ bit means your home directory)

If the thisapp directory didn't exist then using mkdir thisapp/config will give the error:
Quote:

mkdir: cannot create directory `thisapp/config': No such file or directory
so you either need to create the thisapp directory first or use:
Code:

mkdir -p thisapp/config
which will create both the thisapp and the thisapp/config directory in a single command.


touch will create an empty file.

Inbal 07-18-2006 05:39 AM

What does the exists mean? is it a kind of macro ? or a rule?

penguintutor 07-18-2006 06:04 AM

I'm not sure, but believe this is a rule.

A target rule normally consists of a string followed by a colon. The can be prefixed with an @ (to turn off echo), and/or a hyphen (so it continues even if that section fails), but I don't know what the percent means.

You would probably need to provide more info from the makefile to make more sense of it. (e.g. is this an internal target referenced from elsewhere in the file?)

There is more info on the autconf tools at: http://sourceware.org/autobook/autob...obook_toc.html.


All times are GMT -5. The time now is 08:34 PM.