pike.git / NT / tools / rntcc

version» Context lines:

pike.git/NT/tools/rntcc:49:   {    string target;    string operation="link";    string *cflags=({});    string *ldopts=({"OPTION","STACK=8m"});    string *libraries=({});    string *objects=({});    string *sources=({});    int debug,optimize;    string output; +  int share=0;       mixed *opts=Getopt.find_all_options(argv, ({    ({"oper_pre",Getopt.NO_ARG, ({"-E"}) }),    ({"oper_comp",Getopt.NO_ARG, ({"-c"}) }),    ({"debug",Getopt.MAY_HAVE_ARG, ({"-g"}) }),    ({"optimize",Getopt.MAY_HAVE_ARG, ({"-O"}) }),    ({"include",Getopt.HAS_ARG, ({"-I"}) }),    ({"link",Getopt.HAS_ARG, ({"-l"}) }), -  ({"ignore",Getopt.MAY_HAVE_ARG, ({"-t","-s"}) }), +  ({"share",Getopt.MAY_HAVE_ARG, ({"-s"}) }), +  ({"ignore",Getopt.MAY_HAVE_ARG, ({"-t"}) }),    ({"ignore",Getopt.HAS_ARG, ({"-R","-L"}) }),    ({"warn",Getopt.MAY_HAVE_ARG, ({"-W"}) }),    ({"define",Getopt.HAS_ARG, ({"-D"}) }),    ({"undefine",Getopt.HAS_ARG, ({"-U"})}),    ({"output",Getopt.HAS_ARG, ({"-o"}) })    }));    foreach(opts, mixed *option)    {    switch(option[0])    { -  +  case "share": +  share=1; +  ldopts+=({"SYS","nt_dll"}); +  cflags+=({"-bd"}); +  break; +     case "oper_pre": operation="preprocess"; break;    case "oper_comp": operation="compile"; break;    case "debug":    cflags+=({"-d2"});    ldopts+=({"DEBUG","WATCOM","ALL"});    debug=1;    break;       case "optimize":    if(!option[1]) option[1]=1;
pike.git/NT/tools/rntcc:144:    default:    sources+=({tmp});    }    }       if(output) rm(output);       string errorfile="TMP"+getpid()+".err";    rm(errorfile);    -  cflags+=({"-bm","-zq","-hw"}); +  cflags+=({"-bm","-zq","-hw","-sg"});       switch(operation)    {    default:    werror("Unknown operation "+operation+".\n");    exit(1);       case "compile":    compile(sources,output,errorfile,cflags);    break;
pike.git/NT/tools/rntcc:177:    obj=reverse(obj)+".obj";       compile( ({source}), obj, errorfile, cflags);    objects+=({obj});    check_errorfile(errorfile);    }       string ldfile="TMP"+getpid()+".lk";    if(!output) output="a.out";    rm(ldfile); +  +  target=output; +  if(!share) target+=".exe"; +     Stdio.write_file(ldfile, -  "NAME "+output+".exe " -  +ldopts*" "+" "+ +  "NAME "+target+" " +ldopts*" "+" "+    "FIL "+Array.map(objects,fixpath)*","+" "+    libraries*" "+" ");       do_cmd( ({"wlink","@"+ldfile }), lambda(string data)    {    if(search(data," W1008:")!=-1)    exit(1);    });    -  target=output+".exe"; -  +     if(getenv("CLEANUP")!="no")    rm(ldfile);    }       check_errorfile(errorfile);       if(target)    {    if(!file_stat(target))    {    werror("RNTCC: output file not generated.\n");    exit(1);    }    }    -  if(operation == "link") +  if(operation == "link" && !share)    {    rm(output);    Stdio.write_file(output,    "#!/usr/local/bin/pike\n"    "inherit \""+find_lib_location()+"\";\n"    "int main(int argc, string *argv) {\n"    "argv[0]+=\".exe\";\n"    "argv[0]=getenv(\"NTDRIVE\")+fixpath(combine_path(getcwd(),argv[0]));\n"    " exit(silent_do_cmd(argv));\n"    "}\n");    chmod(output,0755);    }    exit(0);   }