git-svn-id: http://svn2.nishi.boats/svn/milsko/trunk@271 b9cfdab3-6d41-4d17-bbe4-086880011989
This commit is contained in:
NishiOwO
2025-10-11 13:52:40 +00:00
parent a886e05449
commit 13dc777953
4 changed files with 232 additions and 41 deletions

View File

@@ -25,6 +25,7 @@ scan("src");
scan("src/widget");
scan("src/external");
scan("src/cursor");
scan("src/icon");
print(OUT " src\\backend\\gdi.obj\n");
print(OUT "OOOBJS =");
scan("oosrc");

70
tools/genwat.pl Executable file
View File

@@ -0,0 +1,70 @@
#!/usr/bin/env perl
# $Id$
our @sources = ();
sub scan {
opendir(DIR, $_[0]);
my @files = readdir(DIR);
foreach my $f (@files) {
if (!($f =~ /^vulkan\.cc?$/) && ($f =~ /\.cc?$/)) {
push(@sources, $_[0] . "/" . $f);
$f =~ s/\.cc?$/.obj/g;
my $p = $_[0] . "/" . $f;
print(OUT " $p");
}
}
closedir(DIR);
}
open(OUT, ">", "WatMakefile");
print(OUT "# \$Id\$\n");
print(OUT "WATCOM = /usr/watcom\n");
print(OUT "CC = wcc386\n");
print(OUT "CXX = wpp386\n");
print(OUT "CFLAGS = -q -d_MILSKO -dUSE_GDI -dUSE_STB_IMAGE -dSTBI_NO_SIMD -i=\$(WATCOM)/h/nt\n");
print(OUT "CXXFLAGS =\n");
print(OUT "\n");
print(OUT "OBJS =");
scan("src");
scan("src/widget");
scan("src/external");
scan("src/cursor");
scan("src/icon");
push(@sources, "src/backend/gdi.c");
print(OUT " src/backend/gdi.obj\n");
print(OUT "\n");
print(OUT ".EXTENSIONS:\n");
print(OUT ".EXTENSIONS: .obj .c\n");
print(OUT "\n");
print(OUT "all: src/Mw.dll\n");
print(OUT "\n");
print(OUT "clean: .SYMBOLIC\n");
foreach my $l (@sources){
my $obj = $l;
$obj =~ s/\.cc?/.obj/g;
print(OUT " %erase $obj\n");
}
print(OUT " %erase src/Mw.dll\n");
print(OUT " %erase src/Mw.lib\n");
print(OUT "\n");
print(OUT "\n");
print(OUT "src/Mw.dll: \$(OBJS)\n");
print(OUT " %write Mw.lnk system nt_dll initinstance terminstance name src/Mw.dll\n");
print(OUT " %write Mw.lnk option implib=src/Mw.lib\n");
print(OUT " %write Mw.lnk library clib3r.lib\n");
foreach my $l (@sources){
my $obj = $l;
$obj =~ s/\.cc?/.obj/g;
print(OUT " %write Mw.lnk file $obj\n");
}
print(OUT " wlink \@Mw.lnk\n");
print(OUT " %erase Mw.lnk");
print(OUT "\n");
foreach my $l (@sources){
my $obj = $l;
$obj =~ s/\.cc?/.obj/g;
print(OUT "$obj: $l\n");
print(OUT " \$(CC) \$(CFLAGS) -bt=nt -fo=\$@ -i=include $l\n");
}
close(OUT);

View File

@@ -1,41 +0,0 @@
#!/usr/bin/env perl
# $Id$
my $target = "nt";
my @cmd = ();
push(@cmd, "-I$ENV{WATCOM}/h");
push(@cmd, "-I$ENV{WATCOM}/h/nt");
push(@cmd, "-DSTBI_NO_SIMD");
foreach my $f (@ARGV) {
if ($f eq "-static-libgcc") {
next;
}
elsif ($f =~ /^-Wl,--out-implib,(.+)$/) {
push(@cmd, "-Wl,option implib=$1");
next;
}
elsif ($f =~ /^-W.+$/) {
next;
}
elsif ($f =~ /^-L(.+)$/) {
push(@cmd, "-Wl,libpath $1");
next;
}
elsif ($f eq "-lMw") {
push(@cmd, "-lMw");
next;
}
elsif ($f =~ /^-l(.+)$/) {
push(@cmd, "$1.lib");
next;
}
elsif ($f =~ /^(?:oo)?src\//) {
$target = "nt_dll";
}
push(@cmd, $f);
}
unshift(@cmd, "-b$target");
print("Running: owcc " . join(" ", @cmd) . "\n");
exec("owcc", @cmd);