Bug 11986

Summary: Document TARGET_ variables
Product: buildroot Reporter: XonqNopp <xonqnoppp>
Component: OtherAssignee: unassigned
Status: RESOLVED MOVED    
Severity: enhancement CC: buildroot, jose, yann.morin.1998
Priority: P5    
Version: unspecified   
Target Milestone: ---   
Hardware: All   
OS: Linux   
Host: Target:
Build:

Description XonqNopp 2019-06-26 12:00:56 UTC
It is really difficult to know if, when creating a custom package, we should use TARGET_MAKE_ENV and/or TARGET_CONFIGURE_OPTS (and maybe other hidden variables I am not aware of...). It would help to document them. Moreover, it is in some lines of code example, but not mention in documentation itself...
Comment 1 Jose Angel Torres 2023-09-11 18:37:41 UTC
(In reply to XonqNopp from comment #0)

Hi XonqNopp,

Did you get some clarity on this since you have posted this bug?
Has the documentation improved to meet your present day understanding?
What can we do to satisfy your original request at this point so that we may close this issue?

I'm willing to help improve this bit.

Sincerely,
Jose
Comment 2 XonqNopp 2023-09-12 04:52:07 UTC
Hi Jose,

Thanks for checking old tickets :-)

TARGET_MAKE_ENV and TARGET_CONFIGURE_OPTS are still only in examples, but not explained in the documentation itself...

From today's https://buildroot.org/downloads/manual/manual.html

Section 18.6.1

16: define LIBFOO_BUILD_CMDS
17:     $(MAKE) $(TARGET_CONFIGURE_OPTS) -C $(@D) all
18: endef

Section 18.22.1

11: define FOO_BUILD_CMDS
12:     $(TARGET_MAKE_ENV) $(MAKE) -C $(LINUX_DIR)/tools foo
13: endef
14:
15: define FOO_INSTALL_STAGING_CMDS
16:     $(TARGET_MAKE_ENV) $(MAKE) -C $(LINUX_DIR)/tools \
17:             DESTDIR=$(STAGING_DIR) \
18:             foo_install
19: endef
20:
21: define FOO_INSTALL_TARGET_CMDS
22:     $(TARGET_MAKE_ENV) $(MAKE) -C $(LINUX_DIR)/tools \
23:             DESTDIR=$(TARGET_DIR) \
24:             foo_install
25: endef

So it is still not clear what is their purpose and how to use them.

I would assume that TARGET_MAKE_ENV contains some environment settings to run the target's make command, but it is only an assumption. It would help if it was explained somewhere, and also if the (or at least one) default value is shown to better understand what those 2 variables do...

Since then I am now more experienced with buildroot and found my way to achieve what I wanted to do, so I cannot say for sure what we should write, because I do not remember exactly what and how I did (I should have written that directly in this ticket, sorry). I just found a comment in a makefile I wrote for a custom package. Where I define MYPACKAGE_BUILD_CMDS, I just wrote a comment saying "Do not use TARGET_CONFIGURE_OPTS as it would override options we do not want" but I don't remember why.

Cheers!
Comment 3 Yann E. MORIN 2024-06-15 14:50:00 UTC
Thank you for your report.

The issue tracker for the Buildroot project has been moved to
the Gitlab.com issue tracker:
    https://gitlab.com/buildroot.org/buildroot/-/issues

We are taking this opportunity to close old issues in this old
tracker. If you believe your issue is still relevant, please
open one in the new issue tracker.

Thank you!