1995-12-01 20:58:53 +03:00
|
|
|
#!/usr/gnu/bin/perl
|
|
|
|
#
|
1997-03-15 04:35:37 +03:00
|
|
|
# $NetBSD: gcc2netbsd,v 1.14 1997/03/15 01:35:37 jonathan Exp $
|
1995-12-01 20:58:53 +03:00
|
|
|
#
|
|
|
|
# Perl script to convert a standard distribution directory for gcc into
|
|
|
|
# a NetBSD source tree.
|
|
|
|
#
|
|
|
|
# This is done as a script so that as each distribution is released,
|
|
|
|
# only changes from the previous one need to be dealt with as
|
|
|
|
# modifications to this script and related files. This should
|
|
|
|
# reduce the cost of updating from a new release of gcc by an
|
|
|
|
# order of magnitude (or more?)
|
|
|
|
#
|
|
|
|
# This script requires two environment variables set:
|
|
|
|
# SRCDIR - gcc source directory from FSF
|
|
|
|
# TARGETDIR - name of the high level directory to make
|
|
|
|
#
|
|
|
|
# Written by Phil Nelson, November 22, 1995. (for gcc-2.7.1)
|
|
|
|
#
|
|
|
|
# Updated November 29, 1995 for gcc-2.7.2
|
|
|
|
#
|
|
|
|
# This is currently updated for gcc-2.7.2. Newer versions of gcc
|
|
|
|
# should have this script and related files updated.
|
|
|
|
#
|
|
|
|
|
|
|
|
$version = "2.7.2";
|
|
|
|
|
|
|
|
# definitions ...
|
|
|
|
|
|
|
|
@subdirs = ("arch", "common", "cc", "cc1", "cc1obj", "cc1plus", "cpp",
|
|
|
|
"g++", "libgcc", "libobjc");
|
|
|
|
|
|
|
|
# The following should include: "alpha"
|
|
|
|
|
1996-05-19 09:19:52 +04:00
|
|
|
@archlist = ("arm32", "i386", "m68k", "mips", "ns32k", "sparc", "vax");
|
1995-12-01 20:58:53 +03:00
|
|
|
|
|
|
|
@obver = ("obstack.c", "version.c");
|
|
|
|
|
|
|
|
@archf = ("netbsd.h", "xm-netbsd.h");
|
|
|
|
|
|
|
|
@ccf = ("gcc.c");
|
|
|
|
|
|
|
|
@ccof = ("gcc.1");
|
|
|
|
|
1996-03-05 04:27:16 +03:00
|
|
|
@cc1f = ("c-lang.c");
|
1995-12-01 20:58:53 +03:00
|
|
|
|
1996-03-05 04:27:16 +03:00
|
|
|
@cc1of = ();
|
1996-02-29 00:01:27 +03:00
|
|
|
|
1996-03-05 04:27:16 +03:00
|
|
|
@cc1objf = ("objc-act.c");
|
1995-12-01 20:58:53 +03:00
|
|
|
|
1996-02-29 00:01:27 +03:00
|
|
|
@cc1objof = ("objc-tree.def", "objc-act.h", "objc-parse.y");
|
1995-12-01 20:58:53 +03:00
|
|
|
|
|
|
|
@cc1plusf = ("call.c", "decl.c", "errfn.c", "expr.c", "pt.c", "sig.c",
|
|
|
|
"typeck2.c", "class.c", "decl2.c", "error.c", "gc.c",
|
1996-03-05 04:27:16 +03:00
|
|
|
"lex.c", "ptree.c", "spew.c", "typeck.c",
|
1995-12-01 20:58:53 +03:00
|
|
|
"cvt.c", "edsel.c", "except.c", "init.c", "method.c",
|
|
|
|
"search.c", "tree.c", "xref.c", "repo.c");
|
|
|
|
|
|
|
|
@cc1plusof = ("tree.def", "class.h", "cp-tree.h", "decl.h", "hash.h",
|
1996-03-05 04:27:16 +03:00
|
|
|
"lex.h", "input.c", "parse.y");
|
1995-12-01 20:58:53 +03:00
|
|
|
|
|
|
|
@commonf = ("bc-emit.c", "bc-optab.c", "bi-reverse.c", "c-aux-info.c",
|
|
|
|
"c-common.c", "c-convert.c", "c-decl.c", "c-iterate.c",
|
|
|
|
"c-lex.c", "c-pragma.c", "c-typeck.c", "caller-save.c",
|
|
|
|
"calls.c", "combine.c", "convert.c", "cse.c", "dbxout.c",
|
|
|
|
"dwarfout.c", "emit-rtl.c", "explow.c", "expmed.c",
|
|
|
|
"expr.c", "final.c", "flow.c", "fold-const.c",
|
|
|
|
"function.c", "getpwd.c", "global.c", "integrate.c",
|
|
|
|
"jump.c", "local-alloc.c", "loop.c", "obstack.c",
|
|
|
|
"optabs.c", "print-rtl.c", "print-tree.c", "real.c",
|
|
|
|
"recog.c", "reg-stack.c", "regclass.c", "reload.c",
|
|
|
|
"reload1.c", "reorg.c", "rtl.c", "rtlanal.c", "sched.c",
|
|
|
|
"sdbout.c", "stmt.c", "stor-layout.c", "stupid.c",
|
|
|
|
"toplev.c", "tree.c", "unroll.c", "varasm.c", "version.c",
|
|
|
|
"xcoffout.c");
|
|
|
|
|
|
|
|
@commonof = ("bc-typecd.def", "bytecode.def", "machmode.def",
|
|
|
|
"modemap.def", "rtl.def", "stab.def", "tree.def",
|
|
|
|
"assert.h", "basic-block.h", "bc-emit.h", "bc-optab.h",
|
1996-03-05 04:27:16 +03:00
|
|
|
"bc-typecd.h", "bi-defs.h", "bi-run.h",
|
1995-12-01 20:58:53 +03:00
|
|
|
"bytecode.h", "bytetypes.h", "c-gperf.h", "c-lex.h",
|
1996-03-05 04:27:16 +03:00
|
|
|
"c-parse.y", "c-pragma.h", "c-tree.h", "conditions.h",
|
1995-12-01 20:58:53 +03:00
|
|
|
"convert.h", "defaults.h", "dwarf.h", "expr.h",
|
|
|
|
"flags.h", "function.h", "gstab.h", "gsyms.h",
|
|
|
|
"hard-reg-set.h", "input.h", "integrate.h", "loop.h",
|
|
|
|
"machmode.h", "obstack.h", "output.h", "real.h",
|
|
|
|
"recog.h", "regs.h", "reload.h", "rtl.h", "stack.h",
|
1996-02-29 00:01:27 +03:00
|
|
|
"tree.h", "typeclass.h", "xcoffout.h", "bi-parser.y");
|
1995-12-01 20:58:53 +03:00
|
|
|
|
|
|
|
@commonplus = ("lang-specs.h", "lang-options.h");
|
|
|
|
|
1996-03-13 00:28:52 +03:00
|
|
|
@genf = ("bi-opcode.c", "bi-arity.c", "bi-opname.c",
|
1995-12-01 20:58:53 +03:00
|
|
|
"bi-lexer.c", "genattr.c", "genattrtab.c", "gencodes.c",
|
|
|
|
"genconfig.c", "genemit.c", "genextract.c", "genflags.c",
|
|
|
|
"genopinit.c", "genoutput.c", "genpeep.c", "genrecog.c" );
|
|
|
|
|
|
|
|
|
1996-05-11 15:37:59 +04:00
|
|
|
@cppf = ("cccp.c");
|
1995-12-01 20:58:53 +03:00
|
|
|
|
1996-02-29 00:01:27 +03:00
|
|
|
@cppof = ("pcp.h", "cexp.y");
|
1995-12-01 20:58:53 +03:00
|
|
|
|
|
|
|
@gplusf = ("g++.c");
|
|
|
|
|
|
|
|
@gplusof = ("g++.1");
|
|
|
|
|
|
|
|
@libgccf = ("libgcc1.c", "libgcc2.c");
|
|
|
|
|
|
|
|
@libgccof = ("gbl-ctors.h");
|
|
|
|
|
|
|
|
@libobjcf = ("archive.c", "class.c", "encoding.c", "hash.c", "init.c",
|
|
|
|
"misc.c", "objects.c", "sarray.c", "selector.c",
|
|
|
|
"sendmsg.c");
|
|
|
|
|
|
|
|
@libobjcof = ("NXConstStr.h", "NXConstStr.m", "Object.h", "Object.m",
|
|
|
|
"Protocol.h", "Protocol.m", "encoding.h", "hash.h",
|
|
|
|
"list.h", "objc-api.h", "objc.h", "runtime.h",
|
|
|
|
"sarray.h", "typedstream.h");
|
|
|
|
|
|
|
|
@genh = ("attr", "flags", "codes", "config");
|
|
|
|
|
|
|
|
@genbc = ("opcode", "opname", "arity");
|
|
|
|
|
|
|
|
@genc =("peep", "opinit", "recog", "extract", "output", "emit", "attrtab");
|
|
|
|
|
|
|
|
$gendep = "rtl.o obstack.o";
|
|
|
|
|
|
|
|
$bcdep = "bi-parser.o bi-lexer.o bi-reverse.o obstack.o";
|
|
|
|
|
|
|
|
%sedlist = ("libobjc/NXConstStr.h","'s/objc\\///g'",
|
|
|
|
"libobjc/NXConstStr.m","'s/objc\\///g'",
|
|
|
|
"libobjc/Object.h","'s/objc\\///g'",
|
|
|
|
"libobjc/Object.m","'s/objc\\///g'",
|
|
|
|
"libobjc/Protocol.h","'s/objc\\///g'",
|
|
|
|
"libobjc/Protocol.m","'s/objc\\///g'",
|
|
|
|
"libobjc/encoding.h","'s/objc\\///g'",
|
|
|
|
"libobjc/hash.c","'s/objc\\///g'",
|
|
|
|
"libobjc/objc-api.h","'s/objc\\///g'",
|
|
|
|
"libobjc/runtime.h","'s/objc\\///g'",
|
|
|
|
"libobjc/sarray.c","'s/objc\\///g'",
|
|
|
|
"libobjc/selector.c","'s/objc\\///g'",
|
|
|
|
"libobjc/typedstream.h","'s/objc\\///g'",
|
|
|
|
"libobjc/objects.c","'s/\\.\\.\\///g'",
|
|
|
|
"libobjc/sendmsg.c","'s/\\.\\.\\///g'");
|
|
|
|
|
|
|
|
#
|
|
|
|
# Utility Subroutines
|
|
|
|
#
|
|
|
|
|
|
|
|
# ©files (fromdir, todir, list of files);
|
|
|
|
sub copyfiles {
|
|
|
|
local ($fdir, $tdir, @list) = @_;
|
|
|
|
local ($f);
|
|
|
|
|
|
|
|
foreach $f (@list) {
|
|
|
|
print " $fdir/$f --> $tdir/$f\n";
|
|
|
|
system ("cp $fdir/$f $tdir/$f");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
sub uniq {
|
|
|
|
local (@inlist) = @_;
|
|
|
|
local (@outlist);
|
|
|
|
|
|
|
|
@outlist = ($inlist[0]);
|
|
|
|
for ( $i=1; $i < @inlist; $i++ ) {
|
|
|
|
if ($inlist[$i] ne $inlist[$i-1]) {
|
|
|
|
push (@outlist, $inlist[$i]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@outlist;
|
|
|
|
}
|
|
|
|
|
|
|
|
sub dumpsrcs {
|
|
|
|
local (@names) = @_;
|
|
|
|
local ($count);
|
|
|
|
|
|
|
|
print ODATA "SRCS=\t";
|
|
|
|
$count = 0;
|
|
|
|
foreach $f (@names) {
|
|
|
|
print ODATA "$f ";
|
|
|
|
if ($count == 5) {
|
|
|
|
print ODATA "\\\n";
|
|
|
|
$count = 0;
|
|
|
|
} else {
|
|
|
|
$count += 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if ($count != 0) {
|
|
|
|
print ODATA "\n";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
# dump the rules for the generation programs.
|
|
|
|
sub dumpgens {
|
|
|
|
print ODATA "all: ";
|
|
|
|
foreach $n (@genh) { print ODATA "insn-$n.h "; };
|
|
|
|
foreach $n (@genbc) { print ODATA "bc-$n.h "; };
|
|
|
|
print ODATA "lib\$(LIB).a\n\n";
|
|
|
|
|
|
|
|
print ODATA "beforedepend: ";
|
|
|
|
foreach $n (@genh) { print ODATA "insn-$n.h "; };
|
|
|
|
foreach $n (@genbc) { print ODATA "bc-$n.h "; };
|
1996-03-13 00:28:52 +03:00
|
|
|
print ODATA "c-parse.h\n\n";
|
1995-12-01 20:58:53 +03:00
|
|
|
|
|
|
|
foreach $n (@genh) {
|
1996-05-23 08:54:42 +04:00
|
|
|
print ODATA "insn-$n.h: gen$n \$(MD)\n";
|
1995-12-01 20:58:53 +03:00
|
|
|
print ODATA "\t./gen$n \$(MD) > insn-$n.h\n\n";
|
|
|
|
print ODATA "CLEANFILES += insn-$n.h gen$n gen$n.o\n\n";
|
|
|
|
}
|
|
|
|
|
|
|
|
foreach $n (@genbc) {
|
1996-05-23 08:54:42 +04:00
|
|
|
print ODATA "bc-$n.h: bi-$n \$(BCDEF)\n";
|
1995-12-01 20:58:53 +03:00
|
|
|
print ODATA "\t./bi-$n < \$(BCDEF) > bc-$n.h\n\n";
|
|
|
|
print ODATA "CLEANFILES += bc-$n.h bi-$n bi-$n.o\n\n";
|
|
|
|
}
|
|
|
|
|
|
|
|
foreach $n (@genc) {
|
1996-05-23 08:54:42 +04:00
|
|
|
print ODATA "insn-$n.c: gen$n\n \$(MD)";
|
1995-12-01 20:58:53 +03:00
|
|
|
print ODATA "\t./gen$n \$(MD) > insn-$n.c\n";
|
|
|
|
print ODATA "CLEANFILES += insn-$n.c gen$n gen$n.o\n\n";
|
|
|
|
}
|
|
|
|
|
|
|
|
foreach $n (@genh, @genc) {
|
|
|
|
print ODATA "gen$n.o: gen$n.c\n\n";
|
|
|
|
print ODATA "gen$n: gen$n.o $gendep";
|
|
|
|
if ($n eq "attrtab") {
|
|
|
|
print ODATA " print-rtl.o rtlanal.o";
|
|
|
|
print ODATA "\n\t\$(CC) -o gen$n gen$n.o $gendep".
|
|
|
|
" print-rtl.o rtlanal.o\n\n";
|
|
|
|
} else {
|
|
|
|
print ODATA "\n\t\$(CC) -o gen$n gen$n.o $gendep\n\n";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
foreach $n (@genbc) {
|
|
|
|
print ODATA "bi-$n.o: bi-$n.c\n\n";
|
|
|
|
print ODATA "bi-$n: bi-$n.o $bcdep\n";
|
|
|
|
print ODATA "\t\$(CC) -o bi-$n bi-$n.o $bcdep\n\n";
|
|
|
|
}
|
|
|
|
|
|
|
|
# special clean files ...
|
1996-03-13 00:28:52 +03:00
|
|
|
print ODATA
|
|
|
|
"CLEANFILES += bi-lexer.o bi-parser.o bi-parser.c bi-parser.h\n\n";
|
1995-12-01 20:58:53 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
#
|
|
|
|
# Main progarm.
|
|
|
|
#
|
|
|
|
|
|
|
|
$srcdir = $ENV{'SRCDIR'};
|
|
|
|
$targetdir = $ENV{'TARGETDIR'};
|
|
|
|
$incdirs = "-I. -I$srcdir/config -I$srcdir";
|
|
|
|
|
|
|
|
if (!$srcdir | !targetdir) {
|
|
|
|
die "You must define the environment variables SRCDIR and TARGETDIR.\n"
|
|
|
|
}
|
|
|
|
print "Making the NetBSD directory tree.\n";
|
|
|
|
mkdir ($targetdir,0777);
|
|
|
|
foreach $f (@subdirs) {
|
|
|
|
print " -->$f\n";
|
|
|
|
mkdir ("$targetdir/$f",0777);
|
|
|
|
}
|
|
|
|
foreach $f(@archlist) {
|
|
|
|
print " -->arch/$f\n";
|
|
|
|
mkdir ("$targetdir/arch/$f",0777);
|
|
|
|
}
|
|
|
|
|
|
|
|
print "Populating $targetdir.\n";
|
|
|
|
©files ($srcdir, $targetdir, "COPYING");
|
|
|
|
|
|
|
|
print "Populating the arch directory.\n";
|
|
|
|
©files ("$srcdir/config", "$targetdir/arch", @archf);
|
|
|
|
foreach $arch (@archlist) {
|
|
|
|
system ("echo '#include \"$arch/xm-netbsd.h\"\n' > config.h");
|
|
|
|
system ("echo '#include \"$arch/netbsd.h\"\n' > tm.h");
|
|
|
|
print " cpp -M $incdirs tm.h config.h\n";
|
|
|
|
$results = `cpp -M $incdirs tm.h config.h`;
|
|
|
|
$results =~ tr/\n/ /;
|
|
|
|
@list = ();
|
|
|
|
foreach $item (split (/ /, $results)) {
|
|
|
|
if (index ($item, "$arch/") >= 0) {
|
|
|
|
push (@list, substr ($item, rindex ($item, '/')+1, 1000));
|
|
|
|
};
|
|
|
|
};
|
|
|
|
@list = sort (@list);
|
|
|
|
@list = &uniq (@list);
|
|
|
|
©files ("$srcdir/config/$arch", "$targetdir/arch/$arch",
|
|
|
|
"$arch.c", "$arch.md", @list);
|
|
|
|
# Config files
|
|
|
|
system ("printf \"#define NETBSD_NATIVE\n".
|
|
|
|
"#define DEFAULT_TARGET_VERSION \\\"$version\\\"\n".
|
|
|
|
"#define DEFAULT_TARGET_MACHINE \\\"NetBSD/$arch\\\"\n".
|
|
|
|
"#include \\\"$arch/xm-netbsd.h\\\"\n\"".
|
|
|
|
"> $targetdir/arch/$arch/config.h");
|
|
|
|
system ("printf \"#include \\\"$arch/xm-netbsd.h\\\"\\\n\"".
|
|
|
|
"> $targetdir/arch/$arch/hconfig.h");
|
|
|
|
system ("printf \"#include \\\"$arch/xm-netbsd.h\\\"\\\n\"".
|
|
|
|
"> $targetdir/arch/$arch/tconfig.h");
|
|
|
|
system ("printf \"#include \\\"$arch/netbsd.h\\\"\\\n\"".
|
|
|
|
"> $targetdir/arch/$arch/tm.h");
|
|
|
|
}
|
|
|
|
unlink ("config.h");
|
|
|
|
unlink ("tm.h");
|
|
|
|
|
|
|
|
# hack to allow mips/xm-netbsd.h to be changed later ...
|
|
|
|
chmod (0644, "$targetdir/arch/mips/xm-netbsd.h");
|
|
|
|
|
1997-03-15 04:35:37 +03:00
|
|
|
# and similarly for mips/netbsd.h.
|
|
|
|
chmod (0644, "$targetdir/arch/mips/netbsd.h");
|
|
|
|
|
1995-12-01 20:58:53 +03:00
|
|
|
print "Populating the top level directory.\n";
|
|
|
|
©files ($srcdir, $targetdir, "COPYING");
|
|
|
|
|
|
|
|
print "Populating the cc directory.\n";
|
1996-01-08 06:51:38 +03:00
|
|
|
©files ($srcdir, "$targetdir/cc", @ccf, @ccof);
|
1995-12-01 20:58:53 +03:00
|
|
|
|
|
|
|
print "Populating the cc1 directory.\n";
|
1996-01-08 06:51:38 +03:00
|
|
|
©files ($srcdir, "$targetdir/cc1", @cc1f, @cc1of);
|
1995-12-01 20:58:53 +03:00
|
|
|
|
|
|
|
print "Populating the cc1obj directory.\n";
|
1996-01-08 06:51:38 +03:00
|
|
|
©files ($srcdir, "$targetdir/cc1obj", @cc1objf, @cc1objof);
|
1995-12-01 20:58:53 +03:00
|
|
|
|
|
|
|
print "Populating the cc1plus directory.\n";
|
1996-01-08 06:51:38 +03:00
|
|
|
©files ("$srcdir/cp", "$targetdir/cc1plus", @cc1plusf, @cc1plusof);
|
1995-12-01 20:58:53 +03:00
|
|
|
|
|
|
|
print "Populating the common directory.\n";
|
1996-01-08 06:51:38 +03:00
|
|
|
©files ($srcdir, "$targetdir/common", @commonf, @commonof, @genf);
|
1995-12-01 20:58:53 +03:00
|
|
|
©files ("$srcdir/cp", "$targetdir/common", @commonplus);
|
|
|
|
|
|
|
|
print "Populating the cpp directory.\n";
|
1996-01-08 06:51:38 +03:00
|
|
|
©files ($srcdir, "$targetdir/cpp", @cppf, @cppof);
|
1995-12-01 20:58:53 +03:00
|
|
|
system ("cp $srcdir/cccp.1 $targetdir/cpp/cpp.1");
|
|
|
|
|
|
|
|
print "Populating the g++ directory.\n";
|
1996-01-08 06:51:38 +03:00
|
|
|
©files ("$srcdir/cp", "$targetdir/g++", @gplusf, @gplusof);
|
1995-12-01 20:58:53 +03:00
|
|
|
|
|
|
|
print "Populating the libgcc directory.\n";
|
1996-01-08 06:51:38 +03:00
|
|
|
©files ("$srcdir", "$targetdir/libgcc", @libgccf, @libgccof);
|
1995-12-01 20:58:53 +03:00
|
|
|
|
|
|
|
print "Populating the libobjc directory.\n";
|
1996-01-08 06:51:38 +03:00
|
|
|
©files ("$srcdir/objc", "$targetdir/libobjc", @libobjcf, @libobjcof);
|
1995-12-01 20:58:53 +03:00
|
|
|
|
|
|
|
|
|
|
|
#
|
|
|
|
# Build makefiles
|
|
|
|
#
|
|
|
|
|
|
|
|
$first = "True";
|
|
|
|
while ($line = <DATA>) {
|
|
|
|
chop ($line);
|
|
|
|
if (substr($line,0,2) eq "%%") {
|
|
|
|
@cmd = split (/ /,$line);
|
|
|
|
if ($cmd[1] eq "file") {
|
|
|
|
print "Building $targetdir/$cmd[2]\n";
|
|
|
|
if ($first eq "") {
|
|
|
|
close (ODATA);
|
|
|
|
} else {
|
|
|
|
$first = "";
|
|
|
|
}
|
|
|
|
open (ODATA, ">$targetdir/$cmd[2]") ||
|
|
|
|
die "Could now create $targetdir/$cmd[2]";
|
|
|
|
} elsif ($cmd[1] eq "srcs") {
|
|
|
|
print " Defining SRCS for $cmd[2]\n";
|
|
|
|
if ($first) {
|
|
|
|
die "Data file must start with a %% file!";
|
|
|
|
}
|
|
|
|
if ($cmd[2] eq "cc") {
|
|
|
|
&dumpsrcs (@ccf, @obver);
|
|
|
|
} elsif ($cmd[2] eq "cc1") {
|
1996-03-13 00:28:52 +03:00
|
|
|
&dumpsrcs (@cc1f, "c-parse.c");
|
1995-12-01 20:58:53 +03:00
|
|
|
} elsif ($cmd[2] eq "cc1plus") {
|
1996-03-13 00:28:52 +03:00
|
|
|
&dumpsrcs (@cc1plusf, "parse.c");
|
1995-12-01 20:58:53 +03:00
|
|
|
} elsif ($cmd[2] eq "cc1obj") {
|
1996-03-13 00:28:52 +03:00
|
|
|
&dumpsrcs (@cc1objf, "objc-parse.c");
|
1995-12-01 20:58:53 +03:00
|
|
|
} elsif ($cmd[2] eq "cpp") {
|
1996-05-11 15:37:59 +04:00
|
|
|
&dumpsrcs (@cppf, "cexp.c", @obver);
|
1995-12-01 20:58:53 +03:00
|
|
|
} elsif ($cmd[2] eq "g++") {
|
|
|
|
&dumpsrcs (@gplusf, @obver);
|
|
|
|
} elsif ($cmd[2] eq "common") {
|
|
|
|
@flist = ();
|
|
|
|
foreach $n (@genc) { push (@flist, "insn-$n.c"); }
|
|
|
|
&dumpsrcs (@commonf, "\$(MACHINE_ARCH).c", @flist);
|
|
|
|
} elsif ($cmd[2] eq "objc") {
|
|
|
|
&dumpsrcs (@libobjcf);
|
|
|
|
} else {
|
|
|
|
die "Unknown SRCS command";
|
|
|
|
}
|
|
|
|
} elsif ($cmd[1] eq "gens") {
|
|
|
|
if ($first) {
|
|
|
|
die "Data file must start with a %% file!";
|
|
|
|
}
|
|
|
|
&dumpgens;
|
1996-01-08 06:51:38 +03:00
|
|
|
} elsif ($cmd[1] eq "NetBSD") {
|
|
|
|
if ($first) {
|
|
|
|
die "Data section must start with a %% file!";
|
|
|
|
}
|
|
|
|
print ODATA "# \$"."NetBSD".": \$\n";
|
1995-12-01 20:58:53 +03:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if ($first) {
|
|
|
|
die "Data file must start with a %% file!";
|
|
|
|
}
|
|
|
|
print ODATA "$line\n";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
close (ODATA);
|
|
|
|
|
|
|
|
#
|
|
|
|
# Sed transformations of files
|
|
|
|
#
|
|
|
|
|
|
|
|
foreach $n (keys(%sedlist)) {
|
|
|
|
print "Modifying $n\n";
|
|
|
|
system ("cd $targetdir; sed $sedlist{$n} $n > tmp; mv -f tmp $n");
|
|
|
|
}
|
|
|
|
|
|
|
|
#
|
|
|
|
# end of the script
|
|
|
|
#
|
|
|
|
|
|
|
|
# what follows is the data for makefiles and other special files
|
|
|
|
# that need to be created.
|
|
|
|
|
|
|
|
__END__
|
|
|
|
%% file Makefile
|
1996-01-08 06:51:38 +03:00
|
|
|
%% NetBSD
|
1995-12-01 20:58:53 +03:00
|
|
|
|
|
|
|
SUBDIR= common cc cpp cc1 cc1plus cc1obj g++ libgcc libobjc
|
|
|
|
|
|
|
|
.include <bsd.subdir.mk>
|
|
|
|
%% file Makefile.cc1
|
1996-01-08 06:51:38 +03:00
|
|
|
%% NetBSD
|
1995-12-01 20:58:53 +03:00
|
|
|
|
|
|
|
NOMAN=
|
|
|
|
|
|
|
|
BINDIR= /usr/libexec
|
|
|
|
|
|
|
|
XXXX!= cd $(.CURDIR)/../common; \
|
|
|
|
printf "xxxx:\n\techo -I\$${.OBJDIR}\n" | ${MAKE} -r -s -f - xxxx
|
|
|
|
|
1996-03-05 04:27:16 +03:00
|
|
|
CFLAGS+=-I. -I${.CURDIR} -I${.CURDIR}/../common -I${.CURDIR}/../arch \
|
1995-12-01 20:58:53 +03:00
|
|
|
-I${.CURDIR}/../arch/$(MACHINE_ARCH) $(XXXX)
|
|
|
|
|
|
|
|
YFLAGS=
|
|
|
|
|
|
|
|
LIBCC1!= cd $(.CURDIR)/../common; \
|
|
|
|
printf "xxx:\n\techo \$${.OBJDIR}/libcc1.a\n" | ${MAKE} -r -s -f - xxx
|
|
|
|
|
|
|
|
LDADD+=${LIBCC1} -lgnumalloc
|
|
|
|
DPADD+= /usr/lib/libgnumalloc.a
|
|
|
|
|
1996-04-03 12:18:16 +04:00
|
|
|
${PROG}: ${LIBCC1}
|
|
|
|
|
1995-12-01 20:58:53 +03:00
|
|
|
.include <bsd.prog.mk>
|
|
|
|
%% file common/Makefile
|
1996-01-08 06:51:38 +03:00
|
|
|
%% NetBSD
|
1995-12-01 20:58:53 +03:00
|
|
|
|
|
|
|
LIB= cc1
|
|
|
|
|
|
|
|
NOMAN=
|
|
|
|
NOPIC=
|
|
|
|
NOPROFILE=
|
|
|
|
|
|
|
|
XXXX != cd $(.CURDIR)/../common; \
|
|
|
|
printf "xxxx:\n\techo -I\$${.OBJDIR}\n" | ${MAKE} -r -s -f - xxxx
|
|
|
|
|
1996-03-13 00:28:52 +03:00
|
|
|
CFLAGS+=-I${.CURDIR} -I${.CURDIR}/../arch \
|
1995-12-01 20:58:53 +03:00
|
|
|
-I${.CURDIR}/../arch/$(MACHINE_ARCH) $(XXXX)
|
|
|
|
|
|
|
|
MD= ${.CURDIR}/../arch/${MACHINE_ARCH}/${MACHINE_ARCH}.md
|
|
|
|
|
|
|
|
BCDEF= ${.CURDIR}/bytecode.def
|
|
|
|
|
|
|
|
.PATH: ${.CURDIR}/../arch/${MACHINE_ARCH}
|
|
|
|
|
|
|
|
%% srcs common
|
|
|
|
|
|
|
|
%% gens
|
|
|
|
|
1996-03-05 04:27:16 +03:00
|
|
|
bi-lexer.o: bi-parser.h
|
|
|
|
|
|
|
|
bi-parser.h: bi-parser.c
|
|
|
|
bi-parser.c: bi-parser.y
|
1996-03-13 00:28:52 +03:00
|
|
|
$(YACC) -b bi -d $(.IMPSRC)
|
|
|
|
mv -f bi.tab.c bi-parser.c
|
|
|
|
mv -f bi.tab.h bi-parser.h
|
1996-03-05 04:27:16 +03:00
|
|
|
|
|
|
|
CLEANFILES += c-parse.c c-parse.h
|
|
|
|
|
|
|
|
c-lex.o: c-parse.h
|
|
|
|
|
|
|
|
c-parse.h: c-parse.c
|
|
|
|
c-parse.c: c-parse.y
|
1996-03-13 00:28:52 +03:00
|
|
|
$(YACC) -b c -d $(.IMPSRC)
|
|
|
|
mv -f c.tab.c c-parse.c
|
|
|
|
mv -f c.tab.h c-parse.h
|
1996-03-05 04:27:16 +03:00
|
|
|
|
1995-12-01 20:58:53 +03:00
|
|
|
install:
|
|
|
|
|
|
|
|
.include <bsd.lib.mk>
|
|
|
|
|
|
|
|
%% file cc/Makefile
|
|
|
|
# from: @(#)Makefile 6.2 (Berkeley) 3/25/91
|
1996-01-08 06:51:38 +03:00
|
|
|
%% NetBSD
|
1995-12-01 20:58:53 +03:00
|
|
|
|
|
|
|
PROG= gcc
|
|
|
|
%% srcs cc
|
|
|
|
MAN= gcc.1
|
|
|
|
BINDIR= /usr/bin
|
|
|
|
CFLAGS+=-I${.CURDIR} -I${.CURDIR}/../common -I${.CURDIR}/../arch \
|
|
|
|
-I${.CURDIR}/../arch/$(MACHINE_ARCH) \
|
|
|
|
-DMD_EXEC_PREFIX=\"/usr/libexec/\" \
|
|
|
|
-DMD_STARTFILE_PREFIX=\"/usr/lib/\"
|
|
|
|
|
|
|
|
LDADD+= -lgnumalloc
|
|
|
|
DPADD+= /usr/lib/libgnumalloc.a
|
|
|
|
|
|
|
|
LINKS+= ${BINDIR}/gcc ${BINDIR}/cc
|
|
|
|
MLINKS= gcc.1 cc.1
|
|
|
|
|
|
|
|
.PATH: $(.CURDIR)/../common
|
|
|
|
|
|
|
|
.include <bsd.prog.mk>
|
|
|
|
%% file cc1/Makefile
|
|
|
|
# from: @(#)Makefile 6.2 (Berkeley) 2/2/91
|
1996-01-08 06:51:38 +03:00
|
|
|
%% NetBSD
|
1995-12-01 20:58:53 +03:00
|
|
|
|
|
|
|
PROG= cc1
|
|
|
|
|
|
|
|
%% srcs cc1
|
|
|
|
|
1996-03-13 00:28:52 +03:00
|
|
|
CLEANFILES+= c-parse.c
|
|
|
|
|
|
|
|
.PATH: ${.CURDIR}/../common
|
|
|
|
|
1995-12-01 20:58:53 +03:00
|
|
|
.include <../Makefile.cc1>
|
|
|
|
%% file cc1plus/Makefile
|
1996-01-08 06:51:38 +03:00
|
|
|
%% NetBSD
|
1995-12-01 20:58:53 +03:00
|
|
|
|
|
|
|
PROG= cc1plus
|
|
|
|
|
|
|
|
%% srcs cc1plus
|
|
|
|
|
1996-03-13 00:28:52 +03:00
|
|
|
lex.o pt.o spew.o: parse.h
|
|
|
|
|
|
|
|
CLEANFILES+= parse.c parse.h
|
|
|
|
|
|
|
|
parse.h: parse.c
|
|
|
|
parse.c: parse.y
|
|
|
|
$(YACC) -d $(.IMPSRC)
|
|
|
|
grep '^#define[ ]*YYEMPTY' y.tab.c >>y.tab.h
|
|
|
|
mv -f y.tab.c parse.c
|
|
|
|
mv -f y.tab.h parse.h
|
1996-03-05 04:27:16 +03:00
|
|
|
|
1995-12-01 20:58:53 +03:00
|
|
|
.include <../Makefile.cc1>
|
|
|
|
%% file cc1obj/Makefile
|
1996-01-08 06:51:38 +03:00
|
|
|
%% NetBSD
|
1995-12-01 20:58:53 +03:00
|
|
|
|
|
|
|
PROG= cc1obj
|
|
|
|
|
|
|
|
%% srcs cc1obj
|
|
|
|
|
1996-03-13 00:28:52 +03:00
|
|
|
CLEANFILES+= objc-parse.c
|
|
|
|
|
1995-12-01 20:58:53 +03:00
|
|
|
.PATH: $(.CURDIR)/../cc1
|
|
|
|
|
|
|
|
.include <../Makefile.cc1>
|
|
|
|
%% file cpp/Makefile
|
|
|
|
# from: @(#)Makefile 6.4 (Berkeley) 2/21/91
|
1996-01-08 06:51:38 +03:00
|
|
|
%% NetBSD
|
1995-12-01 20:58:53 +03:00
|
|
|
|
|
|
|
PROG= cpp
|
|
|
|
BINDIR= /usr/libexec
|
|
|
|
%% srcs cpp
|
|
|
|
CFLAGS+= -I. -I$(.CURDIR) -I$(.CURDIR)/../common -I$(.CURDIR)/../arch \
|
|
|
|
-I$(.CURDIR)/../arch/$(MACHINE_ARCH) \
|
|
|
|
-DGCC_INCLUDE_DIR=\"\" \
|
|
|
|
-DTOOL_INCLUDE_DIR=\"\" \
|
|
|
|
-DGPLUSPLUS_INCLUDE_DIR=\"/usr/include/g++\"
|
|
|
|
LDADD+= -lgnumalloc
|
|
|
|
DPADD+= /usr/lib/libgnumalloc.a
|
|
|
|
YFLAGS=
|
|
|
|
|
|
|
|
MLINKS= cpp.1 cccp.1 cpp.1 gcpp.1
|
|
|
|
|
1996-05-11 15:37:59 +04:00
|
|
|
CLEANFILES+= cexp.c
|
|
|
|
|
1995-12-01 20:58:53 +03:00
|
|
|
.PATH: $(.CURDIR)/../common
|
|
|
|
|
|
|
|
afterinstall:
|
1996-10-18 06:52:59 +04:00
|
|
|
${INSTALL} -c -o $(BINOWN) -g $(BINGRP) -m $(BINMODE) \
|
1995-12-01 20:58:53 +03:00
|
|
|
$(.CURDIR)/usr.bin.cpp.sh $(DESTDIR)/usr/bin/cpp
|
|
|
|
@/bin/rm -rf $(DESTDIR)/usr/bin/gcpp
|
|
|
|
@ln $(DESTDIR)/usr/bin/cpp $(DESTDIR)/usr/bin/gcpp
|
|
|
|
@echo $(DESTDIR)/usr/bin/gcpp -\> $(DESTDIR)/usr/bin/cpp
|
|
|
|
|
|
|
|
.include <bsd.prog.mk>
|
|
|
|
%% file g++/Makefile
|
|
|
|
# from: @(#)Makefile 6.2 (Berkeley) 3/25/91
|
1996-01-08 06:51:38 +03:00
|
|
|
%% NetBSD
|
1995-12-01 20:58:53 +03:00
|
|
|
|
|
|
|
PROG= g++
|
|
|
|
%% srcs g++
|
|
|
|
MAN= g++.1
|
|
|
|
BINDIR= /usr/bin
|
1996-03-13 00:28:52 +03:00
|
|
|
CFLAGS+= -I$(.CURDIR) -I$(.CURDIR)/../common \
|
|
|
|
-I$(.CURDIR)/../arch -I$(.CURDIR)/../arch/$(MACHINE_ARCH) \
|
1996-03-11 09:53:27 +03:00
|
|
|
-DGCC_NAME=\"/usr/bin/cc\"
|
1995-12-01 20:58:53 +03:00
|
|
|
LDADD+= -lgnumalloc
|
|
|
|
DPADD+= /usr/lib/libgnumalloc.a
|
|
|
|
|
1996-01-08 06:51:38 +03:00
|
|
|
LINKS+= ${BINDIR}/g++ ${BINDIR}/c++
|
1995-12-01 20:58:53 +03:00
|
|
|
MLINKS= g++.1 c++.1
|
|
|
|
|
|
|
|
.PATH: $(.CURDIR)/../common
|
|
|
|
|
|
|
|
.include <bsd.prog.mk>
|
|
|
|
%% file libgcc/Makefile
|
1996-01-08 06:51:38 +03:00
|
|
|
%% NetBSD
|
1995-12-01 20:58:53 +03:00
|
|
|
|
|
|
|
LIB= gcc
|
|
|
|
NOPROFILE=
|
|
|
|
NOPIC=
|
|
|
|
|
|
|
|
CFLAGS+=-I${.CURDIR}/../common -I${.CURDIR}/../arch \
|
|
|
|
-I${.CURDIR}/../arch/${MACHINE_ARCH}
|
|
|
|
|
|
|
|
#LIB1OBJS= _mulsi3.o _udivsi3.o _divsi3.o _umodsi3.o _modsi3.o _lshrsi3.o \
|
|
|
|
# _lshlsi3.o _ashrsi3.o _ashlsi3.o _divdf3.o _muldf3.o _negdf2.o \
|
|
|
|
# _adddf3.o _subdf3.o _fixdfsi.o _fixsfsi.o _floatsidf.o _floatsisf.o \
|
|
|
|
# _truncdfsf2.o _extendsfdf2.o _addsf3.o _negsf2.o _subsf3.o \
|
|
|
|
# _mulsf3.o _divsf3.o _eqdf2.o _nedf2.o _gtdf2.o _gedf2.o _ltdf2.o \
|
|
|
|
# _ledf2.o _eqsf2.o _nesf2.o _gtsf2.o _gesf2.o _ltsf2.o _lesf2.o
|
|
|
|
|
|
|
|
#LIB2OBJS= _muldi3.o _divdi3.o _moddi3.o _udivdi3.o _umoddi3.o _negdi2.o \
|
|
|
|
# _lshrdi3.o _lshldi3.o _ashldi3.o _ashrdi3 _ffsdi2.o \
|
|
|
|
# _udiv_w_sdiv.o _udivmoddi4.o _cmpdi2.o _ucmpdi2.o _floatdidf.o \
|
|
|
|
# _floatdisf.o _fixunsdfsi.o _fixunssfsi.o _fixunsdfdi.o _fixdfdi.o \
|
|
|
|
# _fixunssfdi.o _fixsfdi.o _fixxfdi.o _fixunsxfdi.o _floatdixf.o \
|
|
|
|
# _fixunsxfsi.o
|
|
|
|
|
|
|
|
LIB2OBJS+=__gcc_bcmp.o _varargs.o _eprintf.o _op_new.o _new_handler.o \
|
|
|
|
_op_delete.o _bb.o _shtab.o _clear_cache.o _trampoline.o __main.o \
|
|
|
|
_exit.o _ctors.o _op_vdel.o _op_vnew.o _pure.o
|
|
|
|
|
1996-01-04 08:34:58 +03:00
|
|
|
.if (${MACHINE_ARCH} == "m68k") || (${MACHINE_ARCH} == "i386")
|
|
|
|
LIB2OBJS+=_fixxfdi.o _fixunsxfdi.o _floatdixf.o _fixunsxfsi.o
|
1995-12-01 20:58:53 +03:00
|
|
|
.endif
|
|
|
|
|
|
|
|
OBJS= ${LIB1OBJS} ${LIB2OBJS}
|
|
|
|
#LIB1SOBJS=${LIB1OBJS:.o=.so}
|
|
|
|
LIB2SOBJS=${LIB2OBJS:.o=.so}
|
|
|
|
|
|
|
|
#${LIB1OBJS}: libgcc1.c
|
|
|
|
# ${COMPILE.c} -DL${.PREFIX} -o ${.TARGET} ${.CURDIR}/libgcc1.c
|
|
|
|
# @${LD} -x -r ${.TARGET}
|
|
|
|
# @mv a.out ${.TARGET}
|
|
|
|
|
|
|
|
${LIB2OBJS}: libgcc2.c
|
|
|
|
${COMPILE.c} -DL${.PREFIX} -o ${.TARGET} ${.CURDIR}/libgcc2.c
|
|
|
|
@${LD} -x -r ${.TARGET}
|
|
|
|
@mv a.out ${.TARGET}
|
|
|
|
|
|
|
|
#${LIB1SOBJS}: libgcc1.c
|
|
|
|
# ${COMPILE.c} -fpic -DL${.PREFIX} -o ${.TARGET} ${.CURDIR}/libgcc1.c
|
|
|
|
|
|
|
|
${LIB2SOBJS}: libgcc2.c
|
|
|
|
${COMPILE.c} -fpic -DL${.PREFIX} -o ${.TARGET} ${.CURDIR}/libgcc2.c
|
|
|
|
|
|
|
|
.include <bsd.lib.mk>
|
|
|
|
%% file libobjc/Makefile
|
1996-01-08 06:51:38 +03:00
|
|
|
%% NetBSD
|
1995-12-01 20:58:53 +03:00
|
|
|
|
|
|
|
LIB= objc
|
|
|
|
NOPROFILE=
|
|
|
|
NOPIC=
|
|
|
|
|
|
|
|
CFLAGS+=-I${.CURDIR}/../common -I${.CURDIR}/../arch \
|
|
|
|
-I${.CURDIR}/../arch/${MACHINE_ARCH}
|
|
|
|
|
|
|
|
%% srcs objc
|
|
|
|
|
|
|
|
.include <bsd.lib.mk>
|
|
|
|
%% file cpp/usr.bin.cpp.sh
|
|
|
|
#!/bin/sh
|
|
|
|
#
|
|
|
|
# Copyright (c) 1990 The Regents of the University of California.
|
|
|
|
# All rights reserved.
|
|
|
|
#
|
|
|
|
# This code is derived from software contributed to Berkeley by
|
|
|
|
# the Systems Programming Group of the University of Utah Computer
|
|
|
|
# Science Department.
|
|
|
|
#
|
|
|
|
# Redistribution and use in source and binary forms, with or without
|
|
|
|
# modification, are permitted provided that the following conditions
|
|
|
|
# are met:
|
|
|
|
# 1. Redistributions of source code must retain the above copyright
|
|
|
|
# notice, this list of conditions and the following disclaimer.
|
|
|
|
# 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
# notice, this list of conditions and the following disclaimer in the
|
|
|
|
# documentation and/or other materials provided with the distribution.
|
|
|
|
# 3. All advertising materials mentioning features or use of this software
|
|
|
|
# must display the following acknowledgement:
|
|
|
|
# This product includes software developed by the University of
|
|
|
|
# California, Berkeley and its contributors.
|
|
|
|
# 4. Neither the name of the University nor the names of its contributors
|
|
|
|
# may be used to endorse or promote products derived from this software
|
|
|
|
# without specific prior written permission.
|
|
|
|
#
|
|
|
|
# THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
|
|
|
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
# ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
|
|
|
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
# SUCH DAMAGE.
|
|
|
|
#
|
|
|
|
# @(#)usr.bin.cpp.sh 6.5 (Berkeley) 4/1/91
|
|
|
|
#
|
|
|
|
# Transitional front end to CCCP to make it behave like (Reiser) CCP:
|
|
|
|
# specifies -traditional
|
|
|
|
# doesn't search gcc-include
|
|
|
|
#
|
|
|
|
PATH=/usr/bin:/bin
|
|
|
|
CPP=/usr/libexec/cpp
|
|
|
|
ALST="-traditional -D__GNUC__ -$ "
|
|
|
|
NSI=no
|
|
|
|
OPTS=""
|
|
|
|
INCS="-nostdinc"
|
|
|
|
FOUNDFILES=no
|
|
|
|
|
|
|
|
while [ $# -gt 0 ]
|
|
|
|
do
|
|
|
|
A="$1"
|
|
|
|
shift
|
|
|
|
|
|
|
|
case $A in
|
|
|
|
-nostdinc)
|
|
|
|
NSI=yes
|
|
|
|
;;
|
|
|
|
-traditional)
|
|
|
|
;;
|
|
|
|
-I*)
|
|
|
|
INCS="$INCS $A"
|
|
|
|
;;
|
|
|
|
-U__GNUC__)
|
|
|
|
ALST=`echo $ALST | sed -e 's/-D__GNUC__//'`
|
|
|
|
;;
|
|
|
|
-imacros|-include|-idirafter|-iprefix|-iwithprefix)
|
|
|
|
INCS="$INCS '$A' '$1'"
|
|
|
|
shift
|
|
|
|
;;
|
|
|
|
-*)
|
|
|
|
OPTS="$OPTS '$A'"
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
FOUNDFILES=yes
|
|
|
|
if [ $NSI = "no" ]
|
|
|
|
then
|
|
|
|
INCS="$INCS -I/usr/include"
|
|
|
|
NSI=skip
|
|
|
|
fi
|
|
|
|
eval $CPP $ALST $INCS $OPTS $A || exit $?
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
|
|
|
if [ $FOUNDFILES = "no" ]
|
|
|
|
then
|
|
|
|
# read standard input
|
|
|
|
if [ $NSI = "no" ]
|
|
|
|
then
|
|
|
|
INCS="$INCS -I/usr/include"
|
|
|
|
fi
|
|
|
|
eval exec $CPP $ALST $INCS $OPTS
|
|
|
|
fi
|
|
|
|
|
|
|
|
exit 0
|
|
|
|
%% file cc/specs.h
|
|
|
|
#include "lang-specs.h"
|
|
|
|
%% file cc/multilib.h
|
|
|
|
#define MULTILIB_SELECT ". ;"
|
|
|
|
%% file common/options.h
|
|
|
|
#include "lang-options.h"
|
|
|
|
%% file arch/mips/xm-netbsd.h
|
1995-12-15 11:05:11 +03:00
|
|
|
#include <mips/xm-mips.h>
|
|
|
|
#include <xm-netbsd.h>
|
1997-03-15 04:35:37 +03:00
|
|
|
%%file arch/mips/netbsd.h
|
|
|
|
/* Definitions for DECstation running BSD as target machine for GNU compiler.
|
|
|
|
Copyright (C) 1993, 1995 Free Software Foundation, Inc.
|
|
|
|
|
|
|
|
This file is part of GNU CC.
|
|
|
|
|
|
|
|
GNU CC is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation; either version 2, or (at your option)
|
|
|
|
any later version.
|
|
|
|
|
|
|
|
GNU CC is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with GNU CC; see the file COPYING. If not, write to
|
|
|
|
the Free Software Foundation, 59 Temple Place - Suite 330,
|
|
|
|
Boston, MA 02111-1307, USA. */
|
|
|
|
|
|
|
|
/* We settle for little endian for now */
|
|
|
|
|
|
|
|
#define TARGET_ENDIAN_DEFAULT 0
|
|
|
|
|
|
|
|
|
|
|
|
/* Look for the include files in the system-defined places. */
|
|
|
|
|
|
|
|
#ifndef CROSS_COMPILE
|
|
|
|
#undef GPLUSPLUS_INCLUDE_DIR
|
|
|
|
#define GPLUSPLUS_INCLUDE_DIR "/usr/include/g++"
|
|
|
|
|
|
|
|
#undef GCC_INCLUDE_DIR
|
|
|
|
#define GCC_INCLUDE_DIR "/usr/include"
|
|
|
|
|
|
|
|
#undef INCLUDE_DEFAULTS
|
|
|
|
#define INCLUDE_DEFAULTS \
|
|
|
|
{ \
|
|
|
|
{ GPLUSPLUS_INCLUDE_DIR, 1, 1 }, \
|
|
|
|
{ GCC_INCLUDE_DIR, 0, 0 }, \
|
|
|
|
{ 0, 0, 0 } \
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Under NetBSD, the normal location of the various *crt*.o files is the
|
|
|
|
/usr/lib directory. */
|
|
|
|
|
|
|
|
#undef STANDARD_STARTFILE_PREFIX
|
|
|
|
#define STANDARD_STARTFILE_PREFIX "/usr/lib/"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* Provide a LINK_SPEC appropriate for NetBSD. Here we provide support
|
|
|
|
for the special GCC options -static, -assert, and -nostdlib. */
|
|
|
|
|
|
|
|
#undef LINK_SPEC
|
|
|
|
#define LINK_SPEC \
|
|
|
|
"%{G*} %{EB} %{EL} %{mips1} %{mips2} %{mips3} \
|
|
|
|
%{bestGnum} %{shared} %{non_shared} \
|
|
|
|
%{call_shared} %{no_archive} %{exact_version} \
|
|
|
|
%{!shared: %{!non_shared: %{!call_shared: -non_shared}}} \
|
|
|
|
%{!dynamic-linker:-dynamic-linker /usr/libexec/ld.so} \
|
|
|
|
%{!nostdlib:%{!r*:%{!e*:-e __start}}} -dc -dp \
|
|
|
|
%{static:-Bstatic} %{!static:-Bdynamic} %{assert*}"
|
|
|
|
|
|
|
|
/* We have atexit(3). */
|
|
|
|
|
|
|
|
#define HAVE_ATEXIT
|
|
|
|
|
|
|
|
/* Implicit library calls should use memcpy, not bcopy, etc. */
|
|
|
|
|
|
|
|
#define TARGET_MEM_FUNCTIONS
|
|
|
|
|
|
|
|
/* Define mips-specific netbsd predefines... */
|
|
|
|
#ifndef CPP_PREDEFINES
|
|
|
|
#define CPP_PREDEFINES "-D__ANSI_COMPAT \
|
|
|
|
-DMIPSEL -DR3000 -DSYSTYPE_BSD -D_SYSTYPE_BSD -D__NetBSD__ -Dmips \
|
|
|
|
-D__NO_LEADING_UNDERSCORES__ -D__GP_SUPPORT__ \
|
|
|
|
-Dunix -D_R3000 -D__KPRINTF_ATTRIBUTE__ \
|
|
|
|
-Asystem(unix) -Asystem(NetBSD) -Amachine(mips)"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef CC1_SPEC
|
|
|
|
#define CC1_SPEC "\
|
|
|
|
%{gline:%{!g:%{!g0:%{!g1:%{!g2: -g1}}}}} \
|
|
|
|
%{mips1:-mfp32 -mgp32}%{mips2:-mfp32 -mgp32}\
|
|
|
|
%{mips3:%{!msingle-float:%{!m4650:-mfp64}} -mgp64} \
|
|
|
|
%{mips4:%{!msingle-float:%{!m4650:-mfp64}} -mgp64} \
|
|
|
|
%{mfp64:%{msingle-float:%emay not use both -mfp64 and -msingle-float}} \
|
|
|
|
%{mfp64:%{m4650:%emay not use both -mfp64 and -m4650}} \
|
|
|
|
%{m4650:-mcpu=r4650} \
|
|
|
|
%{G*} %{EB:-meb} %{EL:-mel} %{EB:%{EL:%emay not use both -EB and -EL}} \
|
|
|
|
%{pic-none: -mno-half-pic} \
|
|
|
|
%{pic-lib: -mhalf-pic} \
|
|
|
|
%{pic-extern: -mhalf-pic} \
|
|
|
|
%{pic-calls: -mhalf-pic} \
|
|
|
|
%{save-temps: } \
|
|
|
|
%{!mno-abicalls: -mabicalls}"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* Always uses gas. */
|
|
|
|
#ifndef ASM_SPEC
|
|
|
|
#define ASM_SPEC "\
|
|
|
|
%{G*} %{EB} %{EL} %{mips1} %{mips2} %{mips3} %{v} \
|
|
|
|
%{noasmopt:-O0} \
|
|
|
|
%{!noasmopt:%{O:-O2} %{O1:-O2} %{O2:-O2} %{O3:-O3}} \
|
|
|
|
%{g} %{g0} %{g1} %{g2} %{g3} \
|
|
|
|
%{ggdb:-g} %{ggdb0:-g0} %{ggdb1:-g1} %{ggdb2:-g2} %{ggdb3:-g3} \
|
|
|
|
%{gstabs:-g} %{gstabs0:-g0} %{gstabs1:-g1} %{gstabs2:-g2} %{gstabs3:-g3} \
|
|
|
|
%{gstabs+:-g} %{gstabs+0:-g0} %{gstabs+1:-g1} %{gstabs+2:-g2} %{gstabs+3:-g3} \
|
|
|
|
%{gcoff:-g} %{gcoff0:-g0} %{gcoff1:-g1} %{gcoff2:-g2} %{gcoff3:-g3} \
|
|
|
|
%{membedded-pic} %{fPIC:-KPIC}"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef CPP_SPEC
|
|
|
|
#define CPP_SPEC "\
|
|
|
|
%{posix:-D_POSIX_SOURCE} \
|
|
|
|
%{mlong64:-D__SIZE_TYPE__=long\\ unsigned\\ int -D__PTRDIFF_TYPE__=long\\ int} \
|
|
|
|
%{!mlong64:-D__SIZE_TYPE__=unsigned\\ int -D__PTRDIFF_TYPE__=int} \
|
|
|
|
%{mips3:-U__mips -D__mips=3 -D__mips64} \
|
|
|
|
%{mgp32:-U__mips64} %{mgp64:-D__mips64}"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#define LIB_SPEC "%{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p}"
|
|
|
|
|
|
|
|
#undef LIB_SPEC
|
|
|
|
#define LIB_SPEC "%{p:-lprof1} %{pg:-lprof1} -lc /usr/lib/crtn.o%s"
|
|
|
|
#define STARTFILE_SPEC \
|
|
|
|
"%{!shared:%{pg:gcrt1.o%s}%{!pg:%{p:mcrt1.o%s libprof1.a%s}%{!p:crt1.o%s}}}"
|
|
|
|
|
|
|
|
#ifndef MACHINE_TYPE
|
|
|
|
#define MACHINE_TYPE "NetBSD/mips"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#define TARGET_DEFAULT MASK_GAS
|
|
|
|
#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
|
|
|
|
|
|
|
|
#define LOCAL_LABEL_PREFIX "."
|
|
|
|
|
|
|
|
/* -G is incompatible with -KPIC which is the default, so only allow objects
|
|
|
|
in the small data section if the user explicitly asks for it. */
|
|
|
|
#undef MIPS_DEFAULT_GVALUE
|
|
|
|
#define MIPS_DEFAULT_GVALUE 0
|
|
|
|
|
|
|
|
#include "mips/mips.h"
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Some imports from svr4.h in support of shared libraries.
|
|
|
|
* Currently, we need the DECLARE_OBJECT_SIZE stuff.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* Define the strings used for the special svr4 .type and .size directives.
|
|
|
|
These strings generally do not vary from one system running svr4 to
|
|
|
|
another, but if a given system (e.g. m88k running svr) needs to use
|
|
|
|
different pseudo-op names for these, they may be overridden in the
|
|
|
|
file which includes this one. */
|
|
|
|
|
|
|
|
#undef TYPE_ASM_OP
|
|
|
|
#undef SIZE_ASM_OP
|
|
|
|
#undef WEAK_ASM_OP
|
|
|
|
#define TYPE_ASM_OP ".type"
|
|
|
|
#define SIZE_ASM_OP ".size"
|
|
|
|
#define WEAK_ASM_OP ".weak"
|
|
|
|
|
|
|
|
/* This is how to equate one symbol to another symbol. The syntax used is
|
|
|
|
`SYM1=SYM2'. Note that this is different from the way equates are done
|
|
|
|
with most svr4 assemblers, where the syntax is `.set SYM1,SYM2'. */
|
|
|
|
|
|
|
|
#define ASM_OUTPUT_DEF(FILE,LABEL1,LABEL2) \
|
|
|
|
do { fprintf ((FILE), "\t"); \
|
|
|
|
assemble_name (FILE, LABEL1); \
|
|
|
|
fprintf (FILE, " = "); \
|
|
|
|
assemble_name (FILE, LABEL2); \
|
|
|
|
fprintf (FILE, "\n"); \
|
|
|
|
} while (0)
|
|
|
|
|
|
|
|
|
|
|
|
/* The following macro defines the format used to output the second
|
|
|
|
operand of the .type assembler directive. Different svr4 assemblers
|
|
|
|
expect various different forms for this operand. The one given here
|
|
|
|
is just a default. You may need to override it in your machine-
|
|
|
|
specific tm.h file (depending upon the particulars of your assembler). */
|
|
|
|
|
|
|
|
#undef TYPE_OPERAND_FMT
|
|
|
|
#define TYPE_OPERAND_FMT "@%s"
|
|
|
|
|
|
|
|
/* Write the extra assembler code needed to declare a function's result.
|
|
|
|
Most svr4 assemblers don't require any special declaration of the
|
|
|
|
result value, but there are exceptions. */
|
|
|
|
|
|
|
|
#ifndef ASM_DECLARE_RESULT
|
|
|
|
#define ASM_DECLARE_RESULT(FILE, RESULT)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* These macros generate the special .type and .size directives which
|
|
|
|
are used to set the corresponding fields of the linker symbol table
|
|
|
|
entries in an ELF object file under SVR4. These macros also output
|
|
|
|
the starting labels for the relevant functions/objects. */
|
|
|
|
|
|
|
|
/* Write the extra assembler code needed to declare a function properly.
|
|
|
|
Some svr4 assemblers need to also have something extra said about the
|
|
|
|
function's return value. We allow for that here. */
|
|
|
|
|
|
|
|
#undef ASM_DECLARE_FUNCTION_NAME
|
|
|
|
#define ASM_DECLARE_FUNCTION_NAME(STREAM, NAME, DECL) \
|
|
|
|
do { \
|
|
|
|
extern FILE *asm_out_text_file; \
|
|
|
|
\
|
|
|
|
if (TARGET_GP_OPT) \
|
|
|
|
{ \
|
|
|
|
int align; \
|
|
|
|
STREAM = asm_out_text_file; \
|
|
|
|
/* Output ALIGN again to the new stream. XXX */ \
|
|
|
|
align = floor_log2 (FUNCTION_BOUNDARY / BITS_PER_UNIT); \
|
|
|
|
if (align > 0) \
|
|
|
|
{ \
|
|
|
|
if (output_bytecode) \
|
|
|
|
BC_OUTPUT_ALIGN (STREAM, align); \
|
|
|
|
else \
|
|
|
|
ASM_OUTPUT_ALIGN (STREAM, align); \
|
|
|
|
} \
|
|
|
|
} \
|
|
|
|
fprintf (STREAM, "\t%s\t ", TYPE_ASM_OP); \
|
|
|
|
assemble_name (STREAM, NAME); \
|
|
|
|
putc (',', STREAM); \
|
|
|
|
fprintf (STREAM, TYPE_OPERAND_FMT, "function"); \
|
|
|
|
putc ('\n', STREAM); \
|
|
|
|
ASM_DECLARE_RESULT (STREAM, DECL_RESULT (DECL)); \
|
|
|
|
HALF_PIC_DECLARE (NAME); \
|
|
|
|
} while (0)
|
|
|
|
|
|
|
|
/* Assemble generic sections.
|
|
|
|
/* Write the extra assembler code needed to declare an object properly. */
|
|
|
|
|
|
|
|
#undef ASM_DECLARE_OBJECT_NAME
|
|
|
|
#define ASM_DECLARE_OBJECT_NAME(FILE, NAME, DECL) \
|
|
|
|
do { \
|
|
|
|
fprintf (FILE, "\t%s\t ", TYPE_ASM_OP); \
|
|
|
|
assemble_name (FILE, NAME); \
|
|
|
|
putc (',', FILE); \
|
|
|
|
fprintf (FILE, TYPE_OPERAND_FMT, "object"); \
|
|
|
|
putc ('\n', FILE); \
|
|
|
|
size_directive_output = 0; \
|
|
|
|
if (!flag_inhibit_size_directive && DECL_SIZE (DECL)) \
|
|
|
|
{ \
|
|
|
|
size_directive_output = 1; \
|
|
|
|
fprintf (FILE, "\t%s\t ", SIZE_ASM_OP); \
|
|
|
|
assemble_name (FILE, NAME); \
|
|
|
|
fprintf (FILE, ",%d\n", int_size_in_bytes (TREE_TYPE (DECL))); \
|
|
|
|
} \
|
|
|
|
ASM_OUTPUT_LABEL(FILE, NAME); \
|
|
|
|
} while (0)
|
|
|
|
|
|
|
|
/* Output the size directive for a decl in rest_of_decl_compilation
|
|
|
|
in the case where we did not do so before the initializer.
|
|
|
|
Once we find the error_mark_node, we know that the value of
|
|
|
|
size_directive_output was set
|
|
|
|
by ASM_DECLARE_OBJECT_NAME when it was run for the same decl. */
|
|
|
|
|
|
|
|
#undef ASM_FINISH_DECLARE_OBJECT
|
|
|
|
#define ASM_FINISH_DECLARE_OBJECT(FILE, DECL, TOP_LEVEL, AT_END) \
|
|
|
|
do { \
|
|
|
|
char *name = XSTR (XEXP (DECL_RTL (DECL), 0), 0); \
|
|
|
|
if (!flag_inhibit_size_directive && DECL_SIZE (DECL) \
|
|
|
|
&& ! AT_END && TOP_LEVEL \
|
|
|
|
&& DECL_INITIAL (DECL) == error_mark_node \
|
|
|
|
&& !size_directive_output) \
|
|
|
|
{ \
|
|
|
|
size_directive_output = 1; \
|
|
|
|
fprintf (FILE, "\t%s\t ", SIZE_ASM_OP); \
|
|
|
|
assemble_name (FILE, name); \
|
|
|
|
fprintf (FILE, ",%d\n", int_size_in_bytes (TREE_TYPE (DECL))); \
|
|
|
|
} \
|
|
|
|
} while (0)
|
|
|
|
|
|
|
|
/* This is how to declare the size of a function. */
|
|
|
|
|
|
|
|
#undef ASM_DECLARE_FUNCTION_SIZE
|
|
|
|
#define ASM_DECLARE_FUNCTION_SIZE(FILE, FNAME, DECL) \
|
|
|
|
do { \
|
|
|
|
if (!flag_inhibit_size_directive) \
|
|
|
|
{ \
|
|
|
|
char label[256]; \
|
|
|
|
static int labelno; \
|
|
|
|
labelno++; \
|
|
|
|
ASM_GENERATE_INTERNAL_LABEL (label, "Lfe", labelno); \
|
|
|
|
ASM_OUTPUT_INTERNAL_LABEL (FILE, "Lfe", labelno); \
|
|
|
|
fprintf (FILE, "\t%s\t ", SIZE_ASM_OP); \
|
|
|
|
assemble_name (FILE, (FNAME)); \
|
|
|
|
fprintf (FILE, ","); \
|
|
|
|
assemble_name (FILE, label); \
|
|
|
|
fprintf (FILE, "-"); \
|
|
|
|
assemble_name (FILE, (FNAME)); \
|
|
|
|
putc ('\n', FILE); \
|
|
|
|
} \
|
|
|
|
} while (0)
|
|
|
|
|
|
|
|
/* Since gas and gld are standard on NetBSD, we don't need these */
|
|
|
|
#undef ASM_FINAL_SPEC
|
|
|
|
#undef STARTFILE_SPEC
|