Version:
--------

GNU Make version 3.78.1, by Richard Stallman and Roland McGrath.
Built for sparc-sun-solaris2.8


Situation:
---------

Files such as scripts are in two directories, one which is used
for development and testing, and another which end users have in
their paths. There is a makefile with an implicit rule for updating
files, i.e. copying them from the development directory to the
production directory. The implicit rule is apparently not being
interpreted as I would expect for files in subdirectories.


Sample directory structure:
--------------------------

                                  /
                                  |
                              parent_dir
                                  |
                       ----------------------
                       |                    |
                    prod_dir--file1      dev_dir--file1
                              file2               file2
                              fil33               file3
                              subdir1--file4      subdir1--file4
                                       file5               file5
                                       file6               file6                      
                              Makefile       
                        

Sample Makefile contents:
------------------------

%:$(DEV_DIR)/%
        cp -p $(DEV_DIR)/$@ $@

main:   group1 group2

group1: file1 file2 file3

group2: ./subdir1/file4 ./subdir1/file5 ./subdir1/file6


How make is invoked:
-------------------

cd parent_dir/prod_dir
gmake -r -f Makefile DEV_DIR=/parent_dir/dev_dir


What should happen:
------------------

file1, file2, and file3 should be copied from dev_dir to prod_dir
if there are newer versions in dev_dir, and the same for files in
the respective subdirectories.

Applying the implicit rule for file1 we should have:

file1: /parent_dir/dev_dir/file1
        cp -p /parent_dir/dev_dir/$@ $@


Applying the implicit rule for ./subdir1/file4 we should have:

./subdir1/file4: /parent_dir/dev_dir/./subdir1/file4
        cp -r -p /parent_dir/dev_dir/$@ $@


What does happen:
----------------

Newer files in /parent/dev_dir get copied, but newer ones in 
the subdirectory subdir1 do not.

So it looks like the % in the implicit rule only works when
it represents a simple file name, not when it represents a 
relative or absolute path.

Attached is the debug output from gmake for the sample above.
Notice that for file2 an implicit rule is found, but not for
./subdir1/file4.


Scott Pedigo
Oerlikon-Contraves AG
Birchstrasse 155
CH-8050 Switzerland

E-mail: [EMAIL PROTECTED]
GNU Make version 3.78.1, by Richard Stallman and Roland McGrath.
Built for sparc-sun-solaris2.8
Copyright (C) 1988, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99
        Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.

Report bugs to <[EMAIL PROTECTED]>.

Reading makefiles...
Reading makefile `Makefile'...
Updating makefiles....
 Considering target file `Makefile'.
  Looking for an implicit rule for `Makefile'.
  Trying pattern rule with stem `Makefile'.
  Trying implicit prerequisite `/home/eaa/czped/test_make/dev_dir/Makefile'.
  Trying pattern rule with stem `Makefile'.
  Trying implicit prerequisite `/home/eaa/czped/test_make/dev_dir/Makefile'.
  Looking for a rule with intermediate file 
`/home/eaa/czped/test_make/dev_dir/Makefile'.
   Avoiding implicit rule recursion.
  No implicit rule found for `Makefile'.
  Finished prerequisites of target file `Makefile'.
 No need to remake target `Makefile'.
Updating goal targets....
Considering target file `main'.
 File `main' does not exist.
 Looking for an implicit rule for `main'.
 Trying pattern rule with stem `main'.
 Trying implicit prerequisite `/home/eaa/czped/test_make/dev_dir/main'.
 Trying pattern rule with stem `main'.
 Trying implicit prerequisite `/home/eaa/czped/test_make/dev_dir/main'.
 Looking for a rule with intermediate file `/home/eaa/czped/test_make/dev_dir/main'.
  Avoiding implicit rule recursion.
 No implicit rule found for `main'.
  Considering target file `group1'.
   File `group1' does not exist.
   Looking for an implicit rule for `group1'.
   Trying pattern rule with stem `group1'.
   Trying implicit prerequisite `/home/eaa/czped/test_make/dev_dir/group1'.
   Trying pattern rule with stem `group1'.
   Trying implicit prerequisite `/home/eaa/czped/test_make/dev_dir/group1'.
   Looking for a rule with intermediate file 
`/home/eaa/czped/test_make/dev_dir/group1'.
    Avoiding implicit rule recursion.
   No implicit rule found for `group1'.
    Considering target file `file1'.
     Looking for an implicit rule for `file1'.
     Trying pattern rule with stem `file1'.
     Trying implicit prerequisite `/home/eaa/czped/test_make/dev_dir/file1'.
     Found an implicit rule for `file1'.
      Considering target file `/home/eaa/czped/test_make/dev_dir/file1'.
       Looking for an implicit rule for `/home/eaa/czped/test_make/dev_dir/file1'.
       Trying pattern rule with stem `file1'.
       Trying implicit prerequisite 
`/home/eaa/czped/test_make/dev_dir//home/eaa/czped/test_make/dev_dir/file1'.
       Trying pattern rule with stem `file1'.
       Trying implicit prerequisite 
`/home/eaa/czped/test_make/dev_dir//home/eaa/czped/test_make/dev_dir/file1'.
       Looking for a rule with intermediate file 
