Page MenuHomeFreeBSD

Allow bsd.compat.mk to be reliably included outside Makefile.inc1.
ClosedPublic

Authored by brooks on Oct 16 2019, 5:31 PM.
Tags
None
Referenced Files
F103498116: D22059.diff
Mon, Nov 25, 6:54 PM
F103478008: D22059.id63409.diff
Mon, Nov 25, 1:18 PM
F103469355: D22059.id63815.diff
Mon, Nov 25, 10:43 AM
Unknown Object (File)
Sun, Nov 24, 2:14 PM
Unknown Object (File)
Sat, Nov 23, 10:47 PM
Unknown Object (File)
Sat, Nov 23, 4:08 PM
Unknown Object (File)
Fri, Nov 22, 3:23 PM
Unknown Object (File)
Fri, Nov 22, 10:02 AM
Subscribers

Details

Summary

Replace explicit TARGET_* variables with COMPAT_* versions defined based on where the file is being included.

Also, require that bsd.compat.mk be included directly. It's not going to be widely used so always loading it in bsd.prog.mk doesn't make sense. Instead users can include it directly.

Diff Detail

Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 27074
Build 25357: arc lint + arc unit

Event Timeline

Oops sorry for missing this before. TARGET_ are only useful in Makefile.inc1.

This revision is now accepted and ready to land.Oct 16 2019, 7:26 PM
imp requested changes to this revision.Oct 17 2019, 3:47 PM

The question is, do we need them to be TARGET_* in this makefile.inc1 usage?
I kinda think it does. Checking into *that* detail...

This revision now requires changes to proceed.Oct 17 2019, 3:47 PM
In D22059#482035, @imp wrote:

The question is, do we need them to be TARGET_* in this makefile.inc1 usage?
I kinda think it does. Checking into *that* detail...

I'm testing a refactor where we use TARGET_* with included from Makefile.inc1 (by checking that _LIBCOMPAT is defined) or MACHINE_ARCH/CPUTYPE elsewhere.

  • Get ARCH and CPUTYPE from contextually appropriate sources.
share/mk/bsd.prog.mk
5

We could chose to not include bsd.compat.mk here and require users to include it (after defining NEED_COMPAT/WANT_COMPAT). We'll probably need include it directly anyway to support more complicated programs like rtld.

In D22059#482035, @imp wrote:

The question is, do we need them to be TARGET_* in this makefile.inc1 usage?
I kinda think it does. Checking into *that* detail...

I had that thought but I don't think so. bsd.compat.mk is included from Makefiles at the point in the build where MACHINE=$TARGET and MACHINE_ARCH=$TARGET_ARCH from CROSSENV. buildlibcompat is a WMAKE_TGT so it should have these MACHINE= and MACHINE_ARCH= values set.

In D22059#482035, @imp wrote:

The question is, do we need them to be TARGET_* in this makefile.inc1 usage?
I kinda think it does. Checking into *that* detail...

I had that thought but I don't think so. bsd.compat.mk is included from Makefiles at the point in the build where MACHINE=$TARGET and MACHINE_ARCH=$TARGET_ARCH from CROSSENV. buildlibcompat is a WMAKE_TGT so it should have these MACHINE= and MACHINE_ARCH= values set.

Makefile.inc1 include Makefile.libcompat which includes bsd.compat.mk them without MACHINE=$TARGET. MACHINE/MACHINE_ARCH are still the host's at that point. It sets up the targets that are later used with MACHINE=TARGET etc. It's how it builds buildlibompat that's dependent on the target. We won't have a buildlibcompat since it's really:
build${libcompat}: .PHONY
and libcompat is set based on the target...

It's certianly at best confusing...

Any further comments on this version?

I don't see anything wrong. the discussion that bdrewery and I were having was that there may be a more optimal way.

share/mk/bsd.prog.mk
5

My lean is this way, since the need/want things are fairly specialized and of interest to only a few files.

This revision is now accepted and ready to land.Oct 30 2019, 7:56 PM
  • libstats: Fix ABI assertion.
  • Require that bsd.compat.mk be explicitly included and update docs.
This revision now requires review to proceed.Oct 30 2019, 10:29 PM
  • Apply patch that arc applied, but didn't submit?!?!
brooks marked an inline comment as done.
imp added inline comments.
sys/kern/subr_stats.c
128 ↗(On Diff #63816)

unrelated noise?

This revision is now accepted and ready to land.Oct 30 2019, 10:46 PM
brooks added inline comments.
sys/kern/subr_stats.c
128 ↗(On Diff #63816)

Bah, it turns out that if you update the wrong tree arc will happily mess everything up. Update coming shortly

brooks marked an inline comment as done.
  • Allow bsd.compat.mk to be reliably included outside Makefile.inc1.
  • Get ARCH and CPUTYPE from contextually appropriate sources.
  • Require that bsd.compat.mk be explicitly included and update docs.
This revision now requires review to proceed.Oct 30 2019, 11:04 PM
This revision is now accepted and ready to land.Oct 30 2019, 11:30 PM