Page MenuHomeFreeBSD

build.7: Clarify TARGET and TARGET_ARCH
AcceptedPublic

Authored by ziaee on Tue, Sep 30, 2:15 PM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Oct 9, 5:17 PM
Unknown Object (File)
Thu, Oct 9, 5:17 PM
Unknown Object (File)
Thu, Oct 9, 3:21 PM
Unknown Object (File)
Wed, Oct 8, 5:46 PM
Unknown Object (File)
Wed, Oct 1, 1:02 AM
Unknown Object (File)
Tue, Sep 30, 4:53 PM
Unknown Object (File)
Tue, Sep 30, 4:28 PM
Unknown Object (File)
Tue, Sep 30, 4:22 PM
Subscribers

Details

Summary

These varibles are interchangeable, except for powerpc. The best way I
think to make this clear in a durable way across future changes is to
just tell people to check make targets.

Reported by: kevans
MFC after: 3 days

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 67410
Build 64293: arc lint + arc unit

Event Timeline

ziaee requested review of this revision.Tue, Sep 30, 2:15 PM
This revision is now accepted and ready to land.Tue, Sep 30, 2:37 PM

So internally to the build system, MACHINE and MACHINE_ARCH are used. When cross building, for various technical reasons, you have to set TARGET and/or TARGET_ARCH. When one can be guessed from the other (as is the case for all architectures except powerpc), you need only set one, the other one will be inferred. For powerpc, setting TARGET_ARCH alone is sufficient, so maybe we should recommend that for all cases. I'd put a cross reference to arch(7) since MACHINE and MACHINE_ARCH, and their allowed values, are explained in detail. The make target only lists a subset of allowed values at times when we've deprecated some targets but haven't yet removed them .

However, there's one addition wrinkle, gotcha. When building NOT on FreeBSD (so on Linux or MacOS), we can't assume anything about the host and require that both be set. This is a limitation of the tools/build/make.py script that we use on those platforms to wrap FreeBSD's make since it sometimes needs to be bootstrapped first.

share/man/man7/build.7
789

I wouldn't add this. TARGET isn't required, and this makes it sound like it is required.

790

I'm not sure analogous is the right term.
It is exactly the uname -m. same with uname -p.

804

Also redundant. This was stated earlier.

816

I'd rather direct them at arch(7). It has the full list, with nuance. What does need to be said here is that TARGET corresponds to MACHINE and TARGET_ARCH corresponds to MACHINE_ARCH.