@@ -1317,15 +1317,15 @@ This file(s) will be created or updated by this make rule.
1317
1317
`checked for modifications` by last edit time marker.
1318
1318
1319
1319
`tab`:: is tabulation char with ascii code 0x09, you must have editor able to
1320
- work with tabs not overwriting them into sequencies of spaces. Make rule can
1321
- have zero rules, or some tabbed compiling commands.
1320
+ work with tabs not overwriting them into sequences of spaces. Make rule can
1321
+ have zero rules or some tabbed compiling commands.
1322
1322
1323
1323
`compiling command`:: any command, like assembly or linker call, which updates
1324
- < target> s, doing some useful job.
1324
+ ` target` s, doing some useful job.
1325
1325
1326
- NOTE: Main principle of every makefile rule: if one of < source> files
1327
- `newer` then one of < target> file, rule body will be executed to update
1328
- < target> s.
1326
+ NOTE: The main principle of every makefile rule: if one of ` source` files
1327
+ `newer` then one of ` target` file, rule body will be executed to update
1328
+ ` target` s.
1329
1329
1330
1330
Let's write simple makefile for tiny program, described in `Hello ARM` section:
1331
1331
@@ -1360,13 +1360,13 @@ QEMU 2.1.2 monitor - type 'help' for more information
1360
1360
------
1361
1361
1362
1362
NOTE: If you use make without parameters, `first rule` in Makefile will be
1363
- processed as main < target> , walking over dependencies in all rules.
1363
+ processed as main ` target` , walking over dependencies in all rules.
1364
1364
1365
1365
[[makeseltarget]]
1366
- Selecting specific < target>
1366
+ Selecting specific ` target`
1367
1367
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1368
1368
1369
- If you need to update only specific < target> , not first rule, put required
1369
+ If you need to update only specific ` target` , not first rule, put required
1370
1370
file name after make command:
1371
1371
1372
1372
------
@@ -1378,7 +1378,7 @@ This command will build only add.o object file, if and only if you modified add.
1378
1378
before command run. If you see some message like `make: 'add.o' is up to date.`,
1379
1379
source file was not changed, and make will not run assembler rule.
1380
1380
1381
- This is very useful if you have lot of source files (thousands files, like
1381
+ This is very useful if you have lot of source files (thousands of files, like
1382
1382
Linux kernel for example), and fix some bug only in one source file. Without
1383
1383
make (using simple .rc shell script of .bat ch file) every tiny change in
1384
1384
source file
@@ -1396,10 +1396,10 @@ arm-none-eabi-as -o add.o add.s
1396
1396
------
1397
1397
1398
1398
`touch` command changes only modification time of source file add.s, not
1399
- chainging it's content, thus `make` will note that file changed, and run
1400
- assembler for selected < target> =add.o.
1399
+ changing it's content, thus `make` will note that file changed, and run
1400
+ assembler for selected target=add.o.
1401
1401
1402
- By default, make will print every command and it's output. If you have some
1402
+ By default, make will print every command and its output. If you have some
1403
1403
reason to quiet make logging, you can prefix some compiler commands in make rule
1404
1404
with "-" minus sign.
1405
1405
@@ -1413,9 +1413,9 @@ can define some vars in makefile, and use them in all rules.
1413
1413
Very useful make tip: you can use two special variables: $@ and @<.
1414
1414
1415
1415
`$@`:: variable represents left side of Makefile rule, typically single
1416
- < target> file name
1416
+ ` target` file name
1417
1417
1418
- `$<`:: variable will be replaced by `first` file if < source> list
1418
+ `$<`:: variable will be replaced by `first` file if ` source` list
1419
1419
1420
1420
NOTE: running make, you can forced redefine any variables values: change
1421
1421
compiler options, tune rules, and ever use one universal makefile for all
@@ -1425,7 +1425,7 @@ So, we can change our makefile to be more adaptive:
1425
1425
1426
1426
------
1427
1427
# APPlication name, you can change it in make command line parameters
1428
- # to compile other onefile program with same makefile
1428
+ # to compile another onefile program with same makefile
1429
1429
APP = add
1430
1430
1431
1431
# some std.variables widely used in Linux source builds:
@@ -1443,7 +1443,7 @@ OBJCOPY = $(TARGET)objcopy
1443
1443
1444
1444
# FlashROM size of target system, in 4K block
1445
1445
FLASHBLOCKS = 4K
1446
- emulation : $(APP).flash
1446
+ emu : $(APP).flash
1447
1447
qemu-system-$(ARCH) -M connex -pflash $< \
1448
1448
-nographic -serial /dev/null
1449
1449
@@ -1468,7 +1468,7 @@ Then, we replaced all file parameters in assembler/linker calls with
1468
1468
Also we used some std.variables to select target system architecture, and
1469
1469
prefixed all toolchain calls with $(TARGET) variable.
1470
1470
1471
- NOTE: Now we can compile `other ` source file: arrsum.s, contains listing
1471
+ NOTE: Now we can compile `another ` source file: arrsum.s, contains listing
1472
1472
of array summation program. We `override APP variable value in command line`:
1473
1473
1474
1474
------
@@ -1492,11 +1492,11 @@ QEMU 2.1.2 monitor - type 'help' for more information
1492
1492
(qemu) q
1493
1493
------
1494
1494
1495
- Wow, we compiled other program without any change in Makefile, all file names
1495
+ Wow, we compiled another program without any change in Makefile, all file names
1496
1496
was renamed automatically, we jet get separate flash image and running Qemu
1497
1497
in one command.
1498
1498
1499
- Let's dig in details
1499
+ Let's dig into details
1500
1500
1501
1501
[[makestdvars]]
1502
1502
Standard make variables
@@ -1549,7 +1549,7 @@ OpenSource developers world have some widely used standard targets:
1549
1549
1550
1550
`doc`:: build documentation, using some of asciidoc, DocBook, LaTeX,.. markup
1551
1551
translators, which will translate doc sources into some widely used document
1552
- format like .html and manual.pdf files. Fortunately you can use special program
1552
+ format like .html and manual.pdf files. Fortunately, you can use special program
1553
1553
packages (for some programming languages like Java, C++,..) which let you
1554
1554
process your program sources and autogenerate tables of labels, function
1555
1555
definitions with parameters a.k.a call signatures, source file lists,
@@ -1565,7 +1565,7 @@ make
1565
1565
------
1566
1566
1567
1567
`distclean`:: same as clean with removing generated files going into binary
1568
- distribution of builded program package: .pdf/.html documentation,..
1568
+ distribution of built program package: .pdf/.html documentation,..
1569
1569
1570
1570
.Recommended Makefile rules
1571
1571
------
@@ -1586,8 +1586,8 @@ distclean: clean
1586
1586
.PHONY targets
1587
1587
~~~~~~~~~~~~~
1588
1588
1589
- In previous makefile sample you can see `.PHONY some` directives.
1590
- This directives marks < target> is one that is not really the name of a file;
1589
+ In previous makefile sample, you can see `.PHONY some` directives.
1590
+ This directives marks ` target` is one that is not really the name of a file;
1591
1591
rather it is just `a name for a recipe` to be executed when you make an
1592
1592
explicit request `make some` command.
1593
1593
@@ -1599,10 +1599,21 @@ Because the rm command in `clean` rule does not create a file named "clean",
1599
1599
probably no such file will ever exist. Therefore, the rm command will be
1600
1600
executed every time you say ‘make clean’.
1601
1601
1602
+ NOTE: You can think about set of phony targets in Makefile as something
1603
+ like `command line menu`: you select required action by run `make action`
1604
+
1602
1605
[[makeqemu]]
1603
1606
Run qemu from `Makefile`
1604
1607
~~~~~~~~~~~~~~~~~~~~~~~~
1605
1608
1609
+ If you define special `emu` rule:
1610
+ ------
1611
+ .PHONY: emu
1612
+ emu: $(APP).flash
1613
+ qemu-system-$(ARCH) -M connex -pflash $< \
1614
+ -nographic -serial /dev/null
1615
+ ------
1616
+
1606
1617
[[makefiles]]
1607
1618
Some file/directory hints
1608
1619
~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -1636,7 +1647,7 @@ only one ~/universal.makefile for all of your projects.
1636
1647
Using pattern rules
1637
1648
~~~~~~~~~~~~~~~~~~~
1638
1649
1639
- Finaly , let's do some strange thing: define universal pattern rules, which will
1650
+ Finally , let's do some strange thing: define universal pattern rules, which will
1640
1651
assemble, compile and link `any` file with specific extensions.
1641
1652
1642
1653
.Makefile pattern rules
0 commit comments