Get Makefile to conform to GNU Makefile conventions, and be better#26
Get Makefile to conform to GNU Makefile conventions, and be better#26ndim wants to merge 1 commit intocowsay-org:mainfrom
Conversation
|
I like it! Would you mind squashing this to a single commit? (I could do this myself, but not sure it would preserve author credit, and you can pick the commit message for the single commit.) Also, I dunno about this extra in-line spacing here: I don't think I've seen that before? Is this standard/conventional? |
Can you tell me a little more about this? I was unaware of this cp/umask issue, and this seems like something I should actually be familiar with. |
I ran into this with the Fedora cowsay package. The Fedora package ships a separate This ends up with a OK, so so the "operating system then applies either the umask"... but when installing files I want the installed file to have well defined permissions, and not depend on whatever umask happens to be set, or the source file's filesystem permissions. So if there is this |
c4afe5a to
fd8a059
Compare
|
I have three branches now with identical trees, any of which I can force-push to this PR's
I have just force-pushed the squashed variant to here, but I can force-push any of them to here. |
|
I have just added commit bfb65fd to the series, and squashed it into the squashed branch and re-created the merged branch. That commit creates an empty |
Ah! I learned something today. This install vs. cp thing makes sense to me now. Yeah, let's go with IIRC,
Yeah, please change it to the minimized whitespace variant. I can see why the tabular-style extra whitespace form can be nice. But it's not what I've seen in most other GNU style Makefiles. And I find it a little harder to read myself; I think I tend to scan each line as a command in turn, instead of viewing it all as a tabular structure. OverallThe new squashed commit is looking good to me! I like that version of the commit history best of the branches you linked. I'll test this out. Redo the whitespace please and I think we're ready to merge here. |
Negative. |
Ready on my part, then. |
Ah, I'm thinking of old behavior (that maybe only was in some *nix variants?). Found this in macOS's BSD |
Hmm. Change the I vaguely remember having seen that somewhere, but I couldn't find what |
|
I have changed the If automake does that by default for wider compatibility, that looks like a very good example to follow. |
I agree with this reasoning. |
|
This is looking good to me now! I added one last comment/question about the uninstallation process's handling of some directories which may interact with other packages or site-local configuration. |
|
This PR doesn't have much in the way of end-user-facing stuff, but like you say, it could be nice for downstream package maintainers, so once this hits It's been long enough since a new release anyway. |
|
Hi! Sorry for being so slow here. If you still want to get this merged, would you mind rebasing on |
|
Give me a sec. |
aabafc8 to
57b6761
Compare
This makes the Makefile a bit more conforming to the GNU Makefile
conventions, more robust and more flexible.
* Fix: "make uninstall" removes the cows/ dir from its actual location
* Fix: Allow repeated "make install" runs to succeed instead of
failing to create a symlink which already exists.
* Add a standard default target "all" which does nothing at this time
* "make uninstall" remove only the cow files we "make install", i.e.
stop removing files we did not install
* "make uninstall" removes all cowsay specific directories (if empty
and if a directory in its path is called "/cowsay")
* Define and use make variables for definitions used more than
once like e.g. $(cowsdir) $(sitecowsdir) $(docdir)
* Use make variables for tools like e.g. $(LN_S) $(AWK) $(INSTALL_DIRS)
* Only install cow files called *.cow. Prevents e.g. editor backup
files like *.cow~ or unsupported (as of yet) *.pm format cow files
from being installed.
* Install empty %{sysconfdir}/cowsay/cowpath.d directory (cowpathdir)
* Use "install -c" for backwards compatibility with ancient "install"
|
Rebased, ready to be merged. And after that merge, #45 will be waiting to be merged. |
|
Merged in b52012d. (I did a manual cherry-pick in git, instead of merging this PR in GitHub, to do additional testing etc before merging.) Thanks for your contribution and patience here! I think this, in combination with other recent changes, may have fixed the "installation under /usr is broken" problem. Since pulling this in, installs to May also help with the Arch packaging for #49? I'll have a look at #45 once the Arch packaging is fixed up. |
|
The if ($real_prefix_dir eq "/usr") {
$etc_dir = "/etc";
} else {
$etc_dir = "$real_prefix_dir/etc";
}but the installation Makefile does not reflect that: The Makefile expects you to specify that exception via As there is no "build" step in the Makefile which might substitute those values of As there are systems which actually use The cowsay script ignoring As a workaround/hotfix/heuristic, in the absense of a way to substitute directories into the |
|
Oh, shoot. I missed that bit when debugging this, and yeah, special-casing I don't think this should be breaking current functionality, though, because I think the only thing that
My inclination is similar: treat And for the long term, remove the treatment of I should probably do some reading about what the Linux Filesystem Hierarchy Standard and BSD docs have to say about the particulars here. |
|
I made an issue for the etc and prefix detection stuff: #55 |
|
Here's a small thing. I don't know if the The asciidoctor action for the That I think these are man page "aliases", and this is an intentional behavior of asciidoc/asciidoctor, and should maybe stick with it. See:
From the latter:
From https://unix.stackexchange.com/questions/531213/man-page-aliases, it looks like the special alias form is a man/groff macro that has it read in the main file. I'm leaning toward sticking with the alias man page instead of a symlink, since that seems more in line with what the toolchain does. |
|
So I run "make man" to rebuild the man page files with the latter file containing Now I run If I This shows that either the exact Using a symlink on |
…ke man`, too The `.so` macro page produced by asciidoctor doesn't work right on some systems, including macOS and FreeBSD, and some Linuxes. See discussion starting at: #26 (comment)
|
Switched back to symlink for cowthink.1 in 86fdd9b. |
…ke man`, too The `.so` macro page produced by asciidoctor doesn't work right on some systems, including macOS and FreeBSD, and some Linuxes. See discussion starting at: #26 (comment)
|
Say... I gave you a shout-out in the 3.8.3 release notes, since you made a significant contribution here. Is there a particular way you'd like to be referred to in notes like that (i.e., nickname / email / GH username / actually-please-don't-mention-me)? And would you like to be included in the new CONTRIBUTORS.md file? |
Ah. Nice. Thank you. My preferred way to be referenced for notes like that is what my git commit author/committer is: "Hans Ulrich Niedermann hun@n-dimensional.de". Where that is too long, please shorten to "H. U. Niedermann" or "Hans Ulrich" or "ndim", and for the |
|
Cool. Added you to CONTRIBUTORS.md in a squash commit here: 096afe6. |



This fixes bugs like trying removing the wrong directory, introduces some make variables to help with DRY, stops installing cow files cowsay cannot handle and possibly non-cow files, allows installation preserving file timestamps on install, replaces the installed cowthink.1 with a symlink, etc.
This also allows packagers to preserve file timestamps at "make install" time by setting
INSTALL_DATA="install -p -m 0644"andINSTALL_PROGRAM="install -p"or maybe justINSTALL="install -p", and it also stops installing files using cp which respects umask.Overall, this would make it possible for e.g. the Fedora cowsay package to drop the custum install code.