1:"""
   2: Copyright (c) 2004, Brian Hawkins
   3: Permission is granted to use this code without restriction as long
   4: as this copyright notice appears in all source files.
   5:"""
   6:
   7:bldoutdir = "build"
   8:build = make.getProperty("build", "debug")
   9:progBin = "cpmaketest"
  10:
  11:# objExt and exeExt are set in the platform specific make file
  12:
  13:if make.getProperty("os.name")[:7] == "Windows":
  14:    execfile("windows.py")
  15:else:
  16:    execfile("linux.py")
  17:
  18:progBin = progBin + exeExt
  19:
  20:srcFiles = [
  21:    "main.cpp",
  22:    "employee.cpp",
  23:    "company.cpp"
  24:    ]
  25:    
  26:objs = make.substitute("(.*)\\.cpp", bldoutdir+"/$1"+objExt, srcFiles)
  27:
  28:includeDirs = [ "include" ]
  29:    
  30:#-------------------------------------------------------------------
  31:#==-- SET SEARCH PATHS --==
  32:make.addSearchPath(".*\\.hpp", "include")
  33:make.addSearchPath(".*\\.cpp", "src")
  34:
  35:#-------------------------------------------------------------------
  36:#==-- RULE FOR CREATING DIRECTORIES --==
  37:make.createDirectoryRule(bldoutdir, None, 0)    
  38:    
  39:#-------------------------------------------------------------------
  40:#==-- COMPILE OBJECT RULE --==
  41:make.createPatternDependency(bldoutdir+"/(.*)\\"+objExt, bldoutdir)
  42:make.createPatternRule(bldoutdir+"/(.*)\\"+objExt, "$1.cpp", "compile", 1)
  43:def compile(target, prereqs):
  44:    cmd = getCompileCommand(target, prereqs[0], includeDirs)
  45:    make.exec(cmd)
  46:    
  47:#-------------------------------------------------------------------
  48:#==-- LINK EXECUTABLE --==
  49:make.createExplicitRule(bldoutdir+"/"+progBin, objs, "link", 1)
  50:def link(target, prereqs):
  51:    print("Linking "+target+" for "+platform)
  52:    cmd = getLinkCommand(target, prereqs)
  53:    make.exec(cmd)
  54:    
  55:#-------------------------------------------------------------------
  56:#==-- TEST --==
  57:make.createPhonyRule("test", bldoutdir+"/"+progBin, "test")
  58:def test(target, prereqs):
  59:    print("Running Test")
  60:    make.exec(bldoutdir, make.fullPath(bldoutdir)+"/"+progBin, 1)
  61:    
  62:    
  63:make.setDefaultTarget(bldoutdir+"/"+progBin)
  64: