/*****************************************************************************
*                              MAKEFILE
*
*  PURPOSE: Build the following modules:
*
*           "hello.obj"
*           "world.obj"
*           "message.lib"
*           "greeting.obj"
*           "greeting.exe"
*
*  NOTE: Since CMAKE automatically determines the dependencies for CL, LIB,
*        and LINK, you would not ordinarily use an if statement to
*        explicitly specify dependencies for these commands.  if statements
*        have been used in this make file for demonstration purposes, only.
*
*        None of the comments in this make file are required.  They have
*        been provided to help you understand how CMAKE handles each
*        command.
*
*****************************************************************************/

/*****************************************************************************
*                              HELLO.OBJ
*
*  The following CL and LIB commands will be executed only when one of the
*  following conditions is true:
*
*  1. "hello.obj" does not exist.
*  2. "message.lib" does not exist.
*  3. "hello.c" is newer than "hello.obj".
*  5. "hello.c" is newer than "message.lib".
*  4. "hello.h" is newer than "hello.obj".
*  6. "hello.h" is newer than "message.lib".
*
*****************************************************************************/

if ( hello.obj
     message.lib < hello.c
                   hello.h )

   {
   cl /c /W4 hello.c

   lib message.lib -+hello.obj;
   }

/*****************************************************************************
*                               WORLD.OBJ
*
*  The following CL and LIB commands will be executed only when one of the
*  following conditions is true:
*
*  1. "world.obj" does not exist.
*  2. "message.lib" does not exist.
*  3. "world.c" is newer than "world.obj".
*  5. "world.c" is newer than "message.lib".
*  4. "world.h" is newer than "world.obj".
*  6. "world.h" is newer than "message.lib".
*
*****************************************************************************/

if ( world.obj message.lib < world.c world.h )

   {
   cl /c /W4 world.c

   lib message.lib -+world.obj;
   }

/*****************************************************************************
*                           GREETING.OBJ
*
*  The following CL command will be executed only when one of the
*  following conditions is true:
*
*  1. "greeting.obj" does not exist.
*  2. "greeting.c" is newer than "greeting.obj".
*  3. "hello.h" is newer than "greeting.obj".
*  4. "world.h" is newer than "greeting.obj".
*  5. "greeting.h" is newer than "greeting.obj".
*
*****************************************************************************/

if (   greeting.obj
     < greeting.c
       hello.h
       world.h
       greeting.h )

   cl /c /W4 greeting.c

/*****************************************************************************
*                           GREETING.EXE
*
*  The following LINK command will be executed only when one of the
*  following conditions is true:
*
*  1. "greeting.exe" does not exist.
*  2. "greeting.obj" is newer than "greeting.exe".
*  3. "message.lib" is newer than "greeting.exe".
*
*****************************************************************************/

if ( greeting.exe < greeting.obj message.lib )

   link @greeting.lnk
