Skip to content
Snippets Groups Projects
Commit 686ed6af authored by Fredrik Hübinette (Hubbe)'s avatar Fredrik Hübinette (Hubbe)
Browse files

bugfixes and some minor new features

Rev: NT/init_nt:1.13
Rev: NT/tools/lib.pike:1.4
Rev: NT/tools/rntcc:1.17
parent 2ede1d07
Branches
Tags rxnpatch/2020-08-18T134910
No related merge requests found
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
*.gz binary *.gz binary
*.ppm binary *.ppm binary
*.rs binary *.rs binary
init_nt -text -crlf
lib -text -crlf lib -text -crlf
testfont binary testfont binary
......
...@@ -32,6 +32,8 @@ else ...@@ -32,6 +32,8 @@ else
MNTREPLACE="s@$NTMOUNT@@g MNTREPLACE="s@$NTMOUNT@@g
" "
fi fi
IFS='
'
export NTHOST NTDRIVE NTCC CC PATH NTTOOLS MNTREPLACE MNTREPLACE NTPORT USE_SPRSH export NTHOST NTDRIVE NTCC CC PATH NTTOOLS MNTREPLACE MNTREPLACE NTPORT USE_SPRSH
......
...@@ -60,6 +60,7 @@ int silent_do_cmd(string *cmd, mixed|void filter, int|void silent) ...@@ -60,6 +60,7 @@ int silent_do_cmd(string *cmd, mixed|void filter, int|void silent)
sscanf(f->read(4),"%4c",int len); sscanf(f->read(4),"%4c",int len);
if(!len) break; if(!len) break;
s=f->read(len); s=f->read(len);
s=replace(s,"\r\n","\n");
if(!silent) write(s); if(!silent) write(s);
ret+=s; ret+=s;
} }
...@@ -123,7 +124,7 @@ string find_next_in_path(string argv0,string cmd) ...@@ -123,7 +124,7 @@ string find_next_in_path(string argv0,string cmd)
{ {
if(argv0) if(argv0)
{ {
if(argv0==s) if(argv0==fname)
argv0=0; argv0=0;
}else{ }else{
return fname; return fname;
......
...@@ -11,6 +11,15 @@ inherit "lib.pike"; ...@@ -11,6 +11,15 @@ inherit "lib.pike";
int verbose=1; int verbose=1;
// Temporary variable
int linking_failed;
string get_ext(string file)
{
sscanf(file=lower_case(reverse(file)),"%s.",file);
return reverse(file);
}
int compile(string *sources, int compile(string *sources,
string dest, string dest,
string errorfile, string errorfile,
...@@ -28,11 +37,19 @@ int compile(string *sources, ...@@ -28,11 +37,19 @@ int compile(string *sources,
dest=fixpath(dest); dest=fixpath(dest);
sources=Array.map(sources,fixpath); sources=Array.map(sources,fixpath);
if(lower_case(sources[0][strlen(sources[0])-3..])==".s") switch(get_ext(sources[0]))
{ {
cmd=({ "wasm", "-fe"+errorfile, "-fo"+dest,})+ sources; case "c":
}else{
cmd=({ "wcc386" }) + cflags + ({"-fr"+errorfile, "-fo"+dest}) + sources; cmd=({ "wcc386" }) + cflags + ({"-fr"+errorfile, "-fo"+dest}) + sources;
break;
case "cpp":
case "cc":
cmd=({ "wpp386" }) + cflags + ({"-fr"+errorfile, "-fo"+dest}) + sources;
break;
case "s":
cmd=({ "wasm", "-fe"+errorfile, "-fo"+dest,})+ sources;
} }
if(verbose) if(verbose)
...@@ -65,7 +82,7 @@ int main(int argc, string *argv) ...@@ -65,7 +82,7 @@ int main(int argc, string *argv)
{ {
string target; string target;
string operation="link"; string operation="link";
string *cflags=({}); string *cflags=({"-d__WIN32__","-d_WIN32"});
string *ldopts=({"OPTION","STACK=8m"}); string *ldopts=({"OPTION","STACK=8m"});
string *libraries=({}); string *libraries=({});
string *objects=({}); string *objects=({});
...@@ -196,22 +213,20 @@ int main(int argc, string *argv) ...@@ -196,22 +213,20 @@ int main(int argc, string *argv)
argv=Getopt.get_args(argv); argv=Getopt.get_args(argv);
foreach(argv[1..], string tmp) foreach(argv[1..], string tmp)
{ {
string ext;
if(tmp[0]=='-') if(tmp[0]=='-')
{ {
werror("Unrecognized option "+tmp+".\n"); werror("Unrecognized option "+tmp+".\n");
exit(1); exit(1);
} }
sscanf(reverse(tmp),"%s.",ext);
// Recognize which files need to be compiled // Recognize which files need to be compiled
switch(ext) switch(get_ext(tmp))
{ {
case "bil":
case "o": case "o":
case "jbo":
case "a": case "a":
case "lld": case "obj":
case "dll":
case "lib":
objects+=({tmp}); objects+=({tmp});
break; break;
...@@ -240,8 +255,19 @@ int main(int argc, string *argv) ...@@ -240,8 +255,19 @@ int main(int argc, string *argv)
case "preprocess": case "preprocess":
{ {
switch(get_ext(sources[0]))
{
default:
case "c":
int ret=silent_do_cmd( ({"wcc386","-p","-fr"+errorfile}) + cflags + Array.map(sources, fixpath)); int ret=silent_do_cmd( ({"wcc386","-p","-fr"+errorfile}) + cflags + Array.map(sources, fixpath));
break; break;
case "cc":
case "cpp":
int ret=silent_do_cmd( ({"wpp386","-p","-fr"+errorfile}) + cflags + Array.map(sources, fixpath));
break;
}
break;
} }
case "link": case "link":
...@@ -256,10 +282,12 @@ int main(int argc, string *argv) ...@@ -256,10 +282,12 @@ int main(int argc, string *argv)
check_errorfile(errorfile); check_errorfile(errorfile);
} }
// objects+=({"BINMODE.OBJ"});
string ldfile="TMP"+getpid()+".lk"; string ldfile="TMP"+getpid()+".lk";
if(!output) output="a.out"; if(!output) output="a.out";
rm(ldfile); rm(ldfile);
target=output; target=output;
if(!share) target+=".exe"; if(!share) target+=".exe";
...@@ -275,15 +303,18 @@ int main(int argc, string *argv) ...@@ -275,15 +303,18 @@ int main(int argc, string *argv)
Process.system("cat "+ldfile); Process.system("cat "+ldfile);
write("\n"); write("\n");
#endif #endif
linking_failed=0;
silent_do_cmd( ({"wlink","@"+ldfile }), lambda(string data) silent_do_cmd( ({"wlink","@"+ldfile }), lambda(string data)
{ {
if(search(data," W1008:")!=-1) if(search(data," W1008:")!=-1)
exit(1); linking_failed++;
}); });
if(getenv("CLEANUP")!="no") if(getenv("CLEANUP")!="no")
rm(ldfile); rm(ldfile);
if(linking_failed) exit(1);
} }
check_errorfile(errorfile); check_errorfile(errorfile);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment