Updating Backup Files with NMAKE & ALL Target-Dependency

ID: Q76739


The information in this article applies to:
  • Microsoft NMAKE Utility for MS-DOS, versions 1.01, 1.11, 1.12, 1.13, 1.2, 1.3, 1.4
  • Microsoft NMAKE Utility for OS/2, versions 1.11, 1.12, 1.13, 1.21
  • Microsoft NMAKE Utility for Windows NT


SUMMARY

The text below demonstrates using NMAKE and the ALL target-dependency (an NMAKE keyword) to copy or backup files that are out-of-date with respect to the previous copy or archive.


MORE INFORMATION

The steps below create a .MAK file that copies the AUTOEXEC.BAT and CONFIG.SYS files to a directory named C:\BACKUP:

  1. Use a text editor to create COPY.MAK that contains the following text:
    
          ALL: c:\backup\autoexec.bat c:\backup\config.sys
    
          c:\backup\autoexec.bat: c:\autoexec.bat
             copy c:\autoexec.bat c:\backup\autoexec.bat
          c:\backup\config.sys: c:\config.sys
             copy c:\config.sys c:\backup\config.sys 
    NOTE: The .MAK file above copies the AUTOEXEC.BAT files from the source directory (C:\) to the target directory (C:\BACKUP). The files are copied only if the files in the source directory have an older time/date stamp than the files in the target directory.


  2. Create the C:\BACKUP directory if it does not already exist. To do so, type the following at the MS-DOS command prompt:
    mkdir c:\backup


  3. To backup any changes you made to your AUTOEXEC.BAT or CONFIG.SYS files, type the following at the MS-DOS command prompt:
    nmake /f copy.mak


NMAKE processes only one dependency per makefile. If the makefile did not include the ALL target-dependency (an NMAKE keyword), only the first file would be copied and the second copy command would be ignored completely. The ALL target creates a dependency that depends on the completion of every task in the makefile. Without this statement, two dependencies are declared, only one of which would be processed.

Page 645 of the "Microsoft Basic 7.0: Programmer's Guide" for versions 7.0 and 7.1 presents a similar example. However, this example lacks the ALL target-dependency and does not work correctly as presented.

Additional query words: kbinf 1.20 1.30 1.40 1.50 gp fault trap 13 lock

Keywords :
Version : :1.01,1.11,1.12,1.13,1.2,1.21,1.3,1.4
Platform :
Issue type :


Last Reviewed: October 7, 1999
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.