Skip to content
This repository was archived by the owner on Nov 3, 2023. It is now read-only.

Conversation

SamWhited
Copy link
Contributor

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.

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.
It appears that at some point someone was using println to debug this
package and left in a statement causing tests to print "4".
@ortuman
Copy link
Owner

ortuman commented Apr 15, 2020

LGTM! 👍

Merging

@ortuman ortuman merged commit 645a3a3 into ortuman:master Apr 15, 2020
@SamWhited SamWhited deleted the make_cleanup branch April 15, 2020 12:16
mmalesev pushed a commit to mmalesev/jackal that referenced this pull request Sep 29, 2021
@SamWhited
Copy link
Contributor Author

I was about to make basically this same commit, but then found that I already did it. I don't see this in the history at all anymore, however. Did it get dropped deliberately? I don't even see a revert or anything, it just looks like it was never merged.

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

Successfully merging this pull request may close these issues.

2 participants