790 lines
21 KiB
Perl
790 lines
21 KiB
Perl
#!/usr/gnu/bin/perl
|
|
#
|
|
# $NetBSD: gcc2netbsd,v 1.13 1996/10/18 03:00:20 thorpej Exp $
|
|
#
|
|
# 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"
|
|
|
|
@archlist = ("arm32", "i386", "m68k", "mips", "ns32k", "sparc", "vax");
|
|
|
|
@obver = ("obstack.c", "version.c");
|
|
|
|
@archf = ("netbsd.h", "xm-netbsd.h");
|
|
|
|
@ccf = ("gcc.c");
|
|
|
|
@ccof = ("gcc.1");
|
|
|
|
@cc1f = ("c-lang.c");
|
|
|
|
@cc1of = ();
|
|
|
|
@cc1objf = ("objc-act.c");
|
|
|
|
@cc1objof = ("objc-tree.def", "objc-act.h", "objc-parse.y");
|
|
|
|
@cc1plusf = ("call.c", "decl.c", "errfn.c", "expr.c", "pt.c", "sig.c",
|
|
"typeck2.c", "class.c", "decl2.c", "error.c", "gc.c",
|
|
"lex.c", "ptree.c", "spew.c", "typeck.c",
|
|
"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",
|
|
"lex.h", "input.c", "parse.y");
|
|
|
|
@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",
|
|
"bc-typecd.h", "bi-defs.h", "bi-run.h",
|
|
"bytecode.h", "bytetypes.h", "c-gperf.h", "c-lex.h",
|
|
"c-parse.y", "c-pragma.h", "c-tree.h", "conditions.h",
|
|
"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",
|
|
"tree.h", "typeclass.h", "xcoffout.h", "bi-parser.y");
|
|
|
|
@commonplus = ("lang-specs.h", "lang-options.h");
|
|
|
|
@genf = ("bi-opcode.c", "bi-arity.c", "bi-opname.c",
|
|
"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" );
|
|
|
|
|
|
@cppf = ("cccp.c");
|
|
|
|
@cppof = ("pcp.h", "cexp.y");
|
|
|
|
@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 "; };
|
|
print ODATA "c-parse.h\n\n";
|
|
|
|
foreach $n (@genh) {
|
|
print ODATA "insn-$n.h: gen$n \$(MD)\n";
|
|
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) {
|
|
print ODATA "bc-$n.h: bi-$n \$(BCDEF)\n";
|
|
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) {
|
|
print ODATA "insn-$n.c: gen$n\n \$(MD)";
|
|
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 ...
|
|
print ODATA
|
|
"CLEANFILES += bi-lexer.o bi-parser.o bi-parser.c bi-parser.h\n\n";
|
|
}
|
|
|
|
#
|
|
# 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");
|
|
|
|
print "Populating the top level directory.\n";
|
|
©files ($srcdir, $targetdir, "COPYING");
|
|
|
|
print "Populating the cc directory.\n";
|
|
©files ($srcdir, "$targetdir/cc", @ccf, @ccof);
|
|
|
|
print "Populating the cc1 directory.\n";
|
|
©files ($srcdir, "$targetdir/cc1", @cc1f, @cc1of);
|
|
|
|
print "Populating the cc1obj directory.\n";
|
|
©files ($srcdir, "$targetdir/cc1obj", @cc1objf, @cc1objof);
|
|
|
|
print "Populating the cc1plus directory.\n";
|
|
©files ("$srcdir/cp", "$targetdir/cc1plus", @cc1plusf, @cc1plusof);
|
|
|
|
print "Populating the common directory.\n";
|
|
©files ($srcdir, "$targetdir/common", @commonf, @commonof, @genf);
|
|
©files ("$srcdir/cp", "$targetdir/common", @commonplus);
|
|
|
|
print "Populating the cpp directory.\n";
|
|
©files ($srcdir, "$targetdir/cpp", @cppf, @cppof);
|
|
system ("cp $srcdir/cccp.1 $targetdir/cpp/cpp.1");
|
|
|
|
print "Populating the g++ directory.\n";
|
|
©files ("$srcdir/cp", "$targetdir/g++", @gplusf, @gplusof);
|
|
|
|
print "Populating the libgcc directory.\n";
|
|
©files ("$srcdir", "$targetdir/libgcc", @libgccf, @libgccof);
|
|
|
|
print "Populating the libobjc directory.\n";
|
|
©files ("$srcdir/objc", "$targetdir/libobjc", @libobjcf, @libobjcof);
|
|
|
|
|
|
#
|
|
# 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") {
|
|
&dumpsrcs (@cc1f, "c-parse.c");
|
|
} elsif ($cmd[2] eq "cc1plus") {
|
|
&dumpsrcs (@cc1plusf, "parse.c");
|
|
} elsif ($cmd[2] eq "cc1obj") {
|
|
&dumpsrcs (@cc1objf, "objc-parse.c");
|
|
} elsif ($cmd[2] eq "cpp") {
|
|
&dumpsrcs (@cppf, "cexp.c", @obver);
|
|
} 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;
|
|
} elsif ($cmd[1] eq "NetBSD") {
|
|
if ($first) {
|
|
die "Data section must start with a %% file!";
|
|
}
|
|
print ODATA "# \$"."NetBSD".": \$\n";
|
|
}
|
|
} 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
|
|
%% NetBSD
|
|
|
|
SUBDIR= common cc cpp cc1 cc1plus cc1obj g++ libgcc libobjc
|
|
|
|
.include <bsd.subdir.mk>
|
|
%% file Makefile.cc1
|
|
%% NetBSD
|
|
|
|
NOMAN=
|
|
|
|
BINDIR= /usr/libexec
|
|
|
|
XXXX!= cd $(.CURDIR)/../common; \
|
|
printf "xxxx:\n\techo -I\$${.OBJDIR}\n" | ${MAKE} -r -s -f - xxxx
|
|
|
|
CFLAGS+=-I. -I${.CURDIR} -I${.CURDIR}/../common -I${.CURDIR}/../arch \
|
|
-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
|
|
|
|
${PROG}: ${LIBCC1}
|
|
|
|
.include <bsd.prog.mk>
|
|
%% file common/Makefile
|
|
%% NetBSD
|
|
|
|
LIB= cc1
|
|
|
|
NOMAN=
|
|
NOPIC=
|
|
NOPROFILE=
|
|
|
|
XXXX != cd $(.CURDIR)/../common; \
|
|
printf "xxxx:\n\techo -I\$${.OBJDIR}\n" | ${MAKE} -r -s -f - xxxx
|
|
|
|
CFLAGS+=-I${.CURDIR} -I${.CURDIR}/../arch \
|
|
-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
|
|
|
|
bi-lexer.o: bi-parser.h
|
|
|
|
bi-parser.h: bi-parser.c
|
|
bi-parser.c: bi-parser.y
|
|
$(YACC) -b bi -d $(.IMPSRC)
|
|
mv -f bi.tab.c bi-parser.c
|
|
mv -f bi.tab.h bi-parser.h
|
|
|
|
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
|
|
$(YACC) -b c -d $(.IMPSRC)
|
|
mv -f c.tab.c c-parse.c
|
|
mv -f c.tab.h c-parse.h
|
|
|
|
install:
|
|
|
|
.include <bsd.lib.mk>
|
|
|
|
%% file cc/Makefile
|
|
# from: @(#)Makefile 6.2 (Berkeley) 3/25/91
|
|
%% NetBSD
|
|
|
|
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
|
|
%% NetBSD
|
|
|
|
PROG= cc1
|
|
|
|
%% srcs cc1
|
|
|
|
CLEANFILES+= c-parse.c
|
|
|
|
.PATH: ${.CURDIR}/../common
|
|
|
|
.include <../Makefile.cc1>
|
|
%% file cc1plus/Makefile
|
|
%% NetBSD
|
|
|
|
PROG= cc1plus
|
|
|
|
%% srcs cc1plus
|
|
|
|
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
|
|
|
|
.include <../Makefile.cc1>
|
|
%% file cc1obj/Makefile
|
|
%% NetBSD
|
|
|
|
PROG= cc1obj
|
|
|
|
%% srcs cc1obj
|
|
|
|
CLEANFILES+= objc-parse.c
|
|
|
|
.PATH: $(.CURDIR)/../cc1
|
|
|
|
.include <../Makefile.cc1>
|
|
%% file cpp/Makefile
|
|
# from: @(#)Makefile 6.4 (Berkeley) 2/21/91
|
|
%% NetBSD
|
|
|
|
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
|
|
|
|
CLEANFILES+= cexp.c
|
|
|
|
.PATH: $(.CURDIR)/../common
|
|
|
|
afterinstall:
|
|
${INSTALL} -c -o $(BINOWN) -g $(BINGRP) -m $(BINMODE) \
|
|
$(.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
|
|
%% NetBSD
|
|
|
|
PROG= g++
|
|
%% srcs g++
|
|
MAN= g++.1
|
|
BINDIR= /usr/bin
|
|
CFLAGS+= -I$(.CURDIR) -I$(.CURDIR)/../common \
|
|
-I$(.CURDIR)/../arch -I$(.CURDIR)/../arch/$(MACHINE_ARCH) \
|
|
-DGCC_NAME=\"/usr/bin/cc\"
|
|
LDADD+= -lgnumalloc
|
|
DPADD+= /usr/lib/libgnumalloc.a
|
|
|
|
LINKS+= ${BINDIR}/g++ ${BINDIR}/c++
|
|
MLINKS= g++.1 c++.1
|
|
|
|
.PATH: $(.CURDIR)/../common
|
|
|
|
.include <bsd.prog.mk>
|
|
%% file libgcc/Makefile
|
|
%% NetBSD
|
|
|
|
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
|
|
|
|
.if (${MACHINE_ARCH} == "m68k") || (${MACHINE_ARCH} == "i386")
|
|
LIB2OBJS+=_fixxfdi.o _fixunsxfdi.o _floatdixf.o _fixunsxfsi.o
|
|
.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
|
|
%% NetBSD
|
|
|
|
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
|
|
#include <mips/xm-mips.h>
|
|
#include <xm-netbsd.h>
|