{ "cells": [ { "cell_type": "markdown", "metadata": { "tags": [] }, "source": [ "# Lab Session 6: Automation and Make\n", "\n", "* **Statistics 159/259, Spring 2022**\n", "* Prof. F. Pérez and GSI F. Sapienza, Department of Statistics, UC Berkeley.\n", "* 03/14/2022\n", "\n", "\n", "Useful links: \n", "\n", "- [Automation and Make - The Carpentries](https://swcarpentry.github.io/make-novice/)\n", "- [Jupytext Repository](https://github.com/mwouts/jupytext/blob/main/README.md)\n", "- [JupyterHub](https://stat159.datahub.berkeley.edu/hub/login?next=%2Fhub%2F)\n", "- [Convenient credentials management](https://ucb-stat-159-s22.github.io/site/lectures/intro-git/Git-Tutorial.html#convenient-credentials-management)\n", "\n", "**Acknowledgment:** The contents we are following for this course is based on the amazing tutorial about Automation and Make created by [The Carpentries](https://carpentries.org)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Make is called a **build tool**: it builds files, plots, papers, etc. Today we are going to do everything from the the shell. If you haven't done the setup for the tutorial during last lecture, please follow the [setup page](https://swcarpentry.github.io/make-novice/setup) in order to start working with the contents of the tutorial. \n", "\n", "We will start from the following version of our `Makefile` created inside the folder `make-lesson` provided in the tutorial." ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
# Generate summary table.\n",
"results.txt : testzipf.py isles.dat abyss.dat last.dat\n",
"\tpython $< *.dat > $@\n",
"\n",
"# Count words.\n",
".PHONY : dats\n",
"dats : isles.dat abyss.dat last.dat\n",
"\n",
"isles.dat : books/isles.txt countwords.py\n",
"\tpython countwords.py $< $@\n",
"\n",
"abyss.dat : books/abyss.txt countwords.py\n",
"\tpython countwords.py $< $@\n",
"\n",
"last.dat : books/last.txt countwords.py\n",
"\tpython countwords.py $< $@\n",
"\n",
".PHONY : clean\n",
"clean :\n",
"\trm -f *.dat\n",
"\trm -f results.txt\n",
"