anchor.diff:              return e
       raise SystemExit, "Unable to locate Makefile.modinc"
   
  -def build(tempdir, filename, mode, origfilename):
  +def build_usr(tempdir, filename, mode, origfilename):
  +    binname = os.path.basename(os.path.splitext(filename)[0])
  +
  +    makefile = os.path.join(tempdir, "Makefile")
  +    f = open(makefile, "w")
  +    print >>f, "%s: %s" % (binname, filename)
  +    print >>f, "\t$(CC) $(EXTRA_CFLAGS) -URTAPI -DULAPI -O2 %s -o $@ $< -Wl,-rpath,$(LIBDIR) -L$(LIBDIR) -lemchal %s" % (
  +        options.get("extra_compile_args", ""),
  +        options.get("extra_link_args", ""))
  +    print >>f, "include %s" % find_modinc()
  +    f.close()
  +    result = os.system("cd %s; make -S %s" % (tempdir, binname))
  +    if result != 0:
  +        raise SystemExit, result
  +    output = os.path.join(tempdir, binname)
  +    if mode == INSTALL:
  +        shutil.copy(output, os.path.join(BASE, "bin", binname))
  +    elif mode == COMPILE:
  +        shutil.copy(output, os.path.join(os.path.dirname(origfilename),binname))
  +
  +def build_rt(tempdir, filename, mode, origfilename):
       objname = os.path.basename(os.path.splitext(filename)[0] + ".o")
       makefile = os.path.join(tempdir, "Makefile")
       f = open(makefile, "w")
  
positive.code:             print >>f, "    int i;"
          if options.get("count_function"):
              print >>f, "    int count = get_count();"
          print >>f, "    comp_id = hal_init(\"%s\");" % comp_name
          print >>f, "    if(comp_id < 0) return comp_id;"
  
  
negative.code:         print >>f, "    hal_exit(comp_id);"
          print >>f, "}"
  
      if options.get("userspace"):
          print >>f, "static void user_mainloop(void);"
          if options.get("userinit", 0):
              print >>f, "static void user_init(void);"
          print >>f, "int argc=0; char **argv=0;"
          print >>f, "int main(int argc_, char **argv_) {"    
          print >>f, "    argc = argc_; argv = argv;"
          print >>f 
          if options.get("userinit", 0):
              print >>f, "    userinit()";
          print >>f 
          print >>f, "    if(rtapi_app_main() < 0) return 1;"
          print >>f, "    user_mainloop();"
          print >>f, "    rtapi_app_exit();"
          print >>f, "    return 0;"
          print >>f, "}"
  
      print >>f
      if not options.get("no_convenience_defines"):
          print >>f, "#define FUNCTION(name) static void name(struct state *inst, long period)"
  