Make: Build Software
Alexius Wadell
Lover of Make and all Directed Acyclic Graphs
Examples: https://tinyurl.com/jsvjhkz5
1
1
1
1
Build Tools: Automating Compilation
Blaze Inspired
Makefile Generation
Other Tools
2
2
2
2
Why Make?
Pros
Cons
3
3
3
3
But I don’t compile code…
Do you?
4
4
4
4
Let’s Make Pie!
Target
Prerequisites
Rule
Recipe
5
5
5
5
Let’s Make Pie!
6
6
6
6
What’s going on?
butter
pie_crust
flour
libbys_pumpkin
pumpkin_filling
pumpkin_pie
salt
water
7
7
7
7
Summarizing Data
8
8
8
8
Automatic Variables
Symbol | Use |
$@ | Filename of the target |
$< | Filename of 1st prerequisites |
$(@D) | The directory of the target |
9
9
9
9
Phony Targets
With no arguments, make builds the first target it finds
Ever seen something like:
10
10
10
10
Phony Targets
Define targets that are not files
Some uses
11
11
11
11
Pattern Rules: Transform Files by Name
12
12
12
12
Chaining Rules
all
data1.csv
data1.sum
grand.csv
data2.csv
data2.sum
grand.sum
sum.py
13
13
13
13
Multi-Target Pattern Rules
all
data1.csv
data1.sum
grand2.csv
data2.avg
data2.csv
grand2.avg
sum_avg.py
14
14
14
14
Programs without Output
Not all programs produce “output”
Possible Solutions
15
15
15
15
Enter the Witness File
16
16
16
16
Next Steps
17
17
17
17
Homework
18
18
18
18
Resources
Documentation
Make in the Wild
19
19
19
19
Common Gotchas
20
20
20
20
Common Gotchas
Never use make –j to submit jobs to slurm or any other scheduler
Formatting:
Shell:
21
21
21
21
Common Gotchas: Path Handling
Directories time stamps are not updated when contents change
Make matches on strings not canonical filenames
22
22
22
22
Common Gotchas: Limitations
Make is not hermetic
Recursive Make Considered Harmful
23
23
23
23