can compile examples now
All checks were successful
pyrite-dev/milsko/pipeline/head This commit looks good
All checks were successful
pyrite-dev/milsko/pipeline/head This commit looks good
This commit is contained in:
parent
cc7f4f7ea8
commit
4fdc578448
5 changed files with 662 additions and 115 deletions
|
|
@ -1,5 +1,6 @@
|
|||
#!/usr/bin/env perl
|
||||
my @cfiles = ();
|
||||
my @examples = ();
|
||||
|
||||
sub scan {
|
||||
opendir(DIR, $_[0]);
|
||||
|
|
@ -15,6 +16,17 @@ sub scan {
|
|||
closedir(DIR);
|
||||
}
|
||||
|
||||
sub scan_examples {
|
||||
opendir(DIR, $_[0]);
|
||||
my @files = readdir(DIR);
|
||||
foreach my $f (@files) {
|
||||
if ($f =~ /\.c$/) {
|
||||
push(@examples, $_[0] . "/" . $f);
|
||||
}
|
||||
}
|
||||
closedir(DIR);
|
||||
}
|
||||
|
||||
sub cobjs {
|
||||
my $r = "";
|
||||
foreach my $f (@cfiles) {
|
||||
|
|
@ -39,9 +51,12 @@ sub generate {
|
|||
my $del = "del /f /q";
|
||||
my $out = "";
|
||||
my $dllout = "";
|
||||
my $exeout = "";
|
||||
my $def = "";
|
||||
my $inc = "";
|
||||
my $cdll = "";
|
||||
my $dll = "";
|
||||
my $exe = "";
|
||||
my $prefobj = "";
|
||||
my $needlibs = "";
|
||||
my $lib = "";
|
||||
|
|
@ -53,6 +68,7 @@ sub generate {
|
|||
$link = "bcc32";
|
||||
$out = "-o";
|
||||
$dllout = "-e";
|
||||
$exeout = "-e";
|
||||
$def = "-D";
|
||||
$inc = "-I";
|
||||
$dll = "-tWD";
|
||||
|
|
@ -65,18 +81,22 @@ sub generate {
|
|||
$link = "link /nologo";
|
||||
$out = "/Fo";
|
||||
$dllout = "/OUT:";
|
||||
$exeout = "/OUT:";
|
||||
$def = "/D";
|
||||
$inc = "/I";
|
||||
$dll = "/DLL";
|
||||
}
|
||||
elsif ($type eq "Watcom") {
|
||||
$cc = "wcc386 -bt=nt -q -bd";
|
||||
$cc = "wcc386 -bt=nt -q";
|
||||
$link = "wlink option quiet";
|
||||
$out = "-fo=";
|
||||
$dllout = "name ";
|
||||
$exeout = "name ";
|
||||
$def = "-d";
|
||||
$inc = "-i=";
|
||||
$cdll = "-bd";
|
||||
$dll = "system nt_dll";
|
||||
$exe = "system nt";
|
||||
$lib = "library ";
|
||||
|
||||
$suffix = 0; # watcom suffix rule works kinda strange
|
||||
|
|
@ -93,15 +113,23 @@ sub generate {
|
|||
print(OUT "LD = $link\n");
|
||||
print(OUT "\n");
|
||||
print(OUT
|
||||
"CFLAGS = ${inc}include ${inc}external${dir}libz${dir}include ${def}_MILSKO ${def}USE_GDI ${def}USE_STB_TRUETYPE ${def}USE_STB_IMAGE ${def}STBI_NO_SIMD\n"
|
||||
"MW_CFLAGS = ${cdll} ${inc}include ${inc}external${dir}libz${dir}include ${def}_MILSKO ${def}USE_GDI ${def}USE_STB_TRUETYPE ${def}USE_STB_IMAGE ${def}STBI_NO_SIMD\n"
|
||||
);
|
||||
print(OUT "LDFLAGS = $dll");
|
||||
print(OUT "MW_LDFLAGS = $dll\n");
|
||||
print(OUT "EXE_CFLAGS = ${inc}include\n");
|
||||
print(OUT "EXE_LDFLAGS = $exe");
|
||||
print(OUT "\n");
|
||||
|
||||
if ($suffix) {
|
||||
print(OUT ".SUFFIXES: .obj .c\n");
|
||||
}
|
||||
print(OUT "all: src${dir}Mw.dll\n");
|
||||
print(OUT "all: src${dir}Mw.dll");
|
||||
foreach my $f (@examples) {
|
||||
$b = $f;
|
||||
$b =~ s/\.c$/.exe/;
|
||||
$b =~ s/\//$dir/g;
|
||||
print(OUT " $b");
|
||||
}
|
||||
print(OUT "\n");
|
||||
print(OUT "clean: $symbolic\n");
|
||||
foreach my $f (@cfiles) {
|
||||
my $b = $f;
|
||||
|
|
@ -109,17 +137,38 @@ sub generate {
|
|||
$b =~ s/\//$dir/g;
|
||||
print(OUT " $del $b\n");
|
||||
}
|
||||
foreach my $f (@cxxfiles) {
|
||||
print(OUT " $del src${dir}Mw.dll\n");
|
||||
print(OUT " $del src${dir}Mw.lib\n");
|
||||
foreach my $f (@examples) {
|
||||
my $b = $f;
|
||||
$b =~ s/\.c$/.obj/;
|
||||
$b =~ s/\//$dir/g;
|
||||
print(OUT " $del $b\n");
|
||||
}
|
||||
print(OUT " $del src${dir}Mw.dll\n");
|
||||
print(OUT " $del src${dir}Mw.lib\n");
|
||||
foreach my $f (@examples) {
|
||||
$b = $f;
|
||||
$b =~ s/\.c$/.exe/;
|
||||
$b =~ s/\//$dir/g;
|
||||
print(OUT " $del $b\n");
|
||||
}
|
||||
print(OUT "\n");
|
||||
foreach my $f (@examples) {
|
||||
my $b = $f;
|
||||
$b =~ s/\.c$/.exe/;
|
||||
$b =~ s/\//$dir/g;
|
||||
my $o = $f;
|
||||
$o =~ s/\.c$/.obj/;
|
||||
$o =~ s/\//$dir/g;
|
||||
print(OUT "$b: $o src${dir}Mw.dll\n");
|
||||
print(OUT " \$(LD) \$(EXE_LDFLAGS) $exeout\$@ $prefobj$o $needlibs ${lib}src${dir}Mw.lib\n");
|
||||
print(OUT "\n");
|
||||
print(OUT "$o: $f\n");
|
||||
print(OUT " \$(CC) \$(EXE_CFLAGS) ${out}\$@ $f\n");
|
||||
print(OUT "\n");
|
||||
}
|
||||
print(OUT "\n");
|
||||
print(OUT "src${dir}Mw.dll: " . cobjs($dir) . "\n");
|
||||
print( OUT " \$(LD) \$(LDFLAGS) $c_dllout $dllout\$@ "
|
||||
print( OUT " \$(LD) \$(MW_LDFLAGS) $c_dllout $dllout\$@ "
|
||||
. cobjs($dir, $prefobj)
|
||||
. " $needlibs ${lib}opengl32.lib ${lib}gdi32.lib ${lib}user32.lib ${lib}advapi32.lib\n"
|
||||
);
|
||||
|
|
@ -128,7 +177,7 @@ sub generate {
|
|||
|
||||
if ($suffix) {
|
||||
print(OUT ".c.obj:\n");
|
||||
print(OUT " \$(CC) \$(CFLAGS) ${out}\$@ \$<\n");
|
||||
print(OUT " \$(CC) \$(MW_CFLAGS) ${out}\$@ \$<\n");
|
||||
}
|
||||
else {
|
||||
print(OUT "\n");
|
||||
|
|
@ -136,7 +185,7 @@ sub generate {
|
|||
my $o = $f;
|
||||
$o =~ s/\.c$/.obj/;
|
||||
print(OUT "$o: $f\n");
|
||||
print(OUT " \$(CC) \$(CFLAGS) ${out}\$@ \$<\n");
|
||||
print(OUT " \$(CC) \$(MW_CFLAGS) ${out}\$@ $f\n");
|
||||
}
|
||||
}
|
||||
close(OUT);
|
||||
|
|
@ -156,6 +205,10 @@ push(@cfiles, "src/backend/gdi.c");
|
|||
|
||||
@cfiles = sort(@cfiles);
|
||||
|
||||
scan_examples("examples/basic");
|
||||
|
||||
@examples = sort(@examples);
|
||||
|
||||
generate("BorMakefile", "Borland");
|
||||
generate("NTMakefile", "MSVC");
|
||||
generate("WatMakefile", "Watcom");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue