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

Makefile: Create dynamic build targets #1438

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

gogolok
Copy link
Contributor

@gogolok gogolok commented Dec 8, 2024

Summary

Use a Makefile function to create dynamic build targets so it's simple to add new GOOS/GOARCH combinations if required. The duplication of Makefile code is reduced.

Related

#1171

Context

My 'overall goal' is still to get some FreeBSD support as attempted in #1271 and #1087 .

I thought it might make sense to help out with #1171 and come up with a simpler Makefile so that other GOOS/GOARCH can be added more easily. I'm not a Makefile expert.

I've left windows out since it might get removed soon.
I've left out the darwin build targets for the time being.

Other Makefile targets like the package targets can be implemented in a similar way once this attempt is accepted of being worth it.

I wonder (and this contradicts this attempt in this PR) whether the Makefile should just work with GOOS and GOARCH set outside the Makefile and the .github workflows to create releases should actually have several make build (or make package or ...) runs to create individual binaries/packages/whatsoever.

For this PR and the attempt at making the Makefile more dynamic I see the following advantages and disadvantages:

Advantages

  • Code duplication is reduced.
  • No separate *.mk files.

Disadvantages

  • It might be harder to understand the new Makefile logic.
  • It seems like there is no 'Makefile feature' to review the 'first pass' of the Makefile. It would be nice to see the new targets the new function actually generates. At least I'm not aware of such a Makefile feature.

@gogolok gogolok requested a review from a team as a code owner December 8, 2024 23:51
@jabrown85
Copy link
Contributor

Nice - I'm not sure which approach I prefer either. I think I'm fine with either approach having only seen the diff for the dynamic one here.

This PR will have to wait until we've release a last windows lifecycle release in the next week or two.

@gogolok gogolok force-pushed the create_dynamic_build_targets branch from c813b1c to 2a95f27 Compare December 12, 2024 13:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants