Skip to content

Commit 790aaaf

Browse files
committed
Add line numbering
1 parent 675b1e6 commit 790aaaf

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

07-Building-with-Make.md

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,7 @@ Using the powers of `git`, you travel into the future, read the rest of this cha
3636
Instead of this hippie artisanal handcrafted sandwich garbage, you sit your past self down at their terminal and whisper savory nothings[^nothings] in their ear.
3737
They --- you --- crack open a fresh editor and pen the pastrami of your dreams:
3838

39-
```makefile
40-
39+
```{.makefile .numberLines}
4140
pickles: cucumbers vinegar dill
4241
brine --with=dill cucumbers
4342

@@ -139,7 +138,7 @@ Along with each target goes one or more commands that, when run, create the targ
139138
For example, let's say you want to build an executable named `program` by compiling all the C`++` files in the current directory.
140139
You could do the following:
141140

142-
```makefile
141+
```{.makefile .numberLines}
143142
program:
144143
g++ *.cpp -o program
145144
```
@@ -170,7 +169,7 @@ For our example, let's suppose we have a classic CS 1570 assignment with a `main
170169
Whenever any one of these files change, we want to recompile `program`.
171170
We specify these dependencies after the colon following the target name:
172171
173-
```makefile
172+
```{.makefile .numberLines}
174173
program: main.cpp funcs.h funcs.cpp
175174
g++ *.cpp -o program
176175
```
@@ -182,7 +181,7 @@ Not to worry: you can have one target depend on files produced by other targets!
182181
Then, `make` will do the work of running each compilation and linking step as needed.
183182
Continuing our example, we add two new targets for our object files, `main.o` and `funcs.o`:
184183

185-
```makefile
184+
```{.makefile .numberLines}
186185
program: main.o funcs.o
187186
g++ main.o funcs.o -o program
188187

@@ -226,7 +225,7 @@ and `make` will be like, "Sure thing, boss! Look at me, not being confused at al
226225
Let's make a `clean` target for our example from the last section.
227226
Having a target named `clean` that gets rid of all the compiled files in your current directory is good `make` etiquette.
228227

229-
```makefile
228+
```{.makefile .numberLines}
230229
program: main.o funcs.o
231230
g++ main.o funcs.o -o program
232231

@@ -276,7 +275,7 @@ We'll make a `CFLAGS` variable to hold the "release" flags and a `DEBUGFLAGS` va
276275
That way, if we want to change our flags later on, we only need to look in one spot.
277276
We'll also add a phony `debug` target so that running `make debug` builds our program in debug mode.
278277

279-
```makefile
278+
```{.makefile .numberLines}
280279
CFLAGS = -O2
281280
DEBUGFLAGS = -g -Wall -Wextra
282281

@@ -333,7 +332,7 @@ Hmm, but how would we write a command for this target? `g++` still needs to know
333332
334333
Let's rewrite our example using a pattern target to make the object files:
335334
336-
```makefile
335+
```{.makefile .numberLines}
337336
SOURCES=$(wildcard *.cpp)
338337
OBJECTS=$(SOURCES:%.cpp=%.o)
339338
HEADERS=$(wildcard *.h)
@@ -374,7 +373,7 @@ Name: `______________________________`
374373

375374
Consider the following makefile:
376375

377-
```makefile
376+
```{.makefile .numberLines}
378377
default: triangles
379378

380379
triangles: main.o TrianglePrinter.o funcs.o

0 commit comments

Comments
 (0)