diff options
author | johannst <johannst@users.noreply.github.com> | 2020-09-18 19:26:48 +0000 |
---|---|---|
committer | johannst <johannst@users.noreply.github.com> | 2020-09-18 19:26:48 +0000 |
commit | eaaab502c1a10032f4533ca013a39f1a83a7f82b (patch) | |
tree | f6b2caa434408095737aac8f43419d2b1243eba1 /print.html | |
parent | b9d85d61889c54ac83d8d93f2dd2427e882abab0 (diff) | |
download | notes-eaaab502c1a10032f4533ca013a39f1a83a7f82b.tar.gz notes-eaaab502c1a10032f4533ca013a39f1a83a7f82b.zip |
deploy: e4db48ab1528771851bc7260fd1cb56fcb3cc6c9
Diffstat (limited to 'print.html')
-rw-r--r-- | print.html | 94 |
1 files changed, 93 insertions, 1 deletions
@@ -83,7 +83,7 @@ <nav id="sidebar" class="sidebar" aria-label="Table of contents"> <div id="sidebar-scrollbox" class="sidebar-scrollbox"> - <ol class="chapter"><li class="expanded "><a href="tools/index.html"><strong aria-hidden="true">1.</strong> Tools</a></li><li><ol class="section"><li class="expanded "><a href="tools/zsh.html"><strong aria-hidden="true">1.1.</strong> zsh</a></li><li class="expanded "><a href="tools/bash.html"><strong aria-hidden="true">1.2.</strong> bash</a></li><li class="expanded "><a href="tools/fish.html"><strong aria-hidden="true">1.3.</strong> fish</a></li><li class="expanded "><a href="tools/tmux.html"><strong aria-hidden="true">1.4.</strong> tmux</a></li><li class="expanded "><a href="tools/git.html"><strong aria-hidden="true">1.5.</strong> git</a></li><li class="expanded "><a href="tools/awk.html"><strong aria-hidden="true">1.6.</strong> awk</a></li><li class="expanded "><a href="tools/emacs.html"><strong aria-hidden="true">1.7.</strong> emacs</a></li><li class="expanded "><a href="tools/gdb.html"><strong aria-hidden="true">1.8.</strong> gdb</a></li><li class="expanded "><a href="tools/radare2.html"><strong aria-hidden="true">1.9.</strong> radare2</a></li></ol></li><li class="expanded "><a href="monitor/index.html"><strong aria-hidden="true">2.</strong> Resource analysis & monitor</a></li><li><ol class="section"><li class="expanded "><a href="monitor/lsof.html"><strong aria-hidden="true">2.1.</strong> lsof</a></li><li class="expanded "><a href="monitor/pidstat.html"><strong aria-hidden="true">2.2.</strong> pidstat</a></li><li class="expanded "><a href="monitor/pgrep.html"><strong aria-hidden="true">2.3.</strong> pgrep</a></li><li class="expanded "><a href="monitor/pmap.html"><strong aria-hidden="true">2.4.</strong> pmap</a></li><li class="expanded "><a href="monitor/pstack.html"><strong aria-hidden="true">2.5.</strong> pstack</a></li></ol></li><li class="expanded "><a href="trace_profile/index.html"><strong aria-hidden="true">3.</strong> Trace and Profile</a></li><li><ol class="section"><li class="expanded "><a href="trace_profile/strace.html"><strong aria-hidden="true">3.1.</strong> strace</a></li><li class="expanded "><a href="trace_profile/ltrace.html"><strong aria-hidden="true">3.2.</strong> ltrace</a></li><li class="expanded "><a href="trace_profile/perf.html"><strong aria-hidden="true">3.3.</strong> perf</a></li><li class="expanded "><a href="trace_profile/oprofile.html"><strong aria-hidden="true">3.4.</strong> OProfile</a></li><li class="expanded "><a href="trace_profile/time.html"><strong aria-hidden="true">3.5.</strong> time</a></li></ol></li><li class="expanded "><a href="binary/index.html"><strong aria-hidden="true">4.</strong> Binary</a></li><li><ol class="section"><li class="expanded "><a href="binary/od.html"><strong aria-hidden="true">4.1.</strong> od</a></li><li class="expanded "><a href="binary/xxd.html"><strong aria-hidden="true">4.2.</strong> xxd</a></li><li class="expanded "><a href="binary/readelf.html"><strong aria-hidden="true">4.3.</strong> readelf</a></li><li class="expanded "><a href="binary/objdump.html"><strong aria-hidden="true">4.4.</strong> objdump</a></li><li class="expanded "><a href="binary/nm.html"><strong aria-hidden="true">4.5.</strong> nm</a></li></ol></li><li class="expanded "><a href="development/index.html"><strong aria-hidden="true">5.</strong> Development</a></li><li><ol class="section"><li class="expanded "><a href="development/c++filt.html"><strong aria-hidden="true">5.1.</strong> c++filt</a></li><li class="expanded "><a href="development/c++.html"><strong aria-hidden="true">5.2.</strong> c++</a></li><li class="expanded "><a href="development/glibc.html"><strong aria-hidden="true">5.3.</strong> glibc</a></li><li class="expanded "><a href="development/gcc.html"><strong aria-hidden="true">5.4.</strong> gcc</a></li><li class="expanded "><a href="development/ld.so.html"><strong aria-hidden="true">5.5.</strong> ld.so</a></li></ol></li><li class="expanded "><a href="arch/index.html"><strong aria-hidden="true">6.</strong> Arch</a></li><li><ol class="section"><li class="expanded "><a href="arch/x86_64.html"><strong aria-hidden="true">6.1.</strong> x86_64</a></li></ol></li></ol> + <ol class="chapter"><li class="expanded "><a href="tools/index.html"><strong aria-hidden="true">1.</strong> Tools</a></li><li><ol class="section"><li class="expanded "><a href="tools/zsh.html"><strong aria-hidden="true">1.1.</strong> zsh</a></li><li class="expanded "><a href="tools/bash.html"><strong aria-hidden="true">1.2.</strong> bash</a></li><li class="expanded "><a href="tools/fish.html"><strong aria-hidden="true">1.3.</strong> fish</a></li><li class="expanded "><a href="tools/tmux.html"><strong aria-hidden="true">1.4.</strong> tmux</a></li><li class="expanded "><a href="tools/git.html"><strong aria-hidden="true">1.5.</strong> git</a></li><li class="expanded "><a href="tools/awk.html"><strong aria-hidden="true">1.6.</strong> awk</a></li><li class="expanded "><a href="tools/emacs.html"><strong aria-hidden="true">1.7.</strong> emacs</a></li><li class="expanded "><a href="tools/gdb.html"><strong aria-hidden="true">1.8.</strong> gdb</a></li><li class="expanded "><a href="tools/radare2.html"><strong aria-hidden="true">1.9.</strong> radare2</a></li></ol></li><li class="expanded "><a href="monitor/index.html"><strong aria-hidden="true">2.</strong> Resource analysis & monitor</a></li><li><ol class="section"><li class="expanded "><a href="monitor/lsof.html"><strong aria-hidden="true">2.1.</strong> lsof</a></li><li class="expanded "><a href="monitor/pidstat.html"><strong aria-hidden="true">2.2.</strong> pidstat</a></li><li class="expanded "><a href="monitor/pgrep.html"><strong aria-hidden="true">2.3.</strong> pgrep</a></li><li class="expanded "><a href="monitor/pmap.html"><strong aria-hidden="true">2.4.</strong> pmap</a></li><li class="expanded "><a href="monitor/pstack.html"><strong aria-hidden="true">2.5.</strong> pstack</a></li></ol></li><li class="expanded "><a href="trace_profile/index.html"><strong aria-hidden="true">3.</strong> Trace and Profile</a></li><li><ol class="section"><li class="expanded "><a href="trace_profile/strace.html"><strong aria-hidden="true">3.1.</strong> strace</a></li><li class="expanded "><a href="trace_profile/ltrace.html"><strong aria-hidden="true">3.2.</strong> ltrace</a></li><li class="expanded "><a href="trace_profile/perf.html"><strong aria-hidden="true">3.3.</strong> perf</a></li><li class="expanded "><a href="trace_profile/oprofile.html"><strong aria-hidden="true">3.4.</strong> OProfile</a></li><li class="expanded "><a href="trace_profile/time.html"><strong aria-hidden="true">3.5.</strong> time</a></li></ol></li><li class="expanded "><a href="binary/index.html"><strong aria-hidden="true">4.</strong> Binary</a></li><li><ol class="section"><li class="expanded "><a href="binary/od.html"><strong aria-hidden="true">4.1.</strong> od</a></li><li class="expanded "><a href="binary/xxd.html"><strong aria-hidden="true">4.2.</strong> xxd</a></li><li class="expanded "><a href="binary/readelf.html"><strong aria-hidden="true">4.3.</strong> readelf</a></li><li class="expanded "><a href="binary/objdump.html"><strong aria-hidden="true">4.4.</strong> objdump</a></li><li class="expanded "><a href="binary/nm.html"><strong aria-hidden="true">4.5.</strong> nm</a></li></ol></li><li class="expanded "><a href="development/index.html"><strong aria-hidden="true">5.</strong> Development</a></li><li><ol class="section"><li class="expanded "><a href="development/c++filt.html"><strong aria-hidden="true">5.1.</strong> c++filt</a></li><li class="expanded "><a href="development/c++.html"><strong aria-hidden="true">5.2.</strong> c++</a></li><li class="expanded "><a href="development/glibc.html"><strong aria-hidden="true">5.3.</strong> glibc</a></li><li class="expanded "><a href="development/gcc.html"><strong aria-hidden="true">5.4.</strong> gcc</a></li><li class="expanded "><a href="development/make.html"><strong aria-hidden="true">5.5.</strong> make</a></li><li class="expanded "><a href="development/ld.so.html"><strong aria-hidden="true">5.6.</strong> ld.so</a></li></ol></li><li class="expanded "><a href="arch/index.html"><strong aria-hidden="true">6.</strong> Arch</a></li><li><ol class="section"><li class="expanded "><a href="arch/x86_64.html"><strong aria-hidden="true">6.1.</strong> x86_64</a></li></ol></li></ol> </div> <div id="sidebar-resize-handle" class="sidebar-resize-handle"></div> </nav> @@ -1398,6 +1398,7 @@ the <code>.rodata</code> section as follows:</p> <li><a href="development/./c++.html">c++</a></li> <li><a href="development/./glibc.html">glibc</a></li> <li><a href="development/./gcc.html">gcc</a></li> +<li>[make] (./make.md)</li> <li><a href="development/./ld.so.html">ld.so</a></li> </ul> <h1><a class="header" href="#cfilt1" id="cfilt1">c++filt(1)</a></h1> @@ -1496,6 +1497,97 @@ run1: xor eax, eax jmp bar </code></pre> +<h1><a class="header" href="#make1" id="make1">make(1)</a></h1> +<h2><a class="header" href="#anatomy-of-make-rules" id="anatomy-of-make-rules">Anatomy of <code>make</code> rules</a></h2> +<pre><code class="language-make">target .. : prerequisite .. + recipe + .. +</code></pre> +<ul> +<li><code>target</code>: an output generated by the rule</li> +<li><code>prerequisite</code>: an input that is used to generate the target</li> +<li><code>recipe</code>: list of actions to generate the output from the input</li> +</ul> +<blockquote> +<p>Use <code>make -p</code> to print all rules and variables (implicitly + explicitly defined).</p> +</blockquote> +<h2><a class="header" href="#pattern-rules--automatic-variables" id="pattern-rules--automatic-variables">Pattern rules & Automatic variables</a></h2> +<h3><a class="header" href="#pattern-rules" id="pattern-rules">Pattern rules</a></h3> +<p>A pattern rule contains the <code>%</code> char (exactly one of them) and look like this example:</p> +<pre><code class="language-make">%.o : %.c + $(CC) -c $(CFLAGS) $(CPPFLAGS) $< -o $@ +</code></pre> +<p>The target matches files of the pattern <code>%.o</code>, where <code>%</code> matches any none-empty +substring and other character match just them self.</p> +<p>The substring matched by <code>%</code> is called the <code>stem</code>.</p> +<p><code>%</code> in the prerequisite stands for the matched <code>stem</code> in the target.</p> +<h3><a class="header" href="#automatic-variables" id="automatic-variables">Automatic variables</a></h3> +<p>As targets and prerequisites in pattern rules can't be spelled explicitly in +the recipe, make provides a set of automatic variables to work with:</p> +<ul> +<li><code>$@</code>: Name of the target that triggered the rule.</li> +<li><code>$<</code>: Name of the first prerequisite.</li> +<li><code>$^</code>: Names of all prerequisites (without duplicates).</li> +<li><code>$+</code>: Names of all prerequisites (with duplicates).</li> +<li><code>$*</code>: Stem of the pattern rule.</li> +</ul> +<pre><code class="language-make"># file: Makefile + +all: foobar blabla + +foo% bla%: aaa bbb bbb + @echo "@ = $@" + @echo "< = $<" + @echo "^ = $^" + @echo "+ = $+" + @echo "* = $*" + @echo "----" + +aaa: +bbb: +</code></pre> +<p>Running above <code>Makefile</code> gives:</p> +<pre><code class="language-test">@ = foobar +< = aaa +^ = aaa bbb ++ = aaa bbb bbb +* = bar +---- +@ = blabla +< = aaa +^ = aaa bbb ++ = aaa bbb bbb +* = bla +---- +</code></pre> +<h2><a class="header" href="#useful-functions" id="useful-functions">Useful functions</a></h2> +<h3><a class="header" href="#substitution-references" id="substitution-references">Substitution references</a></h3> +<p>Substitute strings matching pattern in a list.</p> +<pre><code class="language-make">in := a.o l.a c.o +out := $(in:.o=.c) +# => out = a.c l.a c.c +</code></pre> +<h3><a class="header" href="#filter" id="filter"><code>filter</code></a></h3> +<p>Keep strings matching a pattern in a list.</p> +<pre><code class="language-make">in := a.a b.b c.c d.d +out := $(filter %.b %.c, $(in)) +# => out = b.b c.c +</code></pre> +<h3><a class="header" href="#filter-out" id="filter-out"><code>filter-out</code></a></h3> +<p>Remove strings matching a pattern from a list.</p> +<pre><code class="language-make">in := a.a b.b c.c d.d +out := $(filter-out %.b %.c, $(in)) +# => out = a.a d.d +</code></pre> +<h3><a class="header" href="#abspath" id="abspath"><code>abspath</code></a></h3> +<p>Resolve each file name as absolute path (don't resolve symlinks).</p> +<pre><code class="language-make">$(abspath fname1 fname2 ..) + +### `realpath` +Resolve each file name as canonical path. +```make +$(realpath fname1 fname2 ..) +</code></pre> <h1><a class="header" href="#ldso8" id="ldso8">ld.so(8)</a></h1> <h2><a class="header" href="#environment-variables" id="environment-variables">Environment Variables</a></h2> <pre><code class="language-console"> LD_PRELOAD=<l_so> colon separated list of libso's to be pre loaded |