Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a new 'group' type target that will transparently pass configuration to dependent targets #48

Open
ethouris opened this issue Nov 7, 2024 · 0 comments

Comments

@ethouris
Copy link
Owner

ethouris commented Nov 7, 2024

The group target should be able to be added whatever possible keys should be defined for any type of target.

The group type target is never installable and doesn't generate any rules for the makefile. The only thing you can do with it is to define flags that will be propagated to whatever target you declare its dependency.

For example, you can define the following:

ag debug -type group -cflags -- -ggdb3 -O0
...
ag lib1 -type library -sources $SOMETHING -depends debug
ag prog -type program -sources $PROGRAM -depends lib1 debug
ag prog2 -type program -sources $PROGRAM2 -depends lib1

Expected is that this result in the following equivalent:

ag lib1 -type library -sources $SOMETHING -cflags -- -ggdb3 -O0
ag prog -type program -sources $PROGRAM -depends lib1 -cflags -- -ggdb3 -O0
ag prog2 -type program -sources $PROGRAM2 -depends lib1

NOTES:

  • the dependency added to another target makes its all database keys applied onto the target.
  • the dependency on another group of a group makes this group derive its flags (so the group-to-group dependencies must be resolved first and the temporary database state must be likely created by removing a dependent group from the dependency list after copying its keys)
  • a group can be dependent, but only on another group
  • a group dependency is not derived - only the direct dependency is applied
  • cumulative keys get flags added in the order of dependency (dependent flag values precede explicit ones)
  • assignable keys cause conflicts (keys that are assignable must be specified explicitly with assignment if needed to override the derived one)
  • optional keys are overridden
  • some types of keys are not allowed to be applied for groups - these are specific keys, like libspec for libraries or usein for custom

Groups are more-less like profiles, except that while profiles apply to every target that matches the language (or all targets, if general), groups apply settings explicitly and on demand.

CONSIDER: Groups may also have an exceptional key type -language, which defines to which language they apply. This means that you can also create integrated groups that join flags defined for different languages. The default value for the language is general, that is, it applies always. If a group has defined a language limitation, then its all other keys apply only for targets that match the target's language. This may complicate the way of resolving the flags recursively. A warning may be issued for a case when a group with limited language has been applied directly to a target that has a different language, or is not of compiled target type (program or library).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant