This is a discussion on [9fans] cross-compilation. - Plan9 ; > because > something had to be used to compile Plan 9 itself, etc and I figure it's > not being done as a cross-compiler). > -- ken thompson wrote a nice little C compiler. cross-compilation is trivial: if 8c ...
> because
> something had to be used to compile Plan 9 itself, etc and I figure it's
> not being done as a cross-compiler).
> --
ken thompson wrote a nice little C compiler.
cross-compilation is trivial: if 8c is the x86 compiler and qc is the power pc compiler, you get a cross
compiler from x86 to powerpc by compiling qc with 8c. unchanged. that's it.
no nest of peculiar configuration files just to make a given compiler into a cross-compiler.
to cross-compile the whole system for (say) PowerPC on any architecture, including itself, use
objtype=power mk install
on an x86, sparc, amd64, powerpc, ... . you can also build all of them in the same tree:
objtype=power mk install
objtype=386 mk install
objtype=arm mk install
and simultaneously. no peculiar `buildroot' environments. and so on.
the mkfiles are essentially configured for a target platform by /$objtype/mkfile.
here's /386/mkfile:
CC=8c
LD=8l
O=8
AS=8a
here's /power/mkfile:
CC=qc
LD=ql
O=q
AS=qa
and so on.
there are similarly a few lines of machine-specific includes in /$objtype/include and that's it: all of the system's
includes in /sys/include are completely portable.
wc -l /386/include/*.h
65 /386/include/u.h
25 /386/include/ureg.h
90 total
it's not just system source. if i include /sys/src/cmd/mkone in my own mkfile, and follow the
appropriate pattern, my own C software will build the same way. {mk installall} will build and install it
in my own bin directories, for all supported architectures.
it's complete cross-compilation not completely cross compilation