次の方法で共有


Search Paths in Rules

 

The latest version of this topic can be found at Search Paths in Rules.

frompath}.fromext{topath}.toext:
commands

  
## Remarks  
 An inference rule applies to a dependency only if paths specified in the dependency exactly match the inference-rule paths. Specify the dependent's directory in *frompath* and the target's directory in *topath*; no spaces are allowed. Specify only one path for each extension. A path on one extension requires a path on the other. To specify the current directory, use either a period (.) or empty braces ({ }). Macros can represent *frompath* and *topath*; they are invoked during preprocessing.  
  
## Example  
  
### Code  
  

{dbi}.cpp{$(ODIR)}.obj::
$(CC) $(CFLAGS) $(YUDBI) $<

{ilstore}.cpp{$(ODIR)}.obj::
$(CC) $(CFLAGS) $<

{misc}.cpp{$(ODIR)}.obj::
$(CC) $(CFLAGS) $(YUPDB) $<

{misc}.c{$(ODIR)}.obj::
$(CC) $(CFLAGS) $<

{msf}.cpp{$(ODIR)}.obj::
$(CC) $(CFLAGS) $<

{bsc}.cpp{$(ODIR)}.obj::
$(CC) $(CFLAGS) $(YUPDB) $<

{mre}.cpp{$(ODIR)}.obj::
$(CC) $(CFLAGS) $(YUPDB) $<

{namesrvr}.cpp{$(ODIR)}.obj::
$(CC) $(CFLAGS) $(YUPDB) $<

{src\cvr}.cpp{$(ODIR)}.obj::
$(CC) $(CFLAGS) $<

  
## See Also  
 [Defining a Rule](../Topic/Defining%20a%20Rule.md)