+
+if (defined $makefiles{'nestedvm'}) {
+ $mftyp = 'nestedvm';
+ $dirpfx = &dirpfx($makefiles{'nestedvm'}, "/");
+
+ ##-- NestedVM makefile
+ open OUT, ">$makefiles{'nestedvm'}"; select OUT;
+ print
+ "# Makefile for $project_name under NestedVM.\n".
+ "#\n# This file was created by `mkfiles.pl' from the `Recipe' file.\n".
+ "# DO NOT EDIT THIS FILE DIRECTLY; edit Recipe or mkfiles.pl instead.\n";
+ # gcc command line option is -D not /D
+ ($_ = $help) =~ s/=\/D/=-D/gs;
+ print $_;
+ print
+ "\n".
+ "# This path points at the nestedvm root directory\n".
+ "NESTEDVM = /opt/nestedvm\n".
+ "# You can define this path to point at your tools if you need to\n".
+ "TOOLPATH = \$(NESTEDVM)/upstream/install/bin\n".
+ "CC = \$(TOOLPATH)/mips-unknown-elf-gcc\n".
+ "\n".
+ &splitline("CFLAGS = -O2 -Wall -Werror -DSLOW_SYSTEM -g " .
+ (join " ", map {"-I$dirpfx$_"} @srcdirs))."\n".
+ "\n";
+ print &splitline("all:" . join "", map { " $_.jar" } &progrealnames("X"));
+ print "\n\n";
+ foreach $p (&prognames("X")) {
+ ($prog, $type) = split ",", $p;
+ $objstr = &objects($p, "X.o", undef, undef);
+ $objstr =~ s/gtk\.o/nestedvm\.o/g;
+ print &splitline($prog . ".mips: " . $objstr), "\n";
+ $libstr = &objects($p, undef, undef, "-lX");
+ print &splitline("\t\$(CC) \$(${type}LDFLAGS) -o \$@ " .
+ $objstr . " $libstr -lm", 69), "\n\n";
+ }
+ foreach $d (&deps("X.o", undef, $dirpfx, "/")) {
+ $oobjs = $d->{obj};
+ $ddeps= join " ", @{$d->{deps}};
+ $oobjs =~ s/gtk/nestedvm/g;
+ $ddeps =~ s/gtk/nestedvm/g;
+ print &splitline(sprintf("%s: %s", $oobjs, $ddeps)),
+ "\n";
+ $deflist = join "", map { " -D$_" } @{$d->{defs}};
+ print "\t\$(CC) \$(COMPAT) \$(FWHACK) \$(CFLAGS) \$(XFLAGS)$deflist" .
+ " -c \$< -o \$\@\n";
+ }
+ print "\n";
+ print $makefile_extra{'nestedvm'} || "";
+ print "\nclean:\n".
+ "\trm -rf *.o *.mips *.class *.html *.jar org applet.manifest\n";
+ select STDOUT; close OUT;
+}
+
+if (defined $makefiles{'osx'}) {
+ $mftyp = 'osx';
+ $dirpfx = &dirpfx($makefiles{'osx'}, "/");
+ @osxarchs = ('ppc', 'i386');
+
+ ##-- Mac OS X makefile
+ open OUT, ">$makefiles{'osx'}"; select OUT;
+ print
+ "# Makefile for $project_name under Mac OS X.\n".
+ "#\n# This file was created by `mkfiles.pl' from the `Recipe' file.\n".
+ "# DO NOT EDIT THIS FILE DIRECTLY; edit Recipe or mkfiles.pl instead.\n";
+ # gcc command line option is -D not /D
+ ($_ = $help) =~ s/=\/D/=-D/gs;
+ print $_;
+ print
+ "CC = \$(TOOLPATH)gcc\n".
+ "LIPO = \$(TOOLPATH)lipo\n".
+ "\n".
+ &splitline("CFLAGS = -O2 -Wall -Werror -g " .
+ (join " ", map {"-I$dirpfx$_"} @srcdirs))."\n".
+ "LDFLAGS = -framework Cocoa\n".
+ &splitline("all:" . join "", map { " $_" } &progrealnames("MX:U")) .
+ "\n";
+ print $makefile_extra{'osx'} || "";
+ print "\n".
+ ".SUFFIXES: .o .c .m\n".
+ "\n";
+ print "\n\n";
+ foreach $p (&prognames("MX")) {
+ ($prog, $type) = split ",", $p;
+ $icon = &special($p, ".icns");
+ $infoplist = &special($p, "info.plist");
+ print "${prog}.app:\n\tmkdir -p \$\@\n";
+ print "${prog}.app/Contents: ${prog}.app\n\tmkdir -p \$\@\n";
+ print "${prog}.app/Contents/MacOS: ${prog}.app/Contents\n\tmkdir -p \$\@\n";
+ $targets = "${prog}.app/Contents/MacOS/$prog";
+ if (defined $icon) {
+ print "${prog}.app/Contents/Resources: ${prog}.app/Contents\n\tmkdir -p \$\@\n";
+ print "${prog}.app/Contents/Resources/${prog}.icns: ${prog}.app/Contents/Resources $icon\n\tcp $icon \$\@\n";
+ $targets .= " ${prog}.app/Contents/Resources/${prog}.icns";
+ }
+ if (defined $infoplist) {
+ print "${prog}.app/Contents/Info.plist: ${prog}.app/Contents/Resources $infoplist\n\tcp $infoplist \$\@\n";
+ $targets .= " ${prog}.app/Contents/Info.plist";
+ }
+ $targets .= " \$(${prog}_extra)";
+ print &splitline("${prog}: $targets", 69) . "\n\n";
+ $libstr = &objects($p, undef, undef, "-lX");
+ $archbins = "";
+ foreach $arch (@osxarchs) {
+ $objstr = &objects($p, "X.${arch}.o", undef, undef);
+ print &splitline("${prog}.${arch}.bin: " . $objstr), "\n";
+ print &splitline("\t\$(CC) -arch ${arch} -mmacosx-version-min=10.3 \$(LDFLAGS) -o \$@ " .
+ $objstr . " $libstr", 69), "\n\n";
+ $archbins .= " ${prog}.${arch}.bin";
+ }
+ print &splitline("${prog}.app/Contents/MacOS/$prog: ".
+ "${prog}.app/Contents/MacOS" . $archbins), "\n";
+ print &splitline("\t\$(LIPO) -create $archbins -output \$@", 69), "\n\n";
+ }
+ foreach $p (&prognames("U")) {
+ ($prog, $type) = split ",", $p;
+ $libstr = &objects($p, undef, undef, "-lX");
+ $archbins = "";
+ foreach $arch (@osxarchs) {
+ $objstr = &objects($p, "X.${arch}.o", undef, undef);
+ print &splitline("${prog}.${arch}: " . $objstr), "\n";
+ print &splitline("\t\$(CC) -arch ${arch} -mmacosx-version-min=10.3 \$(ULDFLAGS) -o \$@ " .
+ $objstr . " $libstr", 69), "\n\n";
+ $archbins .= " ${prog}.${arch}";
+ }
+ print &splitline("${prog}:" . $archbins), "\n";
+ print &splitline("\t\$(LIPO) -create $archbins -output \$@", 69), "\n\n";
+ }
+ foreach $arch (@osxarchs) {
+ foreach $d (&deps("X.${arch}.o", undef, $dirpfx, "/")) {
+ print &splitline(sprintf("%s: %s", $d->{obj}, join " ", @{$d->{deps}})),
+ "\n";
+ $deflist = join "", map { " -D$_" } @{$d->{defs}};
+ if ($d->{deps}->[0] =~ /\.m$/) {
+ print "\t\$(CC) -arch $arch -mmacosx-version-min=10.3 -x objective-c \$(COMPAT) \$(FWHACK) \$(CFLAGS)".
+ " \$(XFLAGS)$deflist -c \$< -o \$\@\n";
+ } else {
+ print "\t\$(CC) -arch $arch -mmacosx-version-min=10.3 \$(COMPAT) \$(FWHACK) \$(CFLAGS) \$(XFLAGS)$deflist" .
+ " -c \$< -o \$\@\n";
+ }
+ }
+ }
+ print "\nclean:\n".
+ "\trm -f *.o *.dmg". (join "", map { my $a=$_; (" $a", map { " ${a}.$_" } @osxarchs) } &progrealnames("U")) . "\n".
+ "\trm -rf *.app\n";
+ select STDOUT; close OUT;
+}