site

bvnf.space sources
Log | Files | Refs

commit 3b6552d6382612adeb041bf6c296a0ecd73748ab
parent 8c7bdd3997ceb2955733e789faa654463235f0ee
Author: aabacchus <ben@bvnf.space>
Date:   Wed, 28 Dec 2022 19:15:29 +0000

blog: escape html chars

Diffstat:
Mblog/008-sudo-make-install.html | 8++++----
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/blog/008-sudo-make-install.html b/blog/008-sudo-make-install.html @@ -24,7 +24,7 @@ <p>To permit installing neatroff to the system, the sed call changes <code>fontpath $(PWD)/fonts</code> to <code>fontpath $(BASE)/fonts</code>:</p> <pre><code>@for f in "$(BASE)/devutf"/*; do \ - sed "/^fontpath /s=$(PWD)/fonts=$(BASE)/fonts=" <$$f >.fd.tmp \ + sed "/^fontpath /s=$(PWD)/fonts=$(BASE)/fonts=" &lt;$$f &gt;.fd.tmp \ mv .fd.tmp $$f \ done</code></pre> @@ -55,11 +55,11 @@ done</code></pre> <p>Now, anywhere in the Makefile that uses <code>$(PWD)</code> gets sent to the shell as <code>${PWD}</code>, which is fine.</p> <p>There's one last problem: the change from using <code>$(PWD)</code>, which is dereferenced by make, to <code>$$PWD</code>, which is dereferenced by the shell running each rule line, caused another problem with lines like</p> -<pre><code>@cd neatmkfn && ./gen.sh "$(PWD)/fonts" "$(PWD)/devutf" >/dev/null +<pre><code>@cd neatmkfn &amp;&amp; ./gen.sh "$(PWD)/fonts" "$(PWD)/devutf" &gt;/dev/null </code></pre> <p>which <code>cd</code> somewhere before doing something. They get <code>$PWD</code> of the shell in the new directory, but we want the old directory (the <code>$PWD</code> of the Makefile). I thought the most simple way to fix this was with a shell variable, like</p> -<pre><code>@pwd="$(PWD)" && \ - cd neatmkfn && ./gen.sh "$$pwd/fonts" "$$pwd/devutf" >/dev/null +<pre><code>@pwd="$(PWD)" &amp;&amp; \ + cd neatmkfn &amp;&amp; ./gen.sh "$$pwd/fonts" "$$pwd/devutf" &gt;/dev/null </code></pre> <p>This is a little bit annoying but it is done to preserve the portability of the Makefile (it is POSIX.1-2017 compliant). Both GNU and BSD make have syntaxes for immediate-expansion macro definitions. These would fix this problem because it would save the string of the current working directory into <code>$(PWD)</code>, rather than a kind of nested macro which gets dereferenced later. (Note that the syntax is mostly incompatible between GNU and BSD make).</p>