This repository was archived by the owner on Nov 3, 2023. It is now read-only.
Rework Makefile to fix bugs and respect LDFLAGS #118
Merged
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.
Previously every rule in the makefile was phony, but none were declared
as such. This meant that eg. if a file called "clean" or "build" was
created, Make would think the rules with the same names referred to
those files and may think they were up to date and refuse to run the
recipe. Marking these rules as phony ensures that they are always
considered out of date and will always be run.
This also adds the .POSIX and .SUFFIXES targets to remove pre-defined C
suffix rules (its not likely that this would ever cause problems, but
it's nice to start from a clean slate) and use POSIX compatible behavior
(GNU Make is particularly bad about this, so using .POSIX normalizes the
behavior a tiny bit between GNU Make and NetBSD make like I use).
Finally, the build rule has been marked phony and now just depends on
the jackal (non-phony) rule which ensures that go.mod gets run when
necessary, and is rebuilt any time a *.go file changes. The build has
also been updated to trim paths so you don't wind up with release
binaries that include your home directory path in them for debugging
purposes and respect external LDFLAGS to make it easier for package
managers to spit out a position independent executable, or make other
changes that might be required by their operating system or distros
packaging procedures.