Roland Ver. 4.5 Technical Information Seite 37

  • Herunterladen
  • Zu meinen Handbüchern hinzufügen
  • Drucken
  • Seite
    / 212
  • Inhaltsverzeichnis
  • LESEZEICHEN
  • Bewertet. / 5. Basierend auf Kundenbewertungen
Seitenansicht 36
Chapter 4: Writing Rules 27
vpath %.c foo
vpath % blish
vpath %.c bar
will look for a file ending in .c in foo, then blish, then bar, while
vpath %.c foo:bar
vpath % blish
will look for a file ending in .c in foo, then bar, then blish.
4.4.3 How Directory Searches are Performed
When a prerequisite is found through directory search, regardless of type (general or se-
lective), the pathname located may not be the one that make actually provides you in the
prerequisite list. Sometimes the path discovered through directory search is thrown away.
The algorithm make uses to decide whether to keep or abandon a path found via directory
search is as follows:
1. If a target file does not exist at the path specified in the makefile, directory search is
performed.
2. If the directory search is successful, that path is kept and this file is tentatively stored
as the target.
3. All prerequisites of this target are examined using this same method.
4. After processing the prerequisites, the target may or may not need to be rebuilt:
a. If the target does not need to be rebuilt, the path to the file found during directory
search is used for any prerequisite lists which contain this target. In short, if make
doesn’t need to rebuild the target then you use the path found via directory search.
b. If the target does need to be rebuilt (is out-of-date), the pathname found during
directory search is thrown away, and the target is rebuilt using the file name
specified in the makefile. In short, if make must rebuild, then the target is rebuilt
locally, not in the directory found via directory search.
This algorithm may seem complex, but in practice it is quite often exactly what you
want.
Other versions of make use a simpler algorithm: if the file does not exist, and it is found
via directory search, then that pathname is always used whether or not the target needs
to be built. Thus, if the target is rebuilt it is created at the pathname discovered during
directory search.
If, in fact, this is the behavior you want for some or all of your directories, you can use
the GPATH variable to indicate this to make.
GPATH has the same syntax and format as VPATH (that is, a space- or colon-delimited list
of pathnames). If an out-of-date target is found by directory search in a directory that also
appears in GPATH, then that pathname is not thrown away. The target is rebuilt using the
expanded path.
4.4.4 Writing Recipes with Directory Search
When a prerequisite is found in another directory through directory search, this cannot
change the recipe of the rule; they will execute as written. Therefore, you must write the
recipe with care so that it will look for the prerequisite in the directory where make finds it.
Seitenansicht 36
1 2 ... 32 33 34 35 36 37 38 39 40 41 42 ... 211 212

Kommentare zu diesen Handbüchern

Keine Kommentare