proc bare_machine(machine) is
  Nwmodule(machine&"Config")
  Nwmodule(machine&"Frame")
  build_generic_module(machine&"GCommonFrame", "GCommonFrame", [machine&"Config"], 
                       VISIBLE)
end

readonly pattern_gen = ldb_binary("ldb-pattern")

proc nw_pattern_unit(sources, target) is
  local tmp_pat = ".pattern." & target
  local tmp_dest = "." & target
  notangle(sources, M3LINE, "*", tmp_pat)
  if defined("_all")
    if stale(tmp_dest, tmp_pat) 
    or stale(tmp_dest, pattern_gen)
      exec(pattern_gen, "-map -m3 -case ", tmp_dest, " < ", tmp_pat)
    end
    cp_if (tmp_dest, target)
  end
  deriveds(tmp_dest, no_extension)
  deriveds(target, no_extension)
end


proc decoded_machine(machine) is
  bare_machine(machine)
  Noweb_interface(machine&"Config", "decoding interface", machine&"Decoding")
  local inst_file   = path_of(machine&"Instructions.nw")
  local follow_file = path_of(machine&"Follow.nw")
  local dis_file    = path_of(machine&"Disassemble.nw")
  nw_pattern_unit([follow_file, inst_file], machine & "Follow.m3")
  derived_implementation(machine & "Follow")
  nw_pattern_unit([dis_file, inst_file], machine & "Disassemble.m3")
  derived_implementation(machine & "Disassemble")
end  

  bare_machine("MC68")
  bare_machine("Vax")

  decoded_machine("Sparc")
  decoded_machine("Mips")
  Nwmodule("MipsRPT")  


% old mkfile stuff

%%%%% SparcGCommonFrame.mo: SparcGCommonFrame.mc
%%%%%	m3 -c -keep -w1 $prereq	# no -g, no jal $0
