summaryrefslogtreecommitdiff
path: root/win32/makemain.pl
blob: b230f58ff029e810e82b933a3ea0bf09fa76e1a4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
open (MINIMAIN, "<../miniperlmain.c") || die "failed to open miniperlmain.c" . $!;

while (<MINIMAIN>) {
	if (/Do not delete this line--writemain depends on it/) {
		last;
		}
	else {
		print $_;
		}
	};

close(MINIMAIN);

print "char *staticlinkmodules[]={\n";
foreach (@ARGV) {
	print "\t\"".$_."\",\n";
	}
print "\tNULL,\n";
print "\t};\n";
print "\n";
foreach (@ARGV) {
	print "EXTERN_C void boot_$_ (CV* cv);\n"
	}

print <<EOP;

static void
xs_init()
{
	dXSUB_SYS;
	char *file = __FILE__;
EOP

foreach (@ARGV) {
	if (/DynaLoader/) {
	    print "\tnewXS(\"$_\:\:boot_$_\", boot_$_, file);\n";
		}
	else {
	    print "\tnewXS(\"$_\:\:bootstrap\", boot_$_, file);\n";
		};
	}

print <<EOP;
}
EOP