
PROC qcm$build_task_lib, build_task_lib, buitll (
  preserved_file_path, pfp: file = $required
  cybil_run_time_library, crtl: file = $required
  delete_modules, dm: file = $local.$null
  status)


IF $variable(wev$build_level, declared) <> 'LOCAL' THEN
  IF $variable(wev$build_level, declared) <> 'UNKNOWN' THEN
    create_variable wev$build_level kind=string scope=xref
  ELSE
    create_variable wev$build_level kind=string scope=xdcl value='NONE'
  IFEND
IFEND
IF $variable(wev$feature_catalog, declared) <> 'LOCAL' THEN
  IF $variable(wev$feature_catalog, declared) <> 'UNKNOWN' THEN
    create_variable wev$feature_catalog k=string scope=xref
  ELSE
    create_variable wev$feature_catalog k=string s=xdcl v='NONE'
  IFEND
IFEND
IF $variable(wev$feature_build_level, declared) <> 'LOCAL' THEN
  IF $variable(wev$feature_build_level, declared) <> 'UNKNOWN' THEN
    create_variable wev$feature_build_level k=string scope=xref
  ELSE
    create_variable wev$feature_build_level k=string s=xdcl v='OBJECT'
  IFEND
IFEND
IF $variable(wev$working_catalog, declared) <> 'LOCAL' THEN
  IF $variable(wev$working_catalog, declared) <> 'UNKNOWN' THEN
    create_variable wev$working_catalog k=string scope=xref
  ELSE
    create_variable wev$working_catalog k=string s=xdcl v='NONE'
  IFEND
IFEND
IF $variable(wev$working_build_level, declared) <> 'LOCAL' THEN
  IF $variable(wev$working_build_level, declared) <> 'UNKNOWN' THEN
    create_variable wev$working_build_level k=string scope=xref
  ELSE
    create_variable wev$working_build_level k=string s=xdcl v='OBJECT'
  IFEND
IFEND


  create_variable wev$product_name k=string s=xdcl value='OS'

  create_variable (ignore_status, local_status) kind=status
  create_variable tasks_library kind=string value='$LOCAL.'//$unique
  create_variable no_libraries_merged k=boolean

  create_variable result_library k=string value=$string($value(preserved_file_path))//'.tasks'

build_task_lib: ..
  BLOCK

    combine_objects object_library=osf$tasks rol=$fname(tasks_library) nlm=no_libraries_merged ..
          oml=cyf$run_time_library dm=$value(delete_modules) status=local_status

    EXIT build_task_lib WHEN NOT local_status.normal

    EXIT build_task_lib WHEN no_libraries_merged

    delete_file $fname(result_library) status=ignore_status
    CREATE_OBJECT_LIBRARY status=local_status
      add_module $fname(tasks_library)
      satisfy_external_references l=$value(cybil_run_time_library)
      omit_library lto=cyf$run_time_library
      generate_library $fname(result_library)
    QUIT

  BLOCKEND build_task_lib

  detach_file $fname(tasks_library) status=ignore_status
  IF $file($fname(result_library), permanent) THEN
    detach_file $fname(result_library) status=ignore_status
  IFEND

  EXIT_PROC WITH local_status

PROCEND qcm$build_task_lib

