{"action":"created","issue":{"url":"https://api.github.com/repos/RichiH/vcsh/issues/167","labels_url":"https://api.github.com/repos/RichiH/vcsh/issues/167/labels{/name}","comments_url":"https://api.github.com/repos/RichiH/vcsh/issues/167/comments","events_url":"https://api.github.com/repos/RichiH/vcsh/issues/167/events","html_url":"https://github.com/RichiH/vcsh/pull/167","id":86055378,"number":167,"title":"Makefile Portability and Safety Improvements","user":{"login":"leycec","id":217028,"avatar_url":"https://avatars.githubusercontent.com/u/217028?v=3","gravatar_id":"","url":"https://api.github.com/users/leycec","html_url":"https://github.com/leycec","followers_url":"https://api.github.com/users/leycec/followers","following_url":"https://api.github.com/users/leycec/following{/other_user}","gists_url":"https://api.github.com/users/leycec/gists{/gist_id}","starred_url":"https://api.github.com/users/leycec/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/leycec/subscriptions","organizations_url":"https://api.github.com/users/leycec/orgs","repos_url":"https://api.github.com/users/leycec/repos","events_url":"https://api.github.com/users/leycec/events{/privacy}","received_events_url":"https://api.github.com/users/leycec/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":13,"created_at":"2015-06-08T06:59:13Z","updated_at":"2015-06-13T07:19:58Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/RichiH/vcsh/pulls/167","html_url":"https://github.com/RichiH/vcsh/pull/167","diff_url":"https://github.com/RichiH/vcsh/pull/167.diff","patch_url":"https://github.com/RichiH/vcsh/pull/167.patch"},"body":"This pull request addresses a depressing cornucopia of pressing Makefile issues, fixing #152 (and probably more) and subsuming pull requests #100 and arguably #145 (and probably more).\r\n\r\nFor the good of all that is portable and safe, let's get to it.\r\n\r\n## A Few Problems\r\n\r\nThe laundry list of dirty ills includes:\r\n\r\n* Installation requires unit tests to be run, thus requiring a [full Perl installation](#152) complete with the `Test::Most` and `Shell::Command` modules **despite `vcsh` itself not requiring Perl**.\r\n* Installation requires man pages to be generated, thus requiring [`ronn` and hence Ruby](#145) **despite `vcsh` itself not requiring Ruby**.\r\n* Zsh completions are installed to the [Debian-specific directory](http://www.zsh.org/mla/workers/2013/msg00622.html) `$(PREFIX)/share/zsh/vendor-completions` **regardless of whether Zsh is even installed**.\r\n* Standard directories (e.g., `$(PREFIX)/bin`) are unsafely created when not found. If `/usr/bin` no longer exists, **something is horribly wrong**. Silently creating that directory (probably without the correct ownership or permissions) and blithely stumbling on as if everything is [hunky dory](https://www.youtube.com/watch?v=YQTENuQYgjM) is *not* the sane response.\r\n* Standard directories are hardcoded rather than exposed to the user as overridable variables (e.g., `$(PREFIX)/bin` rather than `$(BINDIR)`), contravening [GNU makefile conventions](https://www.gnu.org/prep/standards/html_node/Directory-Variables.html) and complicating the quiet, desperate lives of downstream packagers.\r\n* Abstract makefile targets (i.e., targets with no existing path of the same basename) are *not* listed in the `.PHONY` pseudo-target. While this isn't currently a concern, it is a plausible [ticking time bomb](https://www.gnu.org/software/make/manual/html_node/Phony-Targets.html) should any path with the same basename as an existing target be added to the `vcsh` codebase. \r\n\r\n## A Few Solutions\r\n\r\nOur laundry list of sanitary fixes includes:\r\n\r\n* **Divorcing installation from unit test running and man page generation.** Unit tests remain runnable via `make test` and man pages generable via `make manpages`, but neither are required to install `vcsh` anymore. For sanity, any man pages that *have* been generated will still be installed when `sudo make install` is run. That's nice.\r\n* **Zsh completions are installed to the [platform-agnostic directory](http://zsh.sourceforge.net/releases.html)** `$(PREFIX)/share/zsh/site-functions` *only* if that directory and hence Zsh is installed.\r\n* **Installation halts with a fatal error if any standard directory does not already exist.** Specifically, all such directories are explicitly suffixed by `/` when passed to `install`.\r\n* **Standard directories are exposed to the user as overridable variables** with conventional names (e.g., `$(BINDIR)`, `$(MANDIR)`). \r\n* **Abstract makefile targets are listed in the `.PHONY` pseudo-target.**\r\n\r\nAlso, all targets now have human-readable comments.\r\n\r\nThe gnomes have learned a new way to say, [\"Hooray!\"](https://www.youtube.com/watch?v=em4Yl8qIm9Q) :ghost: "},"comment":{"url":"https://api.github.com/repos/RichiH/vcsh/issues/comments/111684154","html_url":"https://github.com/RichiH/vcsh/pull/167#issuecomment-111684154","issue_url":"https://api.github.com/repos/RichiH/vcsh/issues/167","id":111684154,"user":{"login":"leycec","id":217028,"avatar_url":"https://avatars.githubusercontent.com/u/217028?v=3","gravatar_id":"","url":"https://api.github.com/users/leycec","html_url":"https://github.com/leycec","followers_url":"https://api.github.com/users/leycec/followers","following_url":"https://api.github.com/users/leycec/following{/other_user}","gists_url":"https://api.github.com/users/leycec/gists{/gist_id}","starred_url":"https://api.github.com/users/leycec/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/leycec/subscriptions","organizations_url":"https://api.github.com/users/leycec/orgs","repos_url":"https://api.github.com/users/leycec/repos","events_url":"https://api.github.com/users/leycec/events{/privacy}","received_events_url":"https://api.github.com/users/leycec/received_events","type":"User","site_admin":false},"created_at":"2015-06-13T07:19:58Z","updated_at":"2015-06-13T07:19:58Z","body":"> As i don't know what will go where: Can I still keep the test and manpage behaviour the same in both Makefiles in one branch if you do that? As there are a lot of OS X users I need that.\r\n\r\nExcellent question. Ideally, yes. At the moment, I'm unsure how to reliably write the corresponding logic in BSD `make`-compatible syntax. That's *not* necessarily a bad thing. Here's how this all plays out.\r\n\r\nThe existing `Makefile` has been split into a new `GNUmakefile` and a new `BSDmakefile`, as discussed. The former has been \"conditionalized\" to run unit tests and generate and install man pages in an intelligent manner; the latter retains the prior unconditional logic and hence *always* runs unit tests and generates and installs man pages.\r\n\r\nOS X users should, therefore, see no change in installation behaviour – unless they manually install GNU `make` (e.g., via `brew`, which isn't terribly arduous). Linux users will, on the other hand, enjoy the fruits of our sweaty labour. In either case, `vcsh` still installs as expected. It just installs a bit more *cleverly* under GNU `make`."}}