summaryrefslogtreecommitdiff
path: root/doc/guide/files/makefile.xml
diff options
context:
space:
mode:
Diffstat (limited to 'doc/guide/files/makefile.xml')
-rw-r--r--doc/guide/files/makefile.xml110
1 files changed, 55 insertions, 55 deletions
diff --git a/doc/guide/files/makefile.xml b/doc/guide/files/makefile.xml
index bb6848b0912..6ee143ce9ac 100644
--- a/doc/guide/files/makefile.xml
+++ b/doc/guide/files/makefile.xml
@@ -1,4 +1,4 @@
-<!-- $NetBSD: makefile.xml,v 1.22 2007/03/08 16:00:16 rillig Exp $ -->
+<!-- $NetBSD: makefile.xml,v 1.23 2007/06/01 11:07:25 rillig Exp $ -->
<chapter id="makefile"> <?dbhtml filename="makefile.html"?>
<title>Programming in <filename>Makefile</filename>s</title>
@@ -31,16 +31,16 @@
regenerated properly. Example:</para>
<programlisting>
- wrong:
- @echo "line 1" > ${.TARGET}
- @echo "line 2" >> ${.TARGET}
- @false
-
- correct:
- @echo "line 1" > ${.TARGET}.tmp
- @echo "line 2" >> ${.TARGET}.tmp
- @false
- @mv ${.TARGET}.tmp ${.TARGET}
+wrong:
+ @echo "line 1" > ${.TARGET}
+ @echo "line 2" >> ${.TARGET}
+ @false
+
+correct:
+ @echo "line 1" > ${.TARGET}.tmp
+ @echo "line 2" >> ${.TARGET}.tmp
+ @false
+ @mv ${.TARGET}.tmp ${.TARGET}
</programlisting>
<para>When you run <command>make wrong</command> twice, the file
@@ -163,16 +163,16 @@
<title>Adding things to a list</title>
<programlisting>
- STRING= foo * bar `date`
- INT_LIST= # empty
- ANOTHER_INT_LIST= apache-[0-9]*:../../www/apache
- EXT_LIST= # empty
- ANOTHER_EXT_LIST= a=b c=d
-
- INT_LIST+= ${STRING} # 1
- INT_LIST+= ${ANOTHER_INT_LIST} # 2
- EXT_LIST+= ${STRING:Q} # 3
- EXT_LIST+= ${ANOTHER_EXT_LIST} # 4
+STRING= foo * bar `date`
+INT_LIST= # empty
+ANOTHER_INT_LIST= apache-[0-9]*:../../www/apache
+EXT_LIST= # empty
+ANOTHER_EXT_LIST= a=b c=d
+
+INT_LIST+= ${STRING} # 1
+INT_LIST+= ${ANOTHER_INT_LIST} # 2
+EXT_LIST+= ${STRING:Q} # 3
+EXT_LIST+= ${ANOTHER_EXT_LIST} # 4
</programlisting>
<para>When you add a string to an external list (example 3), it
@@ -187,10 +187,10 @@
<title>Converting an internal list into an external list</title>
<programlisting>
- EXT_LIST= # empty
- .for i in ${INT_LIST}
- EXT_LIST+= ${i:Q}""
- .endfor
+EXT_LIST= # empty
+.for i in ${INT_LIST}
+EXT_LIST+= ${i:Q}""
+.endfor
</programlisting>
<para>This code converts the internal list
@@ -209,17 +209,17 @@
nastiness.</para>
<programlisting>
- STRING= foo bar < > * `date` $$HOME ' "
- EXT_LIST= string=${STRING:Q} x=second\ item
-
- all:
- echo ${STRING} # 1
- echo "${STRING}" # 2
- echo "${STRING:Q}" # 3
- echo ${STRING:Q} # 4
- echo x${STRING:Q} | sed 1s,.,, # 5
- printf "%s\\n" ${STRING:Q}"" # 6
- env ${EXT_LIST} /bin/sh -c 'echo "$$string"; echo "$$x"'
+STRING= foo bar < > * `date` $$HOME ' "
+EXT_LIST= string=${STRING:Q} x=second\ item
+
+all:
+ echo ${STRING} # 1
+ echo "${STRING}" # 2
+ echo "${STRING:Q}" # 3
+ echo ${STRING:Q} # 4
+ echo x${STRING:Q} | sed 1s,.,, # 5
+ printf "%s\\n" ${STRING:Q}"" # 6
+ env ${EXT_LIST} /bin/sh -c 'echo "$$string"; echo "$$x"'
</programlisting>
<para>Example 1 leads to a syntax error in the shell, as the
@@ -284,15 +284,15 @@
here is how we do it:</para>
<programlisting>
- CPPFLAGS= # empty
- CPPFLAGS+= -Wundef -DPREFIX=\"${PREFIX:Q}\"
- CPPFLAGS+= ${MY_CPPFLAGS}
+CPPFLAGS= # empty
+CPPFLAGS+= -Wundef -DPREFIX=\"${PREFIX:Q}\"
+CPPFLAGS+= ${MY_CPPFLAGS}
- CONFIGURE_ARGS+= CPPFLAGS=${CPPFLAGS:M*:Q}
+CONFIGURE_ARGS+= CPPFLAGS=${CPPFLAGS:M*:Q}
- all:
- echo x${CPPFLAGS:Q}x # leading and trailing whitespace
- echo x${CONFIGURE_ARGS}x # properly trimmed
+all:
+ echo x${CPPFLAGS:Q}x # leading and trailing whitespace
+ echo x${CONFIGURE_ARGS}x # properly trimmed
</programlisting></listitem>
<listitem><para>The example above contains one bug: The
@@ -313,17 +313,17 @@
same trick.</para>
<programlisting>
- EMPTY= # empty
- empty_test:
- for i in a ${EMPTY:Q} c; do \
- echo "$$i"; \
- done
-
- for_test:
- .for i in a:\ a:\test.txt
- echo ${i:Q}
- echo "foo"
- .endfor
+EMPTY= # empty
+empty_test:
+ for i in a ${EMPTY:Q} c; do \
+ echo "$$i"; \
+ done
+
+for_test:
+.for i in a:\ a:\test.txt
+ echo ${i:Q}
+ echo "foo"
+.endfor
</programlisting>
<para>The first example will only print two of the three lines
@@ -354,7 +354,7 @@
in <varname>${VAR}</varname> after this code executes.</para>
<programlisting>
- VAR:= ${VAR:N${_othervar_:C/-//}}
+VAR:= ${VAR:N${_othervar_:C/-//}}
</programlisting>
<para>For a more complex code snippet and a workaround, see the