Makefile: Create dynamic build targets #1438
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Disadvantages