`/home/eaa/czped/test_make/dev_dir//home/eaa/czped/test_make/dev_dir/file1'.
        Avoiding implicit rule recursion.
       No implicit rule found for `/home/eaa/czped/test_make/dev_dir/file1'.
       Finished prerequisites of target file `/home/eaa/czped/test_make/dev_dir/file1'.
      No need to remake target `/home/eaa/czped/test_make/dev_dir/file1'.
     Finished prerequisites of target file `file1'.
     Prerequisite `/home/eaa/czped/test_make/dev_dir/file1' is newer than target 
`file1'.
    Must remake target `file1'.
cp -p /home/eaa/czped/test_make/dev_dir/file1 file1
Putting child 0x0004ab00 (file1) PID 11894 on the chain.
Live child 0x0004ab00 (file1) PID 11894 
Got a SIGCHLD; 1 unreaped children.
Reaping winning child 0x0004ab00 PID 11894 
Removing child 0x0004ab00 PID 11894  from chain.
    Successfully remade target file `file1'.
    Considering target file `file2'.
     Looking for an implicit rule for `file2'.
     Trying pattern rule with stem `file2'.
     Trying implicit prerequisite `/home/eaa/czped/test_make/dev_dir/file2'.
     Found an implicit rule for `file2'.
      Considering target file `/home/eaa/czped/test_make/dev_dir/file2'.
       Looking for an implicit rule for `/home/eaa/czped/test_make/dev_dir/file2'.
       Trying pattern rule with stem `file2'.
       Trying implicit prerequisite 
`/home/eaa/czped/test_make/dev_dir//home/eaa/czped/test_make/dev_dir/file2'.
       Trying pattern rule with stem `file2'.
       Trying implicit prerequisite 
`/home/eaa/czped/test_make/dev_dir//home/eaa/czped/test_make/dev_dir/file2'.
       Looking for a rule with intermediate file 
`/home/eaa/czped/test_make/dev_dir//home/eaa/czped/test_make/dev_dir/file2'.
        Avoiding implicit rule recursion.
       No implicit rule found for `/home/eaa/czped/test_make/dev_dir/file2'.
       Finished prerequisites of target file `/home/eaa/czped/test_make/dev_dir/file2'.
      No need to remake target `/home/eaa/czped/test_make/dev_dir/file2'.
     Finished prerequisites of target file `file2'.
     Prerequisite `/home/eaa/czped/test_make/dev_dir/file2' is newer than target 
`file2'.
    Must remake target `file2'.
cp -p /home/eaa/czped/test_make/dev_dir/file2 file2
Putting child 0x0004ac00 (file2) PID 11895 on the chain.
Live child 0x0004ac00 (file2) PID 11895 
Got a SIGCHLD; 1 unreaped children.
Reaping winning child 0x0004ac00 PID 11895 
Removing child 0x0004ac00 PID 11895  from chain.
    Successfully remade target file `file2'.
    Considering target file `file3'.
     Looking for an implicit rule for `file3'.
     Trying pattern rule with stem `file3'.
     Trying implicit prerequisite `/home/eaa/czped/test_make/dev_dir/file3'.
     Found an implicit rule for `file3'.
      Considering target file `/home/eaa/czped/test_make/dev_dir/file3'.
       Looking for an implicit rule for `/home/eaa/czped/test_make/dev_dir/file3'.
       Trying pattern rule with stem `file3'.
       Trying implicit prerequisite 
`/home/eaa/czped/test_make/dev_dir//home/eaa/czped/test_make/dev_dir/file3'.
       Trying pattern rule with stem `file3'.
       Trying implicit prerequisite 
`/home/eaa/czped/test_make/dev_dir//home/eaa/czped/test_make/dev_dir/file3'.
       Looking for a rule with intermediate file 
`/home/eaa/czped/test_make/dev_dir//home/eaa/czped/test_make/dev_dir/file3'.
        Avoiding implicit rule recursion.
       No implicit rule found for `/home/eaa/czped/test_make/dev_dir/file3'.
       Finished prerequisites of target file `/home/eaa/czped/test_make/dev_dir/file3'.
      No need to remake target `/home/eaa/czped/test_make/dev_dir/file3'.
     Finished prerequisites of target file `file3'.
     Prerequisite `/home/eaa/czped/test_make/dev_dir/file3' is newer than target 
`file3'.
    Must remake target `file3'.
cp -p /home/eaa/czped/test_make/dev_dir/file3 file3
Putting child 0x0004b1c8 (file3) PID 11896 on the chain.
Live child 0x0004b1c8 (file3) PID 11896 
Got a SIGCHLD; 1 unreaped children.
Reaping winning child 0x0004b1c8 PID 11896 
Removing child 0x0004b1c8 PID 11896  from chain.
    Successfully remade target file `file3'.
   Finished prerequisites of target file `group1'.
  Must remake target `group1'.
  Successfully remade target file `group1'.
  Considering target file `group2'.
   File `group2' does not exist.
   Looking for an implicit rule for `group2'.
   Trying pattern rule with stem `group2'.
   Trying implicit prerequisite `/home/eaa/czped/test_make/dev_dir/group2'.
   Trying pattern rule with stem `group2'.
   Trying implicit prerequisite `/home/eaa/czped/test_make/dev_dir/group2'.
   Looking for a rule with intermediate file 
`/home/eaa/czped/test_make/dev_dir/group2'.
    Avoiding implicit rule recursion.
   No implicit rule found for `group2'.
    Considering target file `subdir1/file4'.
     Looking for an implicit rule for `subdir1/file4'.
     Trying pattern rule with stem `file4'.
     Trying implicit prerequisite `subdir1//home/eaa/czped/test_make/dev_dir/file4'.
     Trying pattern rule with stem `file4'.
     Trying implicit prerequisite `subdir1//home/eaa/czped/test_make/dev_dir/file4'.
     Looking for a rule with intermediate file 
`subdir1//home/eaa/czped/test_make/dev_dir/file4'.
      Avoiding implicit rule recursion.
     No implicit rule found for `subdir1/file4'.
     Finished prerequisites of target file `subdir1/file4'.
    No need to remake target `subdir1/file4'.
    Considering target file `subdir1/file5'.
     Looking for an implicit rule for `subdir1/file5'.
     Trying pattern rule with stem `file5'.
     Trying implicit prerequisite `subdir1//home/eaa/czped/test_make/dev_dir/file5'.
     Trying pattern rule with stem `file5'.
     Trying implicit prerequisite `subdir1//home/eaa/czped/test_make/dev_dir/file5'.
     Looking for a rule with intermediate file 
`subdir1//home/eaa/czped/test_make/dev_dir/file5'.
      Avoiding implicit rule recursion.
     No implicit rule found for `subdir1/file5'.
     Finished prerequisites of target file `subdir1/file5'.
    No need to remake target `subdir1/file5'.
    Considering target file `subdir1/file6'.
     Looking for an implicit rule for `subdir1/file6'.
     Trying pattern rule with stem `file6'.
     Trying implicit prerequisite `subdir1//home/eaa/czped/test_make/dev_dir/file6'.
     Trying pattern rule with stem `file6'.
     Trying implicit prerequisite `subdir1//home/eaa/czped/test_make/dev_dir/file6'.
     Looking for a rule with intermediate file 
`subdir1//home/eaa/czped/test_make/dev_dir/file6'.
      Avoiding implicit rule recursion.
     No implicit rule found for `subdir1/file6'.
     Finished prerequisites of target file `subdir1/file6'.
    No need to remake target `subdir1/file6'.
   Finished prerequisites of target file `group2'.
  Must remake target `group2'.
  Successfully remade target file `group2'.
 Finished prerequisites of target file `main'.
Must remake target `main'.
Successfully remade target file `main'.

Reply via email to