Skip to content

Commit c5d51d6

Browse files
author
jennybc
committed
refresh make stuff
1 parent e9ec1fe commit c5d51d6

8 files changed

+40
-10
lines changed

automation00_index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@ <h3>Hands-on activity</h3>
141141
<li>How to use <code>make</code> from the <a href="git09_shell.html">shell</a></li>
142142
<li>How Git facilitates the process of building a pipeline</li>
143143
</ul>
144+
<p><em>2015-11-19 Andrew MacDonald translated the above into a pipeline for the <a href="https://github.com/richfitz/remake"><code>remake</code> package</a> from Rich Fitzjohn: see <a href="https://gist.github.com/aammd/72a5b98356893c001001">this gist</a>.</em></p>
144145
</div>
145146
<div id="more-examples" class="section level3">
146147
<h3>More examples</h3>

automation00_index.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ Walk before you run! Prove that `make` is actually installed and that it can be
4444
* The interface between RStudio and `make`
4545
* How to use `make` from the [shell](git09_shell.html)
4646
* How Git facilitates the process of building a pipeline
47+
48+
*2015-11-19 Andrew MacDonald translated the above into a pipeline for the [`remake` package](https://github.com/richfitz/remake) from Rich Fitzjohn: see [this gist](https://gist.github.com/aammd/72a5b98356893c001001).*
4749

4850
### More examples
4951

automation02_windows.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ <h4 class="author"><em>Shaun Jackman, Dean Attali, Jenny Bryan</em></h4>
9696

9797

9898
<p><em>2015-11-17 NOTE: This year we made R packages before we used Make. The hope is, therefore, that the Make that ships with Rtools is all we need. So hopefully we can ignore this?</em></p>
99+
<p>back to <a href="automation00_index.html">All the automation things</a></p>
99100
<div id="install-make-on-microsoft-windows" class="section level3">
100101
<h3>Install <code>make</code> on Microsoft Windows</h3>
101102
<p>We are still working out the best way to install <code>make</code> on Windows. Our current best recommendation is to install <em>msysGit</em>, which includes <code>make</code> as well as <code>git</code> and <code>bash</code>.</p>
@@ -144,6 +145,7 @@ <h3>Issues we are still clarifying</h3>
144145
<li>See <a href="https://github.com/STAT545-UBC/Discussion/issues/54">issue 54</a> on the Discussion repo.</li>
145146
</ul></li>
146147
</ul>
148+
<p>back to <a href="automation00_index.html">All the automation things</a></p>
147149
</div>
148150

149151
<div class="footer">

automation02_windows.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ output:
1010

1111
*2015-11-17 NOTE: This year we made R packages before we used Make. The hope is, therefore, that the Make that ships with Rtools is all we need. So hopefully we can ignore this?*
1212

13+
back to [All the automation things](automation00_index.html)
14+
1315
### Install `make` on Microsoft Windows
1416

1517
We are still working out the best way to install `make` on Windows. Our current best recommendation is to install *msysGit*, which includes `make` as well as `git` and `bash`.
@@ -53,3 +55,5 @@ What are the tricky bits?
5355
* Ensuring `make`, `Rscript`, `pandoc`, `rm`, etc. can be found = updating `PATH`.
5456
* Getting `make` to use the correct [shell](git09_shell.html).
5557
- See [issue 54](https://github.com/STAT545-UBC/Discussion/issues/54) on the Discussion repo.
58+
59+
back to [All the automation things](automation00_index.html)

automation03_make-test-drive.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ <h4 class="author"><em>Shaun Jackman, Jenny Bryan</em></h4>
106106
</div>
107107

108108
<p>Before we use <code>make</code> for real work, we want to prove beyond a shadow of a doubt that it’s installed and findable from RStudio and/or the <a href="git09_shell.html">shell</a>.</p>
109+
<p>back to <a href="automation00_index.html">All the automation things</a></p>
109110
<div id="create-a-temporary-rstudio-project" class="section level3">
110111
<h3>Create a temporary RStudio Project</h3>
111112
<p>You can delete this project after this test drive, so don’t sweat too much about what you name it or where you put it.</p>
@@ -175,6 +176,7 @@ <h3>Run <code>make</code> from the <a href="git09_shell.html">shell</a></h3>
175176
</ul>
176177
<p>You should be seeing similar output as you saw in the Build tab of RStudio.</p>
177178
<p>If you are not, are you getting the error message that’s characteristic of a “spaces instead of tabs” problem? Or does it look more like <code>make</code> or other commands aren’t being found? If the latter, go back to the <a href="automation02_windows.html">Windows installation page</a> or reach out to the course staff.</p>
179+
<p>back to <a href="automation00_index.html">All the automation things</a></p>
178180
</div>
179181

180182
<div class="footer">

automation03_make-test-drive.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ output:
1010

1111
Before we use `make` for real work, we want to prove beyond a shadow of a doubt that it's installed and findable from RStudio and/or the [shell](git09_shell.html).
1212

13+
back to [All the automation things](automation00_index.html)
14+
1315
### Create a temporary RStudio Project
1416

1517
You can delete this project after this test drive, so don't sweat too much about what you name it or where you put it.
@@ -107,3 +109,5 @@ RStudio only provides access to a very limited bit of `make` -- it's even more l
107109
You should be seeing similar output as you saw in the Build tab of RStudio.
108110

109111
If you are not, are you getting the error message that's characteristic of a "spaces instead of tabs" problem? Or does it look more like `make` or other commands aren't being found? If the latter, go back to the [Windows installation page](automation02_windows.html) or reach out to the course staff.
112+
113+
back to [All the automation things](automation00_index.html)

automation04_make-activity.html

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ <h4 class="date"><em>2014-11-03</em></h4>
123123
<li>render a R Markdown report in HTML and PDF</li>
124124
</ul>
125125
<p>You will automate this pipeline using <code>make</code>!</p>
126+
<p>back to <a href="automation00_index.html">All the automation things</a></p>
126127
<div id="dependency-graph-of-the-pipeline" class="section level3">
127128
<h3>Dependency graph of the pipeline</h3>
128129
<!-- TO DO: remake the figure to say words.txt not words.tsv and the new words downloading strategy -->
@@ -133,11 +134,6 @@ <h3>Set up a new RStudio Project (and Git repo)</h3>
133134
<p>In RStudio: <em>File &gt; New Project &gt; New Directory &gt; Empty Project.</em> If you’re a Git user, we strongly encourage you to click on “Create a git repository.”</p>
134135
<p>This project will be useful as a reference in the future, so give it an informative name and location. If you’re a GitHub user, you may want to push it there as well.</p>
135136
<p>Git(Hub) users: from here on out, we assume you will be committing at regular intervals. At key points, we explicitly prompt you to commit.</p>
136-
<p>Configure this RStudio Project to work with <code>make</code>. Consult the <a href="automation03_make-test-drive.html"><code>make</code> test drive</a> for details:</p>
137-
<ul>
138-
<li>make sure tabs are NOT replaced with spaces</li>
139-
<li>set Project Build Tools to <code>Makefile</code></li>
140-
</ul>
141137
<p>Git folks: commit now.</p>
142138
</div>
143139
<div id="sample-project-and-git-repository" class="section level3">
@@ -148,6 +144,14 @@ <h3>Sample Project and Git repository</h3>
148144
<div id="create-the-makefile" class="section level3">
149145
<h3>Create the Makefile</h3>
150146
<p>In RStudio: <em>File &gt; New File &gt; Text File.</em> Save it with the name <code>Makefile</code>. Keep adding the rules we write below to this file, saving regularly.</p>
147+
<p>Once you’ve saved the file with the name <code>Makefile</code>, RStudio should indent with tabs instead of spaces. I recommend you display whitespace in order to visually confirm this: <em>RStudio &gt; Preferences &gt; Code &gt; Display &gt; Display whitespace characters</em>. A more extreme measure is to set Project or Global preferences to NOT replace tabs with spaces, but this will wreak havoc elsewhere.</p>
148+
<p>You also want RStudio to recognize the presence of the <code>Makefile</code>. Pick one:</p>
149+
<ul>
150+
<li>set Project Build Tools to <code>Makefile</code></li>
151+
<li>quit and relaunch</li>
152+
</ul>
153+
<p>You should see a “Build” tab now in the same pane as “Environment”, “History”, and, if applicable, “Git”.</p>
154+
<p>Git folks: commit now.</p>
151155
</div>
152156
<div id="get-the-dictionary-of-words" class="section level3">
153157
<h3>Get the dictionary of words</h3>
@@ -358,6 +362,7 @@ <h3>Appendix</h3>
358362
<p>The <code>.PHONY</code> line is where you declare which targets are <em>phony</em>, i.e. are not actual files to be made in the literal sense. It’s a good idea to explicitly tell <code>make</code> which targets are phony, instead of letting it try to deduce this. <code>make</code> can get confused if you create a file that has the same name as a phony target. If for example you create a directory named <code>clean</code> to hold your clean data and run <code>make clean</code>, then <code>make</code> will report <code>'clean' is up to date</code>, because a directory with that name already exists.</p>
359363
<p><code>.DELETE_ON_ERROR</code> causes <code>make</code> to “delete the target of a rule if it has changed and its recipe exits with a nonzero exit status”. In English, this means that – if a rule starts to run but then exits due to error – any outputs written in the course of that fiasco will be deleted. This can protect you from having half-baked, erroneous files lying around that will just confuse you later.</p>
360364
<p><code>.SECONDARY</code> tells <code>make</code> not to delete intermediate files of a chain of pattern rules. Consider creating a <code>Makefile</code> with two pattern rules, <code>%.md: %.rmd</code> and <code>%.html: %.md</code>, and then running <code>make report.html</code>. After <code>make</code> has created <code>report.md</code> and <code>report.html</code>, it will delete the intermediate file <code>report.md</code>. Adding <code>.SECONDARY</code> to your <code>Makefile</code> prevents the intermediate file from being deleted.</p>
365+
<p>back to <a href="automation00_index.html">All the automation things</a></p>
361366
</div>
362367

363368
<div class="footer">

automation04_make-activity.md

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ The goal of this activity is to create a pipeline that will
1919

2020
You will automate this pipeline using `make`!
2121

22+
back to [All the automation things](automation00_index.html)
23+
2224
### Dependency graph of the pipeline
2325

2426
<!-- TO DO: remake the figure to say words.txt not words.tsv and the new words downloading strategy -->
@@ -33,11 +35,6 @@ This project will be useful as a reference in the future, so give it an informat
3335

3436
Git(Hub) users: from here on out, we assume you will be committing at regular intervals. At key points, we explicitly prompt you to commit.
3537

36-
Configure this RStudio Project to work with `make`. Consult the [`make` test drive](automation03_make-test-drive.html) for details:
37-
38-
* make sure tabs are NOT replaced with spaces
39-
* set Project Build Tools to `Makefile`
40-
4138
Git folks: commit now.
4239

4340
### Sample Project and Git repository
@@ -50,6 +47,17 @@ The Project is set up for use with `make` at [this commit](https://github.com/ST
5047

5148
In RStudio: *File > New File > Text File.* Save it with the name `Makefile`. Keep adding the rules we write below to this file, saving regularly.
5249

50+
Once you've saved the file with the name `Makefile`, RStudio should indent with tabs instead of spaces. I recommend you display whitespace in order to visually confirm this: *RStudio > Preferences > Code > Display > Display whitespace characters*. A more extreme measure is to set Project or Global preferences to NOT replace tabs with spaces, but this will wreak havoc elsewhere.
51+
52+
You also want RStudio to recognize the presence of the `Makefile`. Pick one:
53+
54+
* set Project Build Tools to `Makefile`
55+
* quit and relaunch
56+
57+
You should see a "Build" tab now in the same pane as "Environment", "History", and, if applicable, "Git".
58+
59+
Git folks: commit now.
60+
5361
### Get the dictionary of words
5462

5563
Depending on your OS and mood, you can get the file of English words by copying a local file or downloading from the internet.
@@ -312,3 +320,5 @@ The `.PHONY` line is where you declare which targets are *phony*, i.e. are not a
312320
`.DELETE_ON_ERROR` causes `make` to "delete the target of a rule if it has changed and its recipe exits with a nonzero exit status". In English, this means that -- if a rule starts to run but then exits due to error -- any outputs written in the course of that fiasco will be deleted. This can protect you from having half-baked, erroneous files lying around that will just confuse you later.
313321

314322
`.SECONDARY` tells `make` not to delete intermediate files of a chain of pattern rules. Consider creating a `Makefile` with two pattern rules, `%.md: %.rmd` and `%.html: %.md`, and then running `make report.html`. After `make` has created `report.md` and `report.html`, it will delete the intermediate file `report.md`. Adding `.SECONDARY` to your `Makefile` prevents the intermediate file from being deleted.
323+
324+
back to [All the automation things](automation00_index.html)

0 commit comments

Comments
 (0